Documentation
¶
Overview ¶
Package events is a library for retrieving events issued by Luther.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockCheckpointer ¶
type BlockCheckpointer interface { // BlockNumber in which the next event is expected. BlockNumber() uint64 // TransactionID of the last successfully processed event within the current block. TransactionID() string // CheckpointBlock records a successfully processed block. CheckpointBlock(blockNumber uint64) error // Close releases resources. Close() error }
BlockCheckpointer provides the current position for event processing, and records the last processed block.
type Callback ¶
type Callback func(string, json.RawMessage) error
Callback represents a callback function.
type Event ¶
type Event struct {
// contains filtered or unexported fields
}
Events capture requests raised by phylum transactions.
func (*Event) Callback ¶
func (e *Event) Callback(resp json.RawMessage, err error) error
Callback sends a response to the event back to Luther, or an error if processing failed.
func (*Event) RequestBody ¶
func (e *Event) RequestBody() (json.RawMessage, error)
RequestBody returns the request, or an error if the request could not be retrieved.
func (*Event) RequestEnglish ¶
RequestEnglish returns an english description for the request.
func (*Event) RequestMSPID ¶
RequestMSP returns the MSP ID for the connector.
func (*Event) RequestSystem ¶
RequestSystem returns the destination system name for the request.
type EventStream ¶
type EventStream struct {
// contains filtered or unexported fields
}
EventSteam provides a stream of events issued from Luther.
func GatewayEvents ¶
func GatewayEvents(cfg *GatewayConfig, opts ...Option) (*EventStream, error)
GatewayEvents returns a channel that streams Luther events directly from a fabric gateway.
func (*EventStream) Done ¶
func (s *EventStream) Done() error
Done closes the event stream and blocks the caller until resources are freed. Subsequent calls to Done() are ignored.
func (*EventStream) Listen ¶
func (s *EventStream) Listen() <-chan *Event
Listen returns a channel that receives events.
type GatewayConfig ¶
type GatewayConfig struct { MSPID string UserID string OrgDomain string CryptoConfigRootPath string PeerName string PeerEndpoint string ChannelName string ChaincodeID string }
GatewayConfig configures a fabric gateway.
type Option ¶
type Option func(*eventsConfig)
Option configures the event service.
func WithCheckpointFile ¶
func WithEventCallback ¶
WithEventCallback configures a function that's responsible for processing event responses.
func WithStartBlock ¶
WithStartBlock sets the initial block to start retrieving events from.