Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder interface { GetVersion() (Message, error) Version( networkID, nodeID uint32, myTime uint64, ip utils.IPDesc, myVersion string, myVersionTime uint64, sig []byte, ) (Message, error) VersionWithSubnets( networkID, nodeID uint32, myTime uint64, ip utils.IPDesc, myVersion string, myVersionTime uint64, sig []byte, trackedSubnets []ids.ID, ) (Message, error) GetPeerList() (Message, error) PeerList( peers []utils.IPCertDesc, compress bool, ) (Message, error) Ping() (Message, error) Pong() (Message, error) GetAcceptedFrontier( chainID ids.ID, requestID uint32, deadline uint64, ) (Message, error) AcceptedFrontier( chainID ids.ID, requestID uint32, containerIDs []ids.ID, ) (Message, error) GetAccepted( chainID ids.ID, requestID uint32, deadline uint64, containerIDs []ids.ID, ) (Message, error) Accepted( chainID ids.ID, requestID uint32, containerIDs []ids.ID, ) (Message, error) GetAncestors( chainID ids.ID, requestID uint32, deadline uint64, containerID ids.ID, ) (Message, error) MultiPut( chainID ids.ID, requestID uint32, containers [][]byte, compressed bool, ) (Message, error) Get( chainID ids.ID, requestID uint32, deadline uint64, containerID ids.ID, ) (Message, error) Put( chainID ids.ID, requestID uint32, containerID ids.ID, container []byte, compress bool, ) (Message, error) PushQuery( chainID ids.ID, requestID uint32, deadline uint64, containerID ids.ID, container []byte, compress bool, ) (Message, error) PullQuery( chainID ids.ID, requestID uint32, deadline uint64, containerID ids.ID, ) (Message, error) Chits( chainID ids.ID, requestID uint32, containerIDs []ids.ID, ) (Message, error) AppRequest( chainID ids.ID, requestID uint32, deadline uint64, msg []byte, compress bool, ) (Message, error) AppResponse( chainID ids.ID, requestID uint32, msg []byte, compress bool, ) (Message, error) AppGossip( chainID ids.ID, msg []byte, compress bool, ) (Message, error) }
func NewBuilder ¶
type Codec ¶
type Codec interface { Pack( op Op, fieldValues map[Field]interface{}, compress bool, ) (Message, error) Parse(bytes []byte) (Message, error) }
func NewCodec ¶
func NewCodec(namespace string, metrics prometheus.Registerer, maxMessageSize int64) (Codec, error)
func NewCodecWithAllocator ¶
func NewCodecWithAllocator(namespace string, metrics prometheus.Registerer, getBytes func() []byte, maxMessageSize int64) (Codec, error)
type Field ¶
type Field uint32
Field that may be packed into a message
const ( VersionStr Field = iota // Used in handshake NetworkID // Used in handshake NodeID // Used in handshake MyTime // Used in handshake IP // Used in handshake Peers // Used in handshake ChainID // Used for dispatching RequestID // Used for all messages Deadline // Used for request messages ContainerID // Used for querying ContainerBytes // Used for gossiping ContainerIDs // Used for querying MultiContainerBytes // Used in MultiPut SigBytes // Used in handshake / peer gossiping VersionTime // Used in handshake / peer gossiping SignedPeers // Used in peer gossiping TrackedSubnets // Used in handshake / peer gossiping AppRequestBytes // Used at application level AppResponseBytes // Used at application level AppGossipBytes // Used at application level )
Fields that may be packed. These values are not sent over the wire.
type Message ¶
type Message interface { Op() Op Get(Field) interface{} Bytes() []byte BytesSavedCompression() int }
Message represents a set of fields that can be serialized into a byte stream
type Op ¶
type Op byte
Op is an opcode
const ( // Handshake: GetVersion Op = iota GetPeerList Ping Pong // Bootstrapping: GetAcceptedFrontier AcceptedFrontier GetAccepted Accepted GetAncestors MultiPut // Consensus: Get Put PushQuery PullQuery Chits // Handshake / peer gossiping Version PeerList VersionWithSubnets // Application level: AppRequest AppResponse AppGossip )
Types of messages that may be sent between nodes Note: If you add a new Op below, you must also add it to ops (declared below)
func (Op) Compressable ¶
Click to show internal directories.
Click to hide internal directories.