Documentation
¶
Index ¶
- Variables
- type Network
- func (n *Network) AppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, response []byte) error
- func (n *Network) Gossip(msg []byte) error
- func (n *Network) P2PValidators() *p2p.Validators
- func (n *Network) SendSyncedAppRequest(ctx context.Context, nodeID ids.NodeID, request []byte) ([]byte, error)
- func (n *Network) SendSyncedAppRequestAny(ctx context.Context, minVersion *version.Application, request []byte) ([]byte, ids.NodeID, error)
- func (n *Network) SetRequestHandler(handler interface{})
- func (n *Network) Shutdown()
- func (n *Network) Size() int
- func (n *Network) TrackBandwidth(nodeID ids.NodeID, bandwidth float64)
- type SyncedNetworkClient
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNoPeers is returned when there are no peers to send a request to ErrNoPeers = errors.New("no peers available") // ErrNoSender is returned when no sender is configured ErrNoSender = errors.New("no sender configured") // ErrNetworkClosed is returned when the network has been shut down ErrNetworkClosed = errors.New("network closed") // ErrRequestCancelled is returned when a request is cancelled ErrRequestCancelled = errors.New("request cancelled") // ErrRequestTimeout is returned when a request times out ErrRequestTimeout = errors.New("request timeout") )
Functions ¶
This section is empty.
Types ¶
type Network ¶
Network handles peer-to-peer networking for the EVM It embeds p2p.Network to provide the base functionality
func NewNetwork ¶
func NewNetwork( ctx context.Context, sender p2p.Sender, codec codec.Manager, maxOutboundActiveRequests int64, metrics metric.Registerer, ) (*Network, error)
NewNetwork creates a new Network instance
func (*Network) AppResponse ¶ added in v0.8.11
func (n *Network) AppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, response []byte) error
AppResponse handles an incoming response
func (*Network) P2PValidators ¶
func (n *Network) P2PValidators() *p2p.Validators
P2PValidators returns the p2p validators if available
func (*Network) SendSyncedAppRequest ¶ added in v0.8.11
func (n *Network) SendSyncedAppRequest(ctx context.Context, nodeID ids.NodeID, request []byte) ([]byte, error)
SendSyncedAppRequest sends a request to a specific peer
func (*Network) SendSyncedAppRequestAny ¶ added in v0.8.11
func (n *Network) SendSyncedAppRequestAny(ctx context.Context, minVersion *version.Application, request []byte) ([]byte, ids.NodeID, error)
SendSyncedAppRequestAny sends a request to any available peer
func (*Network) SetRequestHandler ¶
func (n *Network) SetRequestHandler(handler interface{})
SetRequestHandler sets the handler for incoming requests Accepts any type to avoid import cycles with plugin/evm/message
type SyncedNetworkClient ¶
type SyncedNetworkClient interface {
SendSyncedAppRequestAny(ctx context.Context, minVersion *version.Application, request []byte) ([]byte, ids.NodeID, error)
SendSyncedAppRequest(ctx context.Context, nodeID ids.NodeID, request []byte) ([]byte, error)
Gossip(msg []byte) error
TrackBandwidth(nodeID ids.NodeID, bandwidth float64)
}
SyncedNetworkClient is the interface required by the state sync client
Click to show internal directories.
Click to hide internal directories.