flowcontext

package
v3.1.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2023 License: MIT Imports: 19 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrPingTimeout signifies that a ping operation timed out.
	ErrPingTimeout = protocolerrors.New(false, "timeout expired on ping")
)

Functions

This section is empty.

Types

type FlowContext

type FlowContext struct {
	// contains filtered or unexported fields
}

func New

func New(cfg *infraconfig.Config, addressManager *addressmanager.AddressManager,
	netAdapter *netadapter.NetAdapter, connectionManager *commanager.ConnectionManager) *FlowContext

func (*FlowContext) AddToPeers

func (f *FlowContext) AddToPeers(peer *peerpkg.Peer) error

AddToPeers marks this peer as ready and adds it to the ready peers list.

func (*FlowContext) AddressManager

func (f *FlowContext) AddressManager() *addressmanager.AddressManager

AddressManager returns the address manager associated to the flow context.

func (*FlowContext) Broadcast

func (f *FlowContext) Broadcast(message appmessage.Message) error

Broadcast broadcast the given message to all the ready peers.

func (*FlowContext) Config

func (f *FlowContext) Config() *infraconfig.Config

func (*FlowContext) ConnectionManager

func (f *FlowContext) ConnectionManager() *commanager.ConnectionManager

ConnectionManager returns the connection manager that is associated to the flow context.

func (*FlowContext) Domain

func (f *FlowContext) Domain() domain.Domain

func (*FlowContext) HandleError

func (*FlowContext) HandleError(err error, flowName string, isStopping *uint32, errChan chan<- error)

HandleError handles an error from a flow, It sends the error to errChan if isStopping == 0 and increments isStopping

If this is ErrRouteClosed - forward it to errChan If this is ProtocolError - logs the error, and forward it to errChan Otherwise - panics

func (*FlowContext) HasPeers

func (f *FlowContext) HasPeers() bool

HasPeers returns whether there are currently active peers

func (*FlowContext) IsRecoverableError

func (*FlowContext) IsRecoverableError(err error) bool

IsRecoverableError returns whether the error is recoverable

func (*FlowContext) NetAdapter

func (f *FlowContext) NetAdapter() *netadapter.NetAdapter

NetAdapter returns the net adapter that is associated to the flow context.

func (*FlowContext) Peers

func (f *FlowContext) Peers() []*peerpkg.Peer

Peers returns the currently active peers

func (*FlowContext) RemoveFromPeers

func (f *FlowContext) RemoveFromPeers(peer *peerpkg.Peer)

RemoveFromPeers remove this peer from the peers list.

func (*FlowContext) SetOnNewBlockTemplateHandler

func (f *FlowContext) SetOnNewBlockTemplateHandler(onNewBlockTemplateHandler OnNewBlockTemplateHandler)

SetOnNewBlockTemplateHandler sets the onNewBlockTemplateHandler handler

type OnNewBlockTemplateHandler

type OnNewBlockTemplateHandler func() error

OnNewBlockTemplateHandler is a handler function that's triggered when a new block template is available

type SharedRequestedBlocks

type SharedRequestedBlocks struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewSharedRequestedBlocks

func NewSharedRequestedBlocks() *SharedRequestedBlocks

NewSharedRequestedBlocks returns a new instance of SharedRequestedBlocks.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL