service

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dispatcher

type Dispatcher interface {
	// Start starts the dispatcher, i.e. the dispatcher starts listening for requests/events
	Start() error

	// EventCh is the event channel over which to communicate with the dispatcher
	EventCh() (chan<- interface{}, error)

	// LastBlockNum returns the block number of the last block for which an event was received.
	LastBlockNum() uint64
}

Dispatcher is responsible for processing registration requests and block/filtered block events.

type EventProducer

type EventProducer interface {
	// Register registers the given event channel with the event producer
	// and events are sent to this channel.
	Register(eventch chan<- interface{})
}

EventProducer produces events which are dispatched to clients

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service allows clients to register for channel events, such as filtered block, chaincode, and transaction status events.

func New

func New(dispatcher Dispatcher, opts ...options.Opt) *Service

New returns a new event service initialized with the given Dispatcher

func (*Service) Dispatcher

func (s *Service) Dispatcher() Dispatcher

Dispatcher returns the event dispatcher

func (*Service) RegisterBlockEvent

func (s *Service) RegisterBlockEvent(filter ...fab.BlockFilter) (fab.Registration, <-chan *fab.BlockEvent, error)

RegisterBlockEvent registers for block events. If the client is not authorized to receive block events then an error is returned.

func (*Service) RegisterChaincodeEvent

func (s *Service) RegisterChaincodeEvent(ccID, eventFilter string) (fab.Registration, <-chan *fab.CCEvent, error)

RegisterChaincodeEvent registers for chaincode events. If the client is not authorized to receive chaincode events then an error is returned. - ccID is the chaincode ID for which events are to be received - eventFilter is the chaincode event name for which events are to be received

func (*Service) RegisterFilteredBlockEvent

func (s *Service) RegisterFilteredBlockEvent() (fab.Registration, <-chan *fab.FilteredBlockEvent, error)

RegisterFilteredBlockEvent registers for filtered block events. If the client is not authorized to receive filtered block events then an error is returned.

func (*Service) RegisterTxStatusEvent

func (s *Service) RegisterTxStatusEvent(txID string) (fab.Registration, <-chan *fab.TxStatusEvent, error)

RegisterTxStatusEvent registers for transaction status events. If the client is not authorized to receive transaction status events then an error is returned. - txID is the transaction ID for which events are to be received

func (*Service) SetEventConsumerBufferSize

func (p *Service) SetEventConsumerBufferSize(value uint)

func (*Service) Start

func (s *Service) Start() error

Start starts the event service

func (*Service) Stop

func (s *Service) Stop()

Stop stops the event service

func (*Service) StopAndTransfer

func (s *Service) StopAndTransfer() (fab.EventSnapshot, error)

StopAndTransfer stops the event service and transfers all event registrations into a snapshot.

func (*Service) Submit

func (s *Service) Submit(event interface{}) error

Submit submits an event for processing

func (*Service) Transfer

func (s *Service) Transfer() (fab.EventSnapshot, error)

Transfer transfers all event registrations into a snapshot.

func (*Service) Unregister

func (s *Service) Unregister(reg fab.Registration)

Unregister unregisters the given registration. - reg is the registration handle that was returned from one of the RegisterXXX functions

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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