Documentation ¶
Index ¶
- type Dispatcher
- type EventProducer
- type Service
- func (s *Service) Dispatcher() Dispatcher
- func (s *Service) RegisterBlockEvent(filter ...fab.BlockFilter) (fab.Registration, <-chan *fab.BlockEvent, error)
- func (s *Service) RegisterChaincodeEvent(ccID, eventFilter string) (fab.Registration, <-chan *fab.CCEvent, error)
- func (s *Service) RegisterFilteredBlockEvent() (fab.Registration, <-chan *fab.FilteredBlockEvent, error)
- func (s *Service) RegisterTxStatusEvent(txID string) (fab.Registration, <-chan *fab.TxStatusEvent, error)
- func (p *Service) SetEventConsumerBufferSize(value uint)
- func (s *Service) Start() error
- func (s *Service) Stop()
- func (s *Service) Submit(event interface{}) error
- func (s *Service) Unregister(reg fab.Registration)
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) 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