events

package
v0.0.0-...-3cbb637 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2024 License: BSD-3-Clause Imports: 19 Imported by: 0

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) ObjectID

func (e *Event) ObjectID() string

ObjectID returns the object ID for the event.

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

func (e *Event) RequestEnglish() string

RequestEnglish returns an english description for the request.

func (*Event) RequestMSPID

func (e *Event) RequestMSPID() string

RequestMSP returns the MSP ID for the connector.

func (*Event) RequestSystem

func (e *Event) RequestSystem() string

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 WithCheckpointFile(file string) Option

func WithEventCallback

func WithEventCallback(callback Callback) Option

WithEventCallback configures a function that's responsible for processing event responses.

func WithStartBlock

func WithStartBlock(blockNum uint64) Option

WithStartBlock sets the initial block to start retrieving events from.

Jump to

Keyboard shortcuts

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