Documentation ¶
Overview ¶
Package upstream - maintain REQ/REP connection to clients this allow for push of blocks, transactions... as well as polling for out of sync conditions
Index ¶
- type Upstream
- func (u *Upstream) ActiveInPastSeconds(sec time.Duration) bool
- func (u *Upstream) CachedRemoteDigestOfLocalHeight() blockdigest.Digest
- func (u *Upstream) CachedRemoteHeight() uint64
- func (u *Upstream) Client() zmqutil.ClientIntf
- func (u *Upstream) Connect(address *util.Connection, serverPublicKey []byte) error
- func (u *Upstream) ConnectedTo() *zmqutil.Connected
- func (u *Upstream) Destroy()
- func (u *Upstream) GetBlockData(blockNumber uint64) ([]byte, error)
- func (u *Upstream) IsConnected() bool
- func (u *Upstream) IsConnectedTo(serverPublicKey []byte) bool
- func (u *Upstream) LocalHeight() uint64
- func (u *Upstream) Name() string
- func (u *Upstream) RemoteAddr() (string, error)
- func (u *Upstream) RemoteDigestOfHeight(blockNumber uint64) (blockdigest.Digest, error)
- func (u *Upstream) RemoteHeight() (uint64, error)
- func (u *Upstream) ResetServer()
- func (u *Upstream) ServerPublicKey() []byte
- type UpstreamIntf
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Upstream ¶
type Upstream struct { sync.RWMutex UpstreamIntf // contains filtered or unexported fields }
Upstream - structure to hold an upstream connection
func (*Upstream) ActiveInPastSeconds ¶ added in v0.11.0
ActiveInPastSeconds - active upstream in past seconds
func (*Upstream) CachedRemoteDigestOfLocalHeight ¶ added in v0.11.0
func (u *Upstream) CachedRemoteDigestOfLocalHeight() blockdigest.Digest
CachedRemoteDigestOfLocalHeight - cached remote digest of local block height
func (*Upstream) CachedRemoteHeight ¶ added in v0.11.0
CachedRemoteHeight - cached remote client height
func (*Upstream) Client ¶ added in v0.11.0
func (u *Upstream) Client() zmqutil.ClientIntf
Client - zmq client
func (*Upstream) Connect ¶
func (u *Upstream) Connect(address *util.Connection, serverPublicKey []byte) error
Connect - connect (or reconnect) to a specific server
func (*Upstream) ConnectedTo ¶
ConnectedTo - if registered return the connection data
func (*Upstream) Destroy ¶
func (u *Upstream) Destroy()
Destroy - shutdown a connection and terminate its background processes
func (*Upstream) GetBlockData ¶
GetBlockData - fetch block data from a specific block number
func (*Upstream) IsConnected ¶ added in v0.11.0
IsConnected - check if registered and have a valid connection
func (*Upstream) IsConnectedTo ¶
IsConnectedTo - check the current destination
does not mean actually connected, as could be in a timeout and reconnect state
func (*Upstream) LocalHeight ¶ added in v0.11.0
LocalHeight - local block height
func (*Upstream) RemoteAddr ¶ added in v0.11.0
RemoteAddr - remote client address
func (*Upstream) RemoteDigestOfHeight ¶ added in v0.11.0
func (u *Upstream) RemoteDigestOfHeight(blockNumber uint64) (blockdigest.Digest, error)
RemoteDigestOfHeight - fetch block digest from a specific block number
func (*Upstream) RemoteHeight ¶ added in v0.11.0
must have lock held before calling
func (*Upstream) ResetServer ¶ added in v0.10.2
func (u *Upstream) ResetServer()
ResetServer - clear Server side info of Zmq client for reusing the upstream
func (*Upstream) ServerPublicKey ¶ added in v0.11.0
ServerPublicKey - return the internal ZeroMQ client data
type UpstreamIntf ¶ added in v0.11.0
type UpstreamIntf interface { ActiveInPastSeconds(time.Duration) bool CachedRemoteDigestOfLocalHeight() blockdigest.Digest CachedRemoteHeight() uint64 Client() zmqutil.ClientIntf Connect(*util.Connection, []byte) error ConnectedTo() *zmqutil.Connected Destroy() GetBlockData(uint64) ([]byte, error) IsConnectedTo([]byte) bool IsConnected() bool LocalHeight() uint64 Name() string RemoteAddr() (string, error) RemoteDigestOfHeight(uint64) (blockdigest.Digest, error) RemoteHeight() (uint64, error) ResetServer() ServerPublicKey() []byte }