fabric-sdk-go: github.com/hyperledger/fabric-sdk-go/pkg/fab/events/client/dispatcher Index | Files

package dispatcher

import "github.com/hyperledger/fabric-sdk-go/pkg/fab/events/client/dispatcher"


Package Files

dispatcher.go events.go opts.go registrations.go

func WithLoadBalancePolicy Uses

func WithLoadBalancePolicy(value lbp.LoadBalancePolicy) options.Opt

WithLoadBalancePolicy sets the load-balance policy to use when choosing an event endpoint from a set of endpoints

func WithPeerMonitorPeriod Uses

func WithPeerMonitorPeriod(value time.Duration) options.Opt

WithPeerMonitorPeriod is the period with which the connected peer is monitored to see whether or not it should be disconnected.

func WithPeerResolver Uses

func WithPeerResolver(value peerresolver.Provider) options.Opt

WithPeerResolver sets the peer resolver that chooses the peer from a discovered list of peers.

type ConnectEvent Uses

type ConnectEvent struct {
    ErrCh        chan<- error
    FromBlockNum uint64

ConnectEvent is a request to connect to the server

func NewConnectEvent Uses

func NewConnectEvent(errch chan<- error) *ConnectEvent

NewConnectEvent creates a new ConnectEvent

type ConnectedEvent Uses

type ConnectedEvent struct {

ConnectedEvent indicates that the client has connected to the server

func NewConnectedEvent Uses

func NewConnectedEvent() *ConnectedEvent

NewConnectedEvent creates a new ConnectedEvent

type ConnectionEvent Uses

type ConnectionEvent struct {
    Connected bool
    Err       DisconnectedError

ConnectionEvent is sent when the client disconnects from or reconnects to the event server. Connected == true means that the client has connected, whereas Connected == false means that the client has disconnected. In the disconnected case, Err contains the disconnect error.

func NewConnectionEvent Uses

func NewConnectionEvent(connected bool, err DisconnectedError) *ConnectionEvent

NewConnectionEvent returns a new ConnectionEvent

type ConnectionReg Uses

type ConnectionReg struct {
    Eventch chan<- *ConnectionEvent

ConnectionReg is a connection registration

type DisconnectEvent Uses

type DisconnectEvent struct {
    Errch chan<- error

DisconnectEvent is a request to disconnect to the server

func NewDisconnectEvent Uses

func NewDisconnectEvent(errch chan<- error) *DisconnectEvent

NewDisconnectEvent creates a new DisconnectEvent

type DisconnectedError Uses

type DisconnectedError interface {

    // IsFatal returns true if the error is fatal, meaning that a reconnect attempt would not succeed
    IsFatal() bool

DisconnectedError is the error that is associated with the disconnect.

type DisconnectedEvent Uses

type DisconnectedEvent struct {
    Err DisconnectedError

DisconnectedEvent indicates that the client has disconnected from the server

func NewDisconnectedEvent Uses

func NewDisconnectedEvent(cause error) *DisconnectedEvent

NewDisconnectedEvent creates a new DisconnectedEvent

func NewFatalDisconnectedEvent Uses

func NewFatalDisconnectedEvent(cause error) *DisconnectedEvent

NewFatalDisconnectedEvent creates a new DisconnectedEvent which indicates that a reconnect is not possible

type Dispatcher Uses

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 event server. 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 that they are received. This avoids the need for synchronization.

func New Uses

func New(context context.Client, chConfig fab.ChannelCfg, discoveryService fab.DiscoveryService, connectionProvider api.ConnectionProvider, opts ...options.Opt) *Dispatcher

New creates a new dispatcher

func (*Dispatcher) ChannelConfig Uses

func (ed *Dispatcher) ChannelConfig() fab.ChannelCfg

ChannelConfig returns the channel configuration

func (*Dispatcher) ConnectedPeer Uses

func (ed *Dispatcher) ConnectedPeer() fab.Peer

ConnectedPeer returns the connected peer

func (*Dispatcher) Connection Uses

func (ed *Dispatcher) Connection() api.Connection

Connection returns the connection to the event server

func (*Dispatcher) HandleConnectEvent Uses

func (ed *Dispatcher) HandleConnectEvent(e esdispatcher.Event)

HandleConnectEvent initiates a connection to the event server

func (*Dispatcher) HandleConnectedEvent Uses

func (ed *Dispatcher) HandleConnectedEvent(e esdispatcher.Event)

HandleConnectedEvent sends a 'connected' event to any registered listener

func (*Dispatcher) HandleDisconnectEvent Uses

func (ed *Dispatcher) HandleDisconnectEvent(e esdispatcher.Event)

HandleDisconnectEvent disconnects from the event server

func (*Dispatcher) HandleDisconnectedEvent Uses

func (ed *Dispatcher) HandleDisconnectedEvent(e esdispatcher.Event)

HandleDisconnectedEvent sends a 'disconnected' event to any registered listener

func (*Dispatcher) HandleRegisterConnectionEvent Uses

func (ed *Dispatcher) HandleRegisterConnectionEvent(e esdispatcher.Event)

HandleRegisterConnectionEvent registers a connection listener

func (*Dispatcher) HandleStopEvent Uses

func (ed *Dispatcher) HandleStopEvent(e esdispatcher.Event)

HandleStopEvent handles a Stop event by clearing all registrations and stopping the listener

func (*Dispatcher) SetPeerMonitorPeriod Uses

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

func (*Dispatcher) SetPeerResolver Uses

func (p *Dispatcher) SetPeerResolver(value peerresolver.Provider)

func (*Dispatcher) Start Uses

func (ed *Dispatcher) Start() error

Start starts the dispatcher

type RegisterConnectionEvent Uses

type RegisterConnectionEvent struct {
    Reg *ConnectionReg

RegisterConnectionEvent is a request to register for connection events

func NewRegisterConnectionEvent Uses

func NewRegisterConnectionEvent(eventch chan<- *ConnectionEvent, regch chan<- fab.Registration, errch chan<- error) *RegisterConnectionEvent

NewRegisterConnectionEvent creates a new RegisterConnectionEvent

Package dispatcher imports 14 packages (graph) and is imported by 3 packages. Updated 2019-07-30. Refresh now. Tools for package owners.