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

package client

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

Index

Package Files

client.go opts.go

func WithBlockEvents Uses

func WithBlockEvents() options.Opt

WithBlockEvents indicates that block events are to be received. Note that the caller must have sufficient privileges for this option.

func WithConnectionEvent Uses

func WithConnectionEvent(value chan *dispatcher.ConnectionEvent) options.Opt

WithConnectionEvent sets the channel that is to receive connection events, i.e. when the client connects and/or disconnects from the channel event service.

func WithMaxConnectAttempts Uses

func WithMaxConnectAttempts(value uint) options.Opt

WithMaxConnectAttempts sets the maximum number of times that the client will attempt to connect to the server. If set to 0 then the client will try until it is stopped.

func WithMaxReconnectAttempts Uses

func WithMaxReconnectAttempts(value uint) options.Opt

WithMaxReconnectAttempts sets the maximum number of times that the client will attempt to reconnect to the server after a connection has been lost. If set to 0 then the client will try until it is stopped.

func WithReconnect Uses

func WithReconnect(value bool) options.Opt

WithReconnect indicates whether the client should automatically attempt to reconnect to the server after a connection has been lost

func WithReconnectInitialDelay Uses

func WithReconnectInitialDelay(value time.Duration) options.Opt

WithReconnectInitialDelay sets the initial delay before attempting to reconnect.

func WithResponseTimeout Uses

func WithResponseTimeout(value time.Duration) options.Opt

WithResponseTimeout sets the timeout when waiting for a response from the event server

func WithTimeBetweenConnectAttempts Uses

func WithTimeBetweenConnectAttempts(value time.Duration) options.Opt

WithTimeBetweenConnectAttempts sets the time between connection attempts.

type Client Uses

type Client struct {
    *eventservice.Service

    sync.RWMutex
    // contains filtered or unexported fields
}

Client connects to an event server and receives events, such as block, filtered block, chaincode, and transaction status events. Client also monitors the connection to the event server and attempts to reconnect if the connection is closed.

func New Uses

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

New returns a new event client

func (*Client) Close Uses

func (c *Client) Close()

Close closes the connection to the event server and releases all resources. Once this function is invoked the client may no longer be used.

func (*Client) CloseIfIdle Uses

func (c *Client) CloseIfIdle() bool

CloseIfIdle closes the connection to the event server only if there are no outstanding registrations. Returns true if the client was closed. In this case the client may no longer be used. A return value of false indicates that the client could not be closed since there was at least one registration.

func (*Client) Connect Uses

func (c *Client) Connect() error

Connect connects to the peer and registers for events on a particular channel.

func (*Client) ConnectionState Uses

func (c *Client) ConnectionState() ConnectionState

ConnectionState returns the connection state

func (*Client) PermitBlockEvents Uses

func (p *Client) PermitBlockEvents()

func (*Client) RegisterBlockEvent Uses

func (c *Client) 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 (*Client) SetAfterConnectHandler Uses

func (c *Client) SetAfterConnectHandler(h handler)

SetAfterConnectHandler registers a handler that is called after the client connects to the event server. This allows for custom code to be executed for a particular event client implementation.

func (*Client) SetBeforeReconnectHandler Uses

func (c *Client) SetBeforeReconnectHandler(h handler)

SetBeforeReconnectHandler registers a handler that will be called before retrying to reconnect to the event server. This allows for custom code to be executed for a particular event client implementation.

func (*Client) SetConnectEventCh Uses

func (p *Client) SetConnectEventCh(value chan *dispatcher.ConnectionEvent)

func (*Client) SetEventConsumerBufferSize Uses

func (p *Client) SetEventConsumerBufferSize(value uint)

func (*Client) SetMaxConnectAttempts Uses

func (p *Client) SetMaxConnectAttempts(value uint)

func (*Client) SetMaxReconnectAttempts Uses

func (p *Client) SetMaxReconnectAttempts(value uint)

func (*Client) SetReconnect Uses

func (p *Client) SetReconnect(value bool)

func (*Client) SetReconnectInitialDelay Uses

func (p *Client) SetReconnectInitialDelay(value time.Duration)

func (*Client) SetResponseTimeout Uses

func (p *Client) SetResponseTimeout(value time.Duration)

func (*Client) SetTimeBetweenConnectAttempts Uses

func (p *Client) SetTimeBetweenConnectAttempts(value time.Duration)

func (*Client) Stopped Uses

func (c *Client) Stopped() bool

Stopped returns true if the client has been stopped (disconnected) and is no longer usable.

func (*Client) TransferRegistrations Uses

func (c *Client) TransferRegistrations(close bool) (fab.EventSnapshot, error)

TransferRegistrations transfers all registrations into an EventSnapshot. The registrations are not closed and may susequently be transferred to a new event client. - close - if true then the client will also be closed

type ConnectionState Uses

type ConnectionState int32

ConnectionState is the state of the client connection

const (
    // Disconnected indicates that the client is disconnected from the server
    Disconnected ConnectionState = iota
    // Connecting indicates that the client is in the process of establishing a connection
    Connecting
    // Connected indicates that the client is connected to the server
    Connected
)

func (ConnectionState) String Uses

func (s ConnectionState) String() string

Directories

PathSynopsis
dispatcher
lbp
mocks
peerresolver
peerresolver/balanced
peerresolver/minblockheight
peerresolver/preferorg
peerresolver/preferpeer

Package client imports 10 packages (graph) and is imported by 2 packages. Updated 2019-08-26. Refresh now. Tools for package owners.