This section is empty.


This section is empty.


func NewBlockEvent

func NewBlockEvent(block *cb.Block, sourceURL string) *fab.BlockEvent

    NewBlockEvent creates a new BlockEvent

    func NewChaincodeEvent

    func NewChaincodeEvent(chaincodeID, eventName, txID string, payload []byte, blockNum uint64, sourceURL string) *fab.CCEvent

      NewChaincodeEvent creates a new ChaincodeEvent

      func NewFilteredBlockEvent

      func NewFilteredBlockEvent(fblock *pb.FilteredBlock, sourceURL string) *fab.FilteredBlockEvent

        NewFilteredBlockEvent creates a new FilteredBlockEvent

        func NewTxStatusEvent

        func NewTxStatusEvent(txID string, txValidationCode pb.TxValidationCode, blockNum uint64, sourceURL string) *fab.TxStatusEvent

          NewTxStatusEvent creates a new TxStatusEvent

          func WithEventConsumerBufferSize

          func WithEventConsumerBufferSize(value uint) options.Opt

            WithEventConsumerBufferSize sets the size of the registered consumer's event channel.

            func WithEventConsumerTimeout

            func WithEventConsumerTimeout(value time.Duration) options.Opt

              WithEventConsumerTimeout is the timeout when sending events to a registered consumer. If < 0, if buffer full, unblocks immediately and does not send. If 0, if buffer full, will block and guarantee the event will be sent out. If > 0, if buffer full, blocks util timeout.

              func WithSnapshot

              func WithSnapshot(value fab.EventSnapshot) options.Opt

                WithSnapshot sets the given TxStatus registrations.


                type BlockReg

                type BlockReg struct {
                	Filter  fab.BlockFilter
                	Eventch chan<- *fab.BlockEvent

                  BlockReg contains the data for a block registration

                  type ChaincodeReg

                  type ChaincodeReg struct {
                  	ChaincodeID string
                  	EventFilter string
                  	EventRegExp *regexp.Regexp
                  	Eventch     chan<- *fab.CCEvent

                    ChaincodeReg contains the data for a chaincode registration

                    type Dispatcher

                    type Dispatcher struct {
                    	// contains filtered or unexported fields

                      Dispatcher is responsible for handling all events, including connection and registration events originating from the client, and events originating from the channel event service. All events are processed in a single Go routine in order to avoid any race conditions and to ensure that events are processed in the order in which they are received. This also avoids the need for synchronization. The lastBlockNum member MUST be first to ensure it stays 64-bit aligned on 32-bit machines.

                      func New

                      func New(opts ...options.Opt) *Dispatcher

                        New creates a new Dispatcher.

                        func (*Dispatcher) EventCh

                        func (ed *Dispatcher) EventCh() (chan<- interface{}, error)

                          EventCh returns the channel to which events may be posted

                          func (*Dispatcher) HandleBlock

                          func (ed *Dispatcher) HandleBlock(block *cb.Block, sourceURL string)

                            HandleBlock handles a block event

                            func (*Dispatcher) HandleFilteredBlock

                            func (ed *Dispatcher) HandleFilteredBlock(fblock *pb.FilteredBlock, sourceURL string)

                              HandleFilteredBlock handles a filtered block event

                              func (*Dispatcher) HandleStopAndTransferEvent

                              func (ed *Dispatcher) HandleStopAndTransferEvent(e Event)

                                HandleStopAndTransferEvent stops the dispatcher and transfers all event registrations into a EventSnapshot. The Dispatcher is no longer usable.

                                func (*Dispatcher) HandleStopEvent

                                func (ed *Dispatcher) HandleStopEvent(e Event)

                                  HandleStopEvent stops the dispatcher and unregisters all event registration. The Dispatcher is no longer usable.

                                  func (*Dispatcher) HandleTransferEvent

                                  func (ed *Dispatcher) HandleTransferEvent(e Event)

                                    HandleTransferEvent transfers all event registrations into a EventSnapshot.

                                    func (*Dispatcher) LastBlockNum

                                    func (ed *Dispatcher) LastBlockNum() uint64

                                      LastBlockNum returns the block number of the last block for which an event was received.

                                      func (*Dispatcher) RegisterHandler

                                      func (ed *Dispatcher) RegisterHandler(t interface{}, h Handler)

                                        RegisterHandler registers an event handler

                                        func (*Dispatcher) RegisterHandlers

                                        func (ed *Dispatcher) RegisterHandlers()

                                          RegisterHandlers registers all of the handlers by event type

                                          func (*Dispatcher) SetEventConsumerBufferSize

                                          func (p *Dispatcher) SetEventConsumerBufferSize(value uint)

                                          func (*Dispatcher) SetEventConsumerTimeout

                                          func (p *Dispatcher) SetEventConsumerTimeout(value time.Duration)

                                          func (*Dispatcher) SetSnapshot

                                          func (p *Dispatcher) SetSnapshot(value fab.EventSnapshot) error

                                          func (*Dispatcher) Start

                                          func (ed *Dispatcher) Start() error

                                            Start starts dispatching events as they arrive. All events are processed in a single Go routine in order to avoid any race conditions

                                            func (*Dispatcher) UpdateLastBlockInfoOnly

                                            func (ed *Dispatcher) UpdateLastBlockInfoOnly()

                                              UpdateLastBlockInfoOnly sets is next event should only be used for updating last block info.

                                              type Event

                                              type Event interface{}

                                                Event is an event that's sent to the dispatcher. This includes client registration requests or events that come from an event producer.

                                                type FilteredBlockReg

                                                type FilteredBlockReg struct {
                                                	Eventch chan<- *fab.FilteredBlockEvent

                                                  FilteredBlockReg contains the data for a filtered block registration

                                                  type Handler

                                                  type Handler func(Event)

                                                    Handler is the handler for a given event type.

                                                    type HandlerRegistry

                                                    type HandlerRegistry map[reflect.Type]Handler

                                                      HandlerRegistry contains the handlers for each type of event

                                                      type RegisterBlockEvent

                                                      type RegisterBlockEvent struct {
                                                      	Reg *BlockReg

                                                        RegisterBlockEvent registers for block events

                                                        func NewRegisterBlockEvent

                                                        func NewRegisterBlockEvent(filter fab.BlockFilter, eventch chan<- *fab.BlockEvent, respch chan<- fab.Registration, errCh chan<- error) *RegisterBlockEvent

                                                          NewRegisterBlockEvent creates a new RegisterBlockEvent

                                                          type RegisterChaincodeEvent

                                                          type RegisterChaincodeEvent struct {
                                                          	Reg *ChaincodeReg

                                                            RegisterChaincodeEvent registers for chaincode events

                                                            func NewRegisterChaincodeEvent

                                                            func NewRegisterChaincodeEvent(ccID, eventFilter string, eventch chan<- *fab.CCEvent, respch chan<- fab.Registration, errCh chan<- error) *RegisterChaincodeEvent

                                                              NewRegisterChaincodeEvent creates a new RegisterChaincodeEvent

                                                              type RegisterEvent

                                                              type RegisterEvent struct {
                                                              	RegCh chan<- fab.Registration
                                                              	ErrCh chan<- error

                                                                RegisterEvent is the base for all registration events.

                                                                func NewRegisterEvent

                                                                func NewRegisterEvent(respch chan<- fab.Registration, errCh chan<- error) RegisterEvent

                                                                  NewRegisterEvent creates a new RgisterEvent

                                                                  type RegisterFilteredBlockEvent

                                                                  type RegisterFilteredBlockEvent struct {
                                                                  	Reg *FilteredBlockReg

                                                                    RegisterFilteredBlockEvent registers for filtered block events

                                                                    func NewRegisterFilteredBlockEvent

                                                                    func NewRegisterFilteredBlockEvent(eventch chan<- *fab.FilteredBlockEvent, respch chan<- fab.Registration, errCh chan<- error) *RegisterFilteredBlockEvent

                                                                      NewRegisterFilteredBlockEvent creates a new RegisterFilterBlockEvent

                                                                      type RegisterTxStatusEvent

                                                                      type RegisterTxStatusEvent struct {
                                                                      	Reg *TxStatusReg

                                                                        RegisterTxStatusEvent registers for transaction status events

                                                                        func NewRegisterTxStatusEvent

                                                                        func NewRegisterTxStatusEvent(txID string, eventch chan<- *fab.TxStatusEvent, respch chan<- fab.Registration, errCh chan<- error) *RegisterTxStatusEvent

                                                                          NewRegisterTxStatusEvent creates a new RegisterTxStatusEvent

                                                                          type RegistrationInfo

                                                                          type RegistrationInfo struct {
                                                                          	TotalRegistrations            int
                                                                          	NumBlockRegistrations         int
                                                                          	NumFilteredBlockRegistrations int
                                                                          	NumCCRegistrations            int
                                                                          	NumTxStatusRegistrations      int

                                                                            RegistrationInfo contains counts of the current event registrations

                                                                            type RegistrationInfoEvent

                                                                            type RegistrationInfoEvent struct {
                                                                            	RegInfoCh chan<- *RegistrationInfo

                                                                              RegistrationInfoEvent requests registration information

                                                                              func NewRegistrationInfoEvent

                                                                              func NewRegistrationInfoEvent(regInfoCh chan<- *RegistrationInfo) *RegistrationInfoEvent

                                                                                NewRegistrationInfoEvent returns a new RegistrationInfoEvent

                                                                                type StopAndTransferEvent

                                                                                type StopAndTransferEvent struct {
                                                                                	SnapshotCh chan<- fab.EventSnapshot
                                                                                	ErrCh      chan<- error

                                                                                  StopAndTransferEvent tells the dispatcher to stop processing and transfer all registrations into a snapshot

                                                                                  func NewStopAndTransferEvent

                                                                                  func NewStopAndTransferEvent(snapshotch chan<- fab.EventSnapshot, errch chan<- error) *StopAndTransferEvent

                                                                                    NewStopAndTransferEvent creates a new StopAndTransferEvent

                                                                                    type StopEvent

                                                                                    type StopEvent struct {
                                                                                    	ErrCh chan<- error

                                                                                      StopEvent tells the dispatcher to stop processing

                                                                                      func NewStopEvent

                                                                                      func NewStopEvent(errch chan<- error) *StopEvent

                                                                                        NewStopEvent creates a new StopEvent

                                                                                        type TransferEvent

                                                                                        type TransferEvent struct {
                                                                                        	SnapshotCh chan<- fab.EventSnapshot
                                                                                        	ErrCh      chan<- error

                                                                                          TransferEvent tells the dispatcher to transfer all registrations into a snapshot

                                                                                          func NewTransferEvent

                                                                                          func NewTransferEvent(snapshotch chan<- fab.EventSnapshot, errch chan<- error) *TransferEvent

                                                                                            NewTransferEvent creates a new TransferEvent

                                                                                            type TxStatusReg

                                                                                            type TxStatusReg struct {
                                                                                            	TxID    string
                                                                                            	Eventch chan<- *fab.TxStatusEvent

                                                                                              TxStatusReg contains the data for a transaction status registration

                                                                                              type UnregisterEvent

                                                                                              type UnregisterEvent struct {
                                                                                              	Reg fab.Registration

                                                                                                UnregisterEvent unregisters a registration

                                                                                                func NewUnregisterEvent

                                                                                                func NewUnregisterEvent(reg fab.Registration) *UnregisterEvent

                                                                                                  NewUnregisterEvent creates a new UnregisterEvent