Documentation ¶
Index ¶
- type Context
- type EventHub
- func (eventHub *EventHub) Connect() error
- func (eventHub *EventHub) Disconnect() error
- func (eventHub *EventHub) Disconnected(err error)
- func (eventHub *EventHub) GetInterestedEvents() ([]*pb.Interest, error)
- func (eventHub *EventHub) IsConnected() bool
- func (eventHub *EventHub) Recv(msg *pb.Event) (bool, error)
- func (eventHub *EventHub) RegisterBlockEvent(callback func(*common.Block))
- func (eventHub *EventHub) RegisterChaincodeEvent(ccid string, eventname string, callback func(*fab.ChaincodeEvent)) *fab.ChainCodeCBE
- func (eventHub *EventHub) RegisterTxEvent(txnID fab.TransactionID, callback func(string, pb.TxValidationCode, error))
- func (eventHub *EventHub) SetInterests(block bool)
- func (eventHub *EventHub) SetPeerAddr(peerURL string, peerTLSCertificate *sm2.Certificate, ...)
- func (eventHub *EventHub) UnregisterBlockEvent(callback func(*common.Block))
- func (eventHub *EventHub) UnregisterChaincodeEvent(cbe *fab.ChainCodeCBE)
- func (eventHub *EventHub) UnregisterTxEvent(txnID fab.TransactionID)
- type MockCCBlockEventBuilder
- type MockCCEventBuilder
- type MockTxEventBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct { fab.ProviderContext fab.IdentityContext }
Context holds the providers and services needed to create an EventHub.
type EventHub ¶
type EventHub struct {
// contains filtered or unexported fields
}
EventHub allows a client to listen to event at a peer.
func FromConfig ¶
func FromConfig(ctx Context, peerCfg *apiconfig.PeerConfig) (*EventHub, error)
FromConfig creates new event hub from context and peer config.
func (*EventHub) Disconnect ¶
Disconnect disconnects from peer event source
func (*EventHub) Disconnected ¶
Disconnected implements consumer.EventAdapter interface for receiving events
func (*EventHub) GetInterestedEvents ¶
GetInterestedEvents implements consumer.EventAdapter interface for registering interested events
func (*EventHub) IsConnected ¶
IsConnected gets connected state of eventhub Returns true if connected to event source, false otherwise
func (*EventHub) RegisterBlockEvent ¶
RegisterBlockEvent - register callback function for block events
func (*EventHub) RegisterChaincodeEvent ¶
func (eventHub *EventHub) RegisterChaincodeEvent(ccid string, eventname string, callback func(*fab.ChaincodeEvent)) *fab.ChainCodeCBE
RegisterChaincodeEvent registers a callback function to receive chaincode events. ccid: chaincode id eventname: The regex string used to filter events callback: Callback function for filter matches that takes a single parameter which is a json object representation
of type "message ChaincodeEvent"
Returns ChainCodeCBE object that should be treated as an opaque handle used to unregister (see unregisterChaincodeEvent)
func (*EventHub) RegisterTxEvent ¶
func (eventHub *EventHub) RegisterTxEvent(txnID fab.TransactionID, callback func(string, pb.TxValidationCode, error))
RegisterTxEvent registers a callback function to receive transactional events. txid: transaction id callback: Function that takes a single parameter which is a json object representation of type "message Transaction"
func (*EventHub) SetInterests ¶
SetInterests clears all interests and sets the interests for BLOCK type of events.
func (*EventHub) SetPeerAddr ¶
func (eventHub *EventHub) SetPeerAddr(peerURL string, peerTLSCertificate *sm2.Certificate, peerTLSServerHostOverride string)
SetPeerAddr set peer url for event source peeraddr peer url peerTLSCertificate peer tls certificate peerTLSServerHostOverride tls serverhostoverride
func (*EventHub) UnregisterBlockEvent ¶
UnregisterBlockEvent unregister callback for block event
func (*EventHub) UnregisterChaincodeEvent ¶
func (eventHub *EventHub) UnregisterChaincodeEvent(cbe *fab.ChainCodeCBE)
UnregisterChaincodeEvent unregisters chaincode event registration ChainCodeCBE: handle returned from call to registerChaincodeEvent.
func (*EventHub) UnregisterTxEvent ¶
func (eventHub *EventHub) UnregisterTxEvent(txnID fab.TransactionID)
UnregisterTxEvent unregister transactional event registration. txid: transaction id
type MockCCBlockEventBuilder ¶
type MockCCBlockEventBuilder struct { CCID string EventName string ChannelID string TxID string Payload []byte }
MockCCBlockEventBuilder builds a mock CC event block
func (*MockCCBlockEventBuilder) Build ¶
func (b *MockCCBlockEventBuilder) Build() *pb.Event_Block
Build builds a mock chaincode event block
func (*MockCCBlockEventBuilder) BuildWithTxValidationFlag ¶
func (b *MockCCBlockEventBuilder) BuildWithTxValidationFlag(isValid bool) *pb.Event_Block
BuildWithTxValidationFlag builds a mock chaincode event block with valid/invalid TxValidation Flag (set in the argument)
type MockCCEventBuilder ¶
MockCCEventBuilder builds a mock chaincode event
func (*MockCCEventBuilder) Build ¶
func (b *MockCCEventBuilder) Build() *pb.Event_ChaincodeEvent
Build builds a mock chaincode event
type MockTxEventBuilder ¶
MockTxEventBuilder builds a mock TX event block
func (*MockTxEventBuilder) Build ¶
func (b *MockTxEventBuilder) Build() *pb.Event_Block
Build builds a mock TX event block
func (*MockTxEventBuilder) BuildWithTxValidationCode ¶
func (b *MockTxEventBuilder) BuildWithTxValidationCode(c pb.TxValidationCode) *pb.Event_Block
BuildWithTxValidationCode Build builds a mock TX event block