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 GossipHandler
- type Message
- type NoopMempoolGossipHandler
- type Request
- type RequestHandler
- type ResponseHandler
- type Txs
Constants ¶
View Source
const ( // TxMsgSoftCapSize is the ideal size of encoded transaction bytes we send in // any [Txs] message. We do not limit inbound messages to // this size, however. Max inbound message size is enforced by the codec // (512KB). TxMsgSoftCapSize = common.StorageSize(64 * units.KiB) )
View Source
const (
Version = uint16(0)
)
Variables ¶
This section is empty.
Functions ¶
func BuildCodec ¶ added in v0.1.1
func BuildMessage ¶ added in v0.1.1
Types ¶
type GossipHandler ¶ added in v0.1.1
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 // contains filtered or unexported methods }
type NoopMempoolGossipHandler ¶ added in v0.1.1
type NoopMempoolGossipHandler struct{}
type Request ¶ added in v0.1.1
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.1.1
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.1.1
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.