 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder interface {
	GetVersion() (OutboundMessage, error)
	Version(
		networkID,
		nodeID uint32,
		myTime uint64,
		ip utils.IPDesc,
		myVersion string,
		myVersionTime uint64,
		sig []byte,
		trackedSubnets []ids.ID,
	) (OutboundMessage, error)
	GetPeerList() (OutboundMessage, error)
	PeerList(
		peers []utils.IPCertDesc,
		compress bool,
	) (OutboundMessage, error)
	Ping() (OutboundMessage, error)
	Pong() (OutboundMessage, error)
	GetAcceptedFrontier(
		chainID ids.ID,
		requestID uint32,
		deadline uint64,
	) (OutboundMessage, error)
	AcceptedFrontier(
		chainID ids.ID,
		requestID uint32,
		containerIDs []ids.ID,
	) (OutboundMessage, error)
	GetAccepted(
		chainID ids.ID,
		requestID uint32,
		deadline uint64,
		containerIDs []ids.ID,
	) (OutboundMessage, error)
	Accepted(
		chainID ids.ID,
		requestID uint32,
		containerIDs []ids.ID,
	) (OutboundMessage, error)
	GetAncestors(
		chainID ids.ID,
		requestID uint32,
		deadline uint64,
		containerID ids.ID,
	) (OutboundMessage, error)
	MultiPut(
		chainID ids.ID,
		requestID uint32,
		containers [][]byte,
		compressed bool,
	) (OutboundMessage, error)
	Get(
		chainID ids.ID,
		requestID uint32,
		deadline uint64,
		containerID ids.ID,
	) (OutboundMessage, error)
	Put(
		chainID ids.ID,
		requestID uint32,
		containerID ids.ID,
		container []byte,
		compress bool,
	) (OutboundMessage, error)
	PushQuery(
		chainID ids.ID,
		requestID uint32,
		deadline uint64,
		containerID ids.ID,
		container []byte,
		compress bool,
	) (OutboundMessage, error)
	PullQuery(
		chainID ids.ID,
		requestID uint32,
		deadline uint64,
		containerID ids.ID,
	) (OutboundMessage, error)
	Chits(
		chainID ids.ID,
		requestID uint32,
		containerIDs []ids.ID,
	) (OutboundMessage, error)
	AppRequest(
		chainID ids.ID,
		requestID uint32,
		deadline uint64,
		msg []byte,
		compress bool,
	) (OutboundMessage, error)
	AppResponse(
		chainID ids.ID,
		requestID uint32,
		msg []byte,
		compress bool,
	) (OutboundMessage, error)
	AppGossip(
		chainID ids.ID,
		msg []byte,
		compress bool,
	) (OutboundMessage, error)
}
    func NewBuilder ¶
type Codec ¶
type Codec interface {
	Pack(
		op Op,
		fieldValues map[Field]interface{},
		compress bool,
	) (OutboundMessage, error)
	Parse(bytes []byte) (InboundMessage, 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 InboundMessage ¶ added in v1.6.1
InboundMessage represents a set of fields for an inbound message 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 PeerList Version // 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 ¶
type OutboundMessage ¶ added in v1.6.1
OutboundMessage represents a set of fields for an outbound message that can be serialized into a byte stream
 Click to show internal directories. 
   Click to hide internal directories.