Documentation ¶
Index ¶
- Constants
- func BuildCodec() (codec.Manager, error)
- func BuildMessage(codec codec.Manager, msg Message) ([]byte, error)
- func RequestToBytes(codec codec.Manager, request Request) ([]byte, error)
- type AtomicTx
- type EthTxs
- type GossipHandler
- type Message
- type NoopMempoolGossipHandler
- type Request
- type RequestHandler
- type ResponseHandler
Constants ¶
View Source
const ( // EthMsgSoftCapSize is the ideal size of encoded transaction bytes we send in // any [EthTxs] or [AtomicTx] message. We do not limit inbound messages to // this size, however. Max inbound message size is enforced by the codec // (512KB). EthMsgSoftCapSize = common.StorageSize(64 * units.KiB) )
View Source
const Version = uint16(0)
Variables ¶
This section is empty.
Functions ¶
func BuildCodec ¶ added in v0.8.5
func BuildMessage ¶ added in v0.8.5
Types ¶
type AtomicTx ¶
type AtomicTx struct { Tx []byte `serialize:"true"` // contains filtered or unexported fields }
type EthTxs ¶
type EthTxs struct { Txs []byte `serialize:"true"` // contains filtered or unexported fields }
type GossipHandler ¶ added in v0.8.5
type GossipHandler interface { HandleAtomicTx(nodeID ids.ShortID, msg *AtomicTx) error HandleEthTxs(nodeID ids.ShortID, msg *EthTxs) error }
GossipHandler handles incoming gossip messages
type Message ¶
type Message interface { // Handle this message with the correct message handler Handle(handler GossipHandler, nodeID ids.ShortID) error // Bytes returns the binary representation of this message // // Bytes should only be called after being initialized Bytes() []byte // Type returns user-friendly name for this object that can be used for logging Type() string // contains filtered or unexported methods }
type NoopMempoolGossipHandler ¶ added in v0.8.5
type NoopMempoolGossipHandler struct{}
func (NoopMempoolGossipHandler) HandleAtomicTx ¶ added in v0.8.5
func (NoopMempoolGossipHandler) HandleAtomicTx(nodeID ids.ShortID, _ *AtomicTx) error
func (NoopMempoolGossipHandler) HandleEthTxs ¶ added in v0.8.5
func (NoopMempoolGossipHandler) HandleEthTxs(nodeID ids.ShortID, _ *EthTxs) error
type Request ¶ added in v0.8.5
type Request interface { // Handle allows `Request` to call respective methods on handler to handle // this particular request type Handle(ctx context.Context, nodeID ids.ShortID, requestID uint32, handler RequestHandler) ([]byte, error) // Type returns user-friendly name for this object that can be used for logging Type() string }
Request represents a Network request type
type RequestHandler ¶ added in v0.8.5
type RequestHandler interface{}
RequestHandler interface handles incoming requests from peers Must have methods in format of handleType(context.Context, ids.ShortID, uint32, request Type) error so that the Request object of relevant Type can invoke its respective handle method on this struct. Also see GossipHandler for implementation style.
type ResponseHandler ¶ added in v0.8.5
type ResponseHandler interface { // OnResponse is invoked when the peer responded to a request OnResponse(nodeID ids.ShortID, requestID uint32, response []byte) error // OnFailure is invoked when there was a failure in processing a request // The FailureReason outlines the underlying cause. OnFailure(nodeID ids.ShortID, requestID uint32) error }
ResponseHandler handles response for a sent request Only one of OnResponse or OnFailure is called for a given requestID, not both
Click to show internal directories.
Click to hide internal directories.