transport

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 24, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package transport provides a generalized interface called SawtoothClientTransport. A transport is an interface to communicate with Sawtooth. Currently, an implementation is provided that communicates with the Sawtooth REST API, but a ZMQ implementation that can connect directly to a validator is in the works.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SawtoothClientTransport

type SawtoothClientTransport interface {
	// Methods to retrieve and submit batches.
	GetBatch(batchId string) (*types.Batch, error)
	GetBatchIterator(fetch int, reverse bool) types.BatchIterator
	GetBatchStatus(batchId string, wait int) (types.BatchStatus, error)
	GetBatchStatusMultiple(batchIds []string, wait int) (map[string]types.BatchStatus, error)
	SubmitBatchList(batchList *batch_pb2.BatchList) error

	// Methods to retrieve blocks.
	GetBlock(blockId string) (*types.Block, error)
	GetBlockIterator(fetch int, reverse bool) types.BlockIterator

	// Methods to retrieve transactions.
	GetTransaction(transactionId string) (*types.Transaction, error)
	GetTransactionIterator(fetch int, reverse bool) types.TransactionIterator

	// Methods to retrieve state.
	GetState(address string) (*types.State, error)
	GetStateAtHead(address string, head string) (*types.State, error)
	GetStateIterator(addressPrefix string, fetch int, reverse bool) types.StateIterator

	//Methods to make subscribe
	Subscribe(matchString string, lastKnownBlockIds []string) (client_event_pb2.ClientEventsSubscribeResponse_Status, error)
	GetPush() (*events_pb2.EventList, error)
}

SawtoothClientTransport is an interface that represents a transport interface to Sawtooth.

func NewSawtoothClientTransport

func NewSawtoothClientTransport(transportType SawtoothClientTransportType, url *url.URL) (SawtoothClientTransport, error)

NewSawtoothClientTransport instantiates and returns a new SawtoothClientTransport of the specified type.

type SawtoothClientTransportType

type SawtoothClientTransportType int

SawtoothClientTransportType represents an individual transport implementation.

const TRANSPORT_REST SawtoothClientTransportType = 1

TRANSPORT_REST represents the REST API transport implementation.

const TRANSPORT_ZMQ SawtoothClientTransportType = 2

TRANSPORT_ZMQ represents the ZMQ transport implementation.

Directories

Path Synopsis
Package error provides a generalized error interface for transport implementations.
Package error provides a generalized error interface for transport implementations.
Package rest provides a SawtoothClientTransport implementation for the Sawtooth REST API.
Package rest provides a SawtoothClientTransport implementation for the Sawtooth REST API.
Package types provides generalized types that are used across the transport interface.
Package types provides generalized types that are used across the transport interface.
Package zmq provides a SawtoothClientTransport implementation for the Sawtooth validator ZMQ interface.
Package zmq provides a SawtoothClientTransport implementation for the Sawtooth validator ZMQ interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL