Documentation ¶
Index ¶
- Variables
- func GetChainID(m any) (ids.ID, error)
- func GetDeadline(m any) (time.Duration, bool)
- func GetEngineType(m any) (p2p.EngineType, bool)
- func GetRequestID(m any) (uint32, bool)
- func Unwrap(m *p2p.Message) (fmt.Stringer, error)
- type Connected
- type Creator
- type Disconnected
- type GetAcceptedFailed
- type GetAcceptedFrontierFailed
- type GetAcceptedStateSummaryFailed
- type GetAncestorsFailed
- type GetFailed
- type GetStateSummaryFrontierFailed
- type GossipRequest
- type InboundMessage
- func InboundAccepted(chainID ids.ID, requestID uint32, containerIDs []ids.ID, nodeID ids.NodeID) InboundMessage
- func InboundAcceptedFrontier(chainID ids.ID, requestID uint32, containerID ids.ID, nodeID ids.NodeID) InboundMessage
- func InboundAcceptedStateSummary(chainID ids.ID, requestID uint32, summaryIDs []ids.ID, nodeID ids.NodeID) InboundMessage
- func InboundAppError(nodeID ids.NodeID, chainID ids.ID, requestID uint32, errorCode int32, ...) InboundMessage
- func InboundAppRequest(chainID ids.ID, requestID uint32, deadline time.Duration, msg []byte, ...) InboundMessage
- func InboundAppResponse(chainID ids.ID, requestID uint32, msg []byte, nodeID ids.NodeID) InboundMessage
- func InboundChits(chainID ids.ID, requestID uint32, preferredID ids.ID, ...) InboundMessage
- func InboundGetAccepted(chainID ids.ID, requestID uint32, deadline time.Duration, ...) InboundMessage
- func InboundGetAcceptedFrontier(chainID ids.ID, requestID uint32, deadline time.Duration, nodeID ids.NodeID) InboundMessage
- func InboundGetAcceptedStateSummary(chainID ids.ID, requestID uint32, heights []uint64, deadline time.Duration, ...) InboundMessage
- func InboundGetStateSummaryFrontier(chainID ids.ID, requestID uint32, deadline time.Duration, nodeID ids.NodeID) InboundMessage
- func InboundPullQuery(chainID ids.ID, requestID uint32, deadline time.Duration, containerID ids.ID, ...) InboundMessage
- func InboundPushQuery(chainID ids.ID, requestID uint32, deadline time.Duration, container []byte, ...) InboundMessage
- func InboundStateSummaryFrontier(chainID ids.ID, requestID uint32, summary []byte, nodeID ids.NodeID) InboundMessage
- func InternalConnected(nodeID ids.NodeID, nodeVersion *version.Application) InboundMessage
- func InternalDisconnected(nodeID ids.NodeID) InboundMessage
- func InternalGetAcceptedFailed(nodeID ids.NodeID, chainID ids.ID, requestID uint32) InboundMessage
- func InternalGetAcceptedFrontierFailed(nodeID ids.NodeID, chainID ids.ID, requestID uint32) InboundMessage
- func InternalGetAcceptedStateSummaryFailed(nodeID ids.NodeID, chainID ids.ID, requestID uint32) InboundMessage
- func InternalGetAncestorsFailed(nodeID ids.NodeID, chainID ids.ID, requestID uint32, engineType p2p.EngineType) InboundMessage
- func InternalGetFailed(nodeID ids.NodeID, chainID ids.ID, requestID uint32) InboundMessage
- func InternalGetStateSummaryFrontierFailed(nodeID ids.NodeID, chainID ids.ID, requestID uint32) InboundMessage
- func InternalGossipRequest(nodeID ids.NodeID) InboundMessage
- func InternalQueryFailed(nodeID ids.NodeID, chainID ids.ID, requestID uint32) InboundMessage
- func InternalTimeout(nodeID ids.NodeID) InboundMessage
- func InternalVMMessage(nodeID ids.NodeID, notification uint32) InboundMessage
- type InboundMsgBuilder
- type Op
- type OutboundMessage
- type OutboundMsgBuilder
- type QueryFailed
- type Timeout
- type VMMessage
Constants ¶
This section is empty.
Variables ¶
View Source
var ( HandshakeOps = []Op{ PingOp, PongOp, HandshakeOp, GetPeerListOp, PeerListOp, } // List of all consensus request message types ConsensusRequestOps = []Op{ GetStateSummaryFrontierOp, GetAcceptedStateSummaryOp, GetAcceptedFrontierOp, GetAcceptedOp, GetAncestorsOp, GetOp, PushQueryOp, PullQueryOp, AppRequestOp, } ConsensusResponseOps = []Op{ StateSummaryFrontierOp, AcceptedStateSummaryOp, AcceptedFrontierOp, AcceptedOp, AncestorsOp, PutOp, ChitsOp, AppResponseOp, AppErrorOp, } // AppGossip is the only message that is sent unrequested without the // expectation of a response ConsensusExternalOps = append( ConsensusRequestOps, append( ConsensusResponseOps, AppGossipOp, )..., ) ConsensusInternalOps = []Op{ GetStateSummaryFrontierFailedOp, GetAcceptedStateSummaryFailedOp, GetAcceptedFrontierFailedOp, GetAcceptedFailedOp, GetAncestorsFailedOp, GetFailedOp, QueryFailedOp, ConnectedOp, DisconnectedOp, NotifyOp, GossipRequestOp, TimeoutOp, } ConsensusOps = append(ConsensusExternalOps, ConsensusInternalOps...) ExternalOps = append(ConsensusExternalOps, HandshakeOps...) SynchronousOps = []Op{ GetStateSummaryFrontierOp, GetStateSummaryFrontierFailedOp, StateSummaryFrontierOp, GetAcceptedStateSummaryOp, GetAcceptedStateSummaryFailedOp, AcceptedStateSummaryOp, GetAcceptedFrontierOp, GetAcceptedFrontierFailedOp, AcceptedFrontierOp, GetAcceptedOp, GetAcceptedFailedOp, AcceptedOp, GetAncestorsOp, GetAncestorsFailedOp, AncestorsOp, GetOp, GetFailedOp, PutOp, PushQueryOp, PullQueryOp, QueryFailedOp, ChitsOp, ConnectedOp, DisconnectedOp, } AsynchronousOps = []Op{ AppRequestOp, AppErrorOp, AppGossipOp, AppResponseOp, } FailedToResponseOps = map[Op]Op{ GetStateSummaryFrontierFailedOp: StateSummaryFrontierOp, GetAcceptedStateSummaryFailedOp: AcceptedStateSummaryOp, GetAcceptedFrontierFailedOp: AcceptedFrontierOp, GetAcceptedFailedOp: AcceptedOp, GetAncestorsFailedOp: AncestorsOp, GetFailedOp: PutOp, QueryFailedOp: ChitsOp, AppErrorOp: AppResponseOp, } UnrequestedOps = set.Of( GetAcceptedFrontierOp, GetAcceptedOp, GetAncestorsOp, GetOp, PushQueryOp, PullQueryOp, AppRequestOp, AppGossipOp, GetStateSummaryFrontierOp, GetAcceptedStateSummaryOp, ) )
Functions ¶
func GetEngineType ¶ added in v1.9.6
func GetEngineType(m any) (p2p.EngineType, bool)
func GetRequestID ¶ added in v1.9.2
Types ¶
type Connected ¶
type Connected struct {
NodeVersion *version.Application `json:"node_version,omitempty"`
}
type Creator ¶
type Creator interface { OutboundMsgBuilder InboundMsgBuilder }
func NewCreator ¶
func NewCreator( log logging.Logger, metrics prometheus.Registerer, compressionType compression.Type, maxMessageTimeout time.Duration, ) (Creator, error)
type Disconnected ¶
type Disconnected struct{}
func (Disconnected) String ¶ added in v1.10.3
func (Disconnected) String() string
type GetAcceptedFailed ¶
type GetAcceptedFailed struct { ChainID ids.ID `json:"chain_id,omitempty"` RequestID uint32 `json:"request_id,omitempty"` }
func (*GetAcceptedFailed) GetChainId ¶ added in v1.9.2
func (m *GetAcceptedFailed) GetChainId() []byte
func (*GetAcceptedFailed) GetRequestId ¶ added in v1.9.2
func (m *GetAcceptedFailed) GetRequestId() uint32
func (*GetAcceptedFailed) String ¶ added in v1.10.3
func (m *GetAcceptedFailed) String() string
type GetAcceptedFrontierFailed ¶
type GetAcceptedFrontierFailed struct { ChainID ids.ID `json:"chain_id,omitempty"` RequestID uint32 `json:"request_id,omitempty"` }
func (*GetAcceptedFrontierFailed) GetChainId ¶ added in v1.9.2
func (m *GetAcceptedFrontierFailed) GetChainId() []byte
func (*GetAcceptedFrontierFailed) GetRequestId ¶ added in v1.9.2
func (m *GetAcceptedFrontierFailed) GetRequestId() uint32
func (*GetAcceptedFrontierFailed) String ¶ added in v1.10.3
func (m *GetAcceptedFrontierFailed) String() string
type GetAcceptedStateSummaryFailed ¶ added in v1.7.11
type GetAcceptedStateSummaryFailed struct { ChainID ids.ID `json:"chain_id,omitempty"` RequestID uint32 `json:"request_id,omitempty"` }
func (*GetAcceptedStateSummaryFailed) GetChainId ¶ added in v1.9.2
func (m *GetAcceptedStateSummaryFailed) GetChainId() []byte
func (*GetAcceptedStateSummaryFailed) GetRequestId ¶ added in v1.9.2
func (m *GetAcceptedStateSummaryFailed) GetRequestId() uint32
func (*GetAcceptedStateSummaryFailed) String ¶ added in v1.10.3
func (m *GetAcceptedStateSummaryFailed) String() string
type GetAncestorsFailed ¶
type GetAncestorsFailed struct { ChainID ids.ID `json:"chain_id,omitempty"` RequestID uint32 `json:"request_id,omitempty"` EngineType p2p.EngineType `json:"engine_type,omitempty"` }
func (*GetAncestorsFailed) GetChainId ¶ added in v1.9.2
func (m *GetAncestorsFailed) GetChainId() []byte
func (*GetAncestorsFailed) GetEngineType ¶ added in v1.9.6
func (m *GetAncestorsFailed) GetEngineType() p2p.EngineType
func (*GetAncestorsFailed) GetRequestId ¶ added in v1.9.2
func (m *GetAncestorsFailed) GetRequestId() uint32
func (*GetAncestorsFailed) String ¶ added in v1.10.3
func (m *GetAncestorsFailed) String() string
type GetFailed ¶
type GetFailed struct { ChainID ids.ID `json:"chain_id,omitempty"` RequestID uint32 `json:"request_id,omitempty"` }
func (*GetFailed) GetChainId ¶ added in v1.9.2
func (*GetFailed) GetRequestId ¶ added in v1.9.2
type GetStateSummaryFrontierFailed ¶ added in v1.7.11
type GetStateSummaryFrontierFailed struct { ChainID ids.ID `json:"chain_id,omitempty"` RequestID uint32 `json:"request_id,omitempty"` }
func (*GetStateSummaryFrontierFailed) GetChainId ¶ added in v1.9.2
func (m *GetStateSummaryFrontierFailed) GetChainId() []byte
func (*GetStateSummaryFrontierFailed) GetRequestId ¶ added in v1.9.2
func (m *GetStateSummaryFrontierFailed) GetRequestId() uint32
func (*GetStateSummaryFrontierFailed) String ¶ added in v1.10.3
func (m *GetStateSummaryFrontierFailed) String() string
type GossipRequest ¶
type GossipRequest struct{}
func (GossipRequest) String ¶ added in v1.10.3
func (GossipRequest) String() string
type InboundMessage ¶
type InboundMessage interface { fmt.Stringer // NodeID returns the ID of the node that sent this message NodeID() ids.NodeID // Op returns the op that describes this message type Op() Op // Message returns the message that was sent Message() fmt.Stringer // Expiration returns the time that the sender will have already timed out // this request Expiration() time.Time // OnFinishedHandling must be called one time when this message has been // handled by the message handler OnFinishedHandling() // BytesSavedCompression returns the number of bytes that this message saved // due to being compressed BytesSavedCompression() int }
InboundMessage represents a set of fields for an inbound message
func InboundAccepted ¶ added in v1.9.3
func InboundAcceptedFrontier ¶ added in v1.9.3
func InboundAcceptedStateSummary ¶ added in v1.9.3
func InboundAppError ¶ added in v1.10.18
func InboundAppRequest ¶ added in v1.9.3
func InboundAppResponse ¶ added in v1.9.3
func InboundChits ¶ added in v1.9.3
func InboundGetAccepted ¶ added in v1.9.3
func InboundGetAcceptedFrontier ¶ added in v1.9.3
func InboundGetAcceptedStateSummary ¶ added in v1.9.3
func InboundGetStateSummaryFrontier ¶ added in v1.9.3
func InboundPullQuery ¶ added in v1.9.3
func InboundPushQuery ¶ added in v1.9.3
func InboundStateSummaryFrontier ¶ added in v1.9.3
func InternalConnected ¶ added in v1.9.2
func InternalConnected(nodeID ids.NodeID, nodeVersion *version.Application) InboundMessage
func InternalDisconnected ¶ added in v1.9.2
func InternalDisconnected(nodeID ids.NodeID) InboundMessage
func InternalGetAcceptedFailed ¶ added in v1.9.2
func InternalGetAcceptedFrontierFailed ¶ added in v1.9.2
func InternalGetAcceptedStateSummaryFailed ¶ added in v1.9.2
func InternalGetAncestorsFailed ¶ added in v1.9.2
func InternalGetAncestorsFailed( nodeID ids.NodeID, chainID ids.ID, requestID uint32, engineType p2p.EngineType, ) InboundMessage
func InternalGetFailed ¶ added in v1.9.2
func InternalGetStateSummaryFrontierFailed ¶ added in v1.9.2
func InternalGossipRequest ¶ added in v1.9.2
func InternalGossipRequest( nodeID ids.NodeID, ) InboundMessage
func InternalQueryFailed ¶ added in v1.9.2
func InternalTimeout ¶ added in v1.9.2
func InternalTimeout(nodeID ids.NodeID) InboundMessage
func InternalVMMessage ¶ added in v1.9.2
func InternalVMMessage( nodeID ids.NodeID, notification uint32, ) InboundMessage
type InboundMsgBuilder ¶
type InboundMsgBuilder interface { // Parse reads given bytes as InboundMessage Parse( bytes []byte, nodeID ids.NodeID, onFinishedHandling func(), ) (InboundMessage, error) }
type Op ¶
type Op byte
Op is an opcode
const ( // Handshake: PingOp Op = iota PongOp HandshakeOp GetPeerListOp PeerListOp // State sync: GetStateSummaryFrontierOp GetStateSummaryFrontierFailedOp StateSummaryFrontierOp GetAcceptedStateSummaryOp GetAcceptedStateSummaryFailedOp AcceptedStateSummaryOp // Bootstrapping: GetAcceptedFrontierOp GetAcceptedFrontierFailedOp AcceptedFrontierOp GetAcceptedOp GetAcceptedFailedOp AcceptedOp GetAncestorsOp GetAncestorsFailedOp AncestorsOp // Consensus: GetOp GetFailedOp PutOp PushQueryOp PullQueryOp QueryFailedOp ChitsOp // Application: AppRequestOp AppErrorOp AppResponseOp AppGossipOp // Internal: ConnectedOp DisconnectedOp NotifyOp GossipRequestOp TimeoutOp )
Types of messages that may be sent between nodes Note: If you add a new parseable Op below, you must also add it to ops (declared below)
type OutboundMessage ¶
type OutboundMessage interface { // BypassThrottling returns true if we should send this message, regardless // of any outbound message throttling BypassThrottling() bool // Op returns the op that describes this message type Op() Op // Bytes returns the bytes that will be sent Bytes() []byte // BytesSavedCompression returns the number of bytes that this message saved // due to being compressed BytesSavedCompression() int }
OutboundMessage represents a set of fields for an outbound message that can be serialized into a byte stream
type OutboundMsgBuilder ¶
type OutboundMsgBuilder interface { Handshake( networkID uint32, myTime uint64, ip netip.AddrPort, client string, major uint32, minor uint32, patch uint32, ipSigningTime uint64, ipNodeIDSig []byte, ipBLSSig []byte, trackedSubnets []ids.ID, supportedACPs []uint32, objectedACPs []uint32, knownPeersFilter []byte, knownPeersSalt []byte, requestAllSubnetIPs bool, ) (OutboundMessage, error) GetPeerList( knownPeersFilter []byte, knownPeersSalt []byte, requestAllSubnetIPs bool, ) (OutboundMessage, error) PeerList( peers []*ips.ClaimedIPPort, bypassThrottling bool, ) (OutboundMessage, error) Ping( primaryUptime uint32, ) (OutboundMessage, error) Pong() (OutboundMessage, error) GetStateSummaryFrontier( chainID ids.ID, requestID uint32, deadline time.Duration, ) (OutboundMessage, error) StateSummaryFrontier( chainID ids.ID, requestID uint32, summary []byte, ) (OutboundMessage, error) GetAcceptedStateSummary( chainID ids.ID, requestID uint32, deadline time.Duration, heights []uint64, ) (OutboundMessage, error) AcceptedStateSummary( chainID ids.ID, requestID uint32, summaryIDs []ids.ID, ) (OutboundMessage, error) GetAcceptedFrontier( chainID ids.ID, requestID uint32, deadline time.Duration, ) (OutboundMessage, error) AcceptedFrontier( chainID ids.ID, requestID uint32, containerID ids.ID, ) (OutboundMessage, error) GetAccepted( chainID ids.ID, requestID uint32, deadline time.Duration, containerIDs []ids.ID, ) (OutboundMessage, error) Accepted( chainID ids.ID, requestID uint32, containerIDs []ids.ID, ) (OutboundMessage, error) GetAncestors( chainID ids.ID, requestID uint32, deadline time.Duration, containerID ids.ID, engineType p2p.EngineType, ) (OutboundMessage, error) Ancestors( chainID ids.ID, requestID uint32, containers [][]byte, ) (OutboundMessage, error) Get( chainID ids.ID, requestID uint32, deadline time.Duration, containerID ids.ID, ) (OutboundMessage, error) Put( chainID ids.ID, requestID uint32, container []byte, ) (OutboundMessage, error) PushQuery( chainID ids.ID, requestID uint32, deadline time.Duration, container []byte, requestedHeight uint64, ) (OutboundMessage, error) PullQuery( chainID ids.ID, requestID uint32, deadline time.Duration, containerID ids.ID, requestedHeight uint64, ) (OutboundMessage, error) Chits( chainID ids.ID, requestID uint32, preferredID ids.ID, preferredIDAtHeight ids.ID, acceptedID ids.ID, acceptedHeight uint64, ) (OutboundMessage, error) AppRequest( chainID ids.ID, requestID uint32, deadline time.Duration, msg []byte, ) (OutboundMessage, error) AppResponse( chainID ids.ID, requestID uint32, msg []byte, ) (OutboundMessage, error) AppError( chainID ids.ID, requestID uint32, errorCode int32, errorMessage string, ) (OutboundMessage, error) AppGossip( chainID ids.ID, msg []byte, ) (OutboundMessage, error) }
OutboundMsgBuilder builds outbound messages. Outbound messages are returned with a reference count of 1. Once the reference count hits 0, the message bytes should no longer be accessed.
type QueryFailed ¶
type QueryFailed struct { ChainID ids.ID `json:"chain_id,omitempty"` RequestID uint32 `json:"request_id,omitempty"` }
func (*QueryFailed) GetChainId ¶ added in v1.9.2
func (m *QueryFailed) GetChainId() []byte
func (*QueryFailed) GetRequestId ¶ added in v1.9.2
func (m *QueryFailed) GetRequestId() uint32
func (*QueryFailed) String ¶ added in v1.10.3
func (m *QueryFailed) String() string
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package messagemock is a generated GoMock package.
|
Package messagemock is a generated GoMock package. |
Click to show internal directories.
Click to hide internal directories.