zmq

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: 22 Imported by: 0

Documentation

Overview

Package zmq provides a SawtoothClientTransport implementation for the Sawtooth validator ZMQ interface.

Index

Constants

View Source
const MAX_CONNECTIONS = 8

Variables

This section is empty.

Functions

func NewCommonZmqIterator

func NewCommonZmqIterator(transport *SawtoothClientTransportZmq,
	pagingControl *client_list_control_pb2.ClientPagingControls,
	sortControl []*client_list_control_pb2.ClientSortControls,
	impl zmqIteratorImpl) *commonZmqIterator

NewCommonZmqIterator returns a new commonZmqIterator for use in composing a usable object iterator.

Types

type SawtoothClientTransportZmq

type SawtoothClientTransportZmq struct {
	// URL is the ZMQ URL to the validator
	URL *url.URL

	// Context is a common ZMQ context for the transport
	Context *zmq4.Context

	// ConnectionChannel is a channel to hold ZMQ connections
	ConnectionChannel chan *sawtoothZmqConnection
	// contains filtered or unexported fields
}

SawtoothClientTransportZmq represents a connection to the validator via ZMQ.

func NewSawtoothClientTransportZmq

func NewSawtoothClientTransportZmq(url *url.URL) (*SawtoothClientTransportZmq, error)

NewSawtoothClientTransportZmq returns a new SawtoothClientTransportZmq for the given URL. Returns an error if a test request to the validator does not succeed.

func (*SawtoothClientTransportZmq) GetBatch

func (transportZmq *SawtoothClientTransportZmq) GetBatch(batchId string) (*types.Batch, error)

GetBatch returns the batch represented by batchId.

func (*SawtoothClientTransportZmq) GetBatchIterator

func (transportZmq *SawtoothClientTransportZmq) GetBatchIterator(fetch int, reverse bool) types.BatchIterator

GetBatchIterator returns a types.BatchIterator that can iterate over all batches.

func (*SawtoothClientTransportZmq) GetBatchStatus

func (transportZmq *SawtoothClientTransportZmq) GetBatchStatus(batchId string, wait int) (types.BatchStatus, error)

GetBatchStatus returns the status for a single batch.

func (*SawtoothClientTransportZmq) GetBatchStatusMultiple

func (transportZmq *SawtoothClientTransportZmq) GetBatchStatusMultiple(batchIds []string, wait int) (map[string]types.BatchStatus, error)

GetBatchStatusMultiple returns the statuses for a list of batches.

func (*SawtoothClientTransportZmq) GetBlock

func (transportZmq *SawtoothClientTransportZmq) GetBlock(blockId string) (*types.Block, error)

func (*SawtoothClientTransportZmq) GetBlockIterator

func (transportZmq *SawtoothClientTransportZmq) GetBlockIterator(fetch int, reverse bool) types.BlockIterator

GetBlockIterator returns a types.BlockIterator that can iterate over all blocks.

func (*SawtoothClientTransportZmq) GetPush added in v0.1.1

func (transportZmq *SawtoothClientTransportZmq) GetPush() (*events_pb2.EventList, error)

func (*SawtoothClientTransportZmq) GetState

func (transportZmq *SawtoothClientTransportZmq) GetState(address string) (*types.State, error)

GetState returns the state at the given address.

func (*SawtoothClientTransportZmq) GetStateAtHead

func (transportZmq *SawtoothClientTransportZmq) GetStateAtHead(address string, head string) (*types.State, error)

GetStateAtHead returns the state at the given address, at the given head.

func (*SawtoothClientTransportZmq) GetStateIterator

func (transportZmq *SawtoothClientTransportZmq) GetStateIterator(addressPrefix string, fetch int, reverse bool) types.StateIterator

GetStateData returns a types.StateIterator that can iterate over all state matching the given prefix.

func (*SawtoothClientTransportZmq) GetTransaction

func (transportZmq *SawtoothClientTransportZmq) GetTransaction(transactionId string) (*types.Transaction, error)

func (*SawtoothClientTransportZmq) GetTransactionIterator

func (transportZmq *SawtoothClientTransportZmq) GetTransactionIterator(fetch int, reverse bool) types.TransactionIterator

GetTransactionIterator returns a types.TransactionIterator that can iterate over all transactions.

func (*SawtoothClientTransportZmq) SubmitBatchList

func (transportZmq *SawtoothClientTransportZmq) SubmitBatchList(batchList *batch_pb2.BatchList) error

SubmitBatchList submits a batch list to Sawtooth. The batch list must be in the form of a batch_pb2.BatchList protobuf and be prepared appropriately (all required fields and signatures populated.

func (*SawtoothClientTransportZmq) Subscribe added in v0.1.1

func (transportZmq *SawtoothClientTransportZmq) Subscribe(matchString string, lastKnownBlockIds []string) (client_event_pb2.ClientEventsSubscribeResponse_Status, error)

type SawtoothClientTransportZmqError

type SawtoothClientTransportZmqError struct {
	// Type is the type of message that was sent to the validator
	Type validator_pb2.Message_MessageType
	// Request is the actual request sent to the validator
	Request proto.Message
	// Response is the actual response returned from the validator
	Response proto.Message
	// ErrorCode is the Sawtooth error code
	ErrorCode errors.SawtoothTransportErrorCode
}

func NewSawtoothClientTransportZmqError

func NewSawtoothClientTransportZmqError(t validator_pb2.Message_MessageType, request proto.Message, response proto.Message, errorCode errors.SawtoothTransportErrorCode) *SawtoothClientTransportZmqError

NewSawtoothClientTransportZmqError constructs a SawtoothClientTransportZmqError

func (*SawtoothClientTransportZmqError) Error

Error implements the error interface for SawtoothClientTransportZmqError

Jump to

Keyboard shortcuts

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