Documentation ¶
Overview ¶
Package message is a generated GoMock package.
Index ¶
- Variables
- func GetChainID(m any) (ids.ID, error)
- func GetDeadline(m any) (time.Duration, bool)
- func GetRequestID(m any) (uint32, bool)
- func GetSourceChainID(m any) (ids.ID, error)
- func Unwrap(m *p2ppb.Message) (interface{}, error)
- type AppRequestFailed
- type Connected
- type Creator
- type CrossChainAppRequest
- type CrossChainAppRequestFailed
- type CrossChainAppResponse
- type Disconnected
- type GetAcceptedFailed
- type GetAcceptedFrontierFailed
- type GetAcceptedStateSummaryFailed
- type GetAncestorsFailed
- type GetFailed
- type GetStateSummaryFrontierFailed
- type GossipRequest
- type InboundMessage
- func InternalAppRequestFailed(nodeID ids.NodeID, chainID ids.ID, requestID uint32) InboundMessage
- func InternalConnected(nodeID ids.NodeID, nodeVersion *version.Application) InboundMessage
- func InternalCrossChainAppRequest(nodeID ids.NodeID, sourceChainID ids.ID, destinationChainID ids.ID, ...) InboundMessage
- func InternalCrossChainAppRequestFailed(nodeID ids.NodeID, sourceChainID ids.ID, destinationChainID ids.ID, ...) InboundMessage
- func InternalCrossChainAppResponse(nodeID ids.NodeID, sourceChainID ids.ID, destinationChainID ids.ID, ...) 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) 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 MockOutboundMessage
- type MockOutboundMessageMockRecorder
- type Op
- type OutboundMessage
- type OutboundMsgBuilder
- type QueryFailed
- type Timeout
- type VMMessage
Constants ¶
This section is empty.
Variables ¶
var ( HandshakeOps = []Op{ PingOp, PongOp, VersionOp, 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, } // 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, AppRequestFailedOp, CrossChainAppRequestOp, CrossChainAppRequestFailedOp, CrossChainAppResponseOp, 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, AppRequestFailedOp, AppGossipOp, AppResponseOp, CrossChainAppRequestOp, CrossChainAppRequestFailedOp, CrossChainAppResponseOp, } FailedToResponseOps = map[Op]Op{ GetStateSummaryFrontierFailedOp: StateSummaryFrontierOp, GetAcceptedStateSummaryFailedOp: AcceptedStateSummaryOp, GetAcceptedFrontierFailedOp: AcceptedFrontierOp, GetAcceptedFailedOp: AcceptedOp, GetAncestorsFailedOp: AncestorsOp, GetFailedOp: PutOp, QueryFailedOp: ChitsOp, AppRequestFailedOp: AppResponseOp, CrossChainAppRequestFailedOp: CrossChainAppResponseOp, } UnrequestedOps = map[Op]struct{}{ GetAcceptedFrontierOp: {}, GetAcceptedOp: {}, GetAncestorsOp: {}, GetOp: {}, PushQueryOp: {}, PullQueryOp: {}, AppRequestOp: {}, AppGossipOp: {}, CrossChainAppRequestOp: {}, GetStateSummaryFrontierOp: {}, GetAcceptedStateSummaryOp: {}, } )
Functions ¶
func GetRequestID ¶ added in v1.9.2
Types ¶
type AppRequestFailed ¶
func (*AppRequestFailed) GetChainId ¶ added in v1.9.2
func (m *AppRequestFailed) GetChainId() []byte
func (*AppRequestFailed) GetRequestId ¶ added in v1.9.2
func (m *AppRequestFailed) GetRequestId() uint32
type Connected ¶
type Connected struct {
NodeVersion *version.Application
}
type Creator ¶
type Creator interface { OutboundMsgBuilder InboundMsgBuilder }
func NewCreator ¶
func NewCreator( metrics prometheus.Registerer, parentNamespace string, compressionEnabled bool, maxMessageTimeout time.Duration, ) (Creator, error)
type CrossChainAppRequest ¶ added in v1.9.1
type CrossChainAppRequest struct { SourceChainID ids.ID DestinationChainID ids.ID RequestID uint32 Message []byte }
func (*CrossChainAppRequest) GetChainId ¶ added in v1.9.2
func (m *CrossChainAppRequest) GetChainId() []byte
func (*CrossChainAppRequest) GetRequestId ¶ added in v1.9.2
func (m *CrossChainAppRequest) GetRequestId() uint32
func (*CrossChainAppRequest) GetSourceChainID ¶ added in v1.9.2
func (m *CrossChainAppRequest) GetSourceChainID() ids.ID
type CrossChainAppRequestFailed ¶ added in v1.9.1
type CrossChainAppRequestFailed struct { SourceChainID ids.ID DestinationChainID ids.ID RequestID uint32 }
func (*CrossChainAppRequestFailed) GetChainId ¶ added in v1.9.2
func (m *CrossChainAppRequestFailed) GetChainId() []byte
func (*CrossChainAppRequestFailed) GetRequestId ¶ added in v1.9.2
func (m *CrossChainAppRequestFailed) GetRequestId() uint32
func (*CrossChainAppRequestFailed) GetSourceChainID ¶ added in v1.9.2
func (m *CrossChainAppRequestFailed) GetSourceChainID() ids.ID
type CrossChainAppResponse ¶ added in v1.9.1
type CrossChainAppResponse struct { SourceChainID ids.ID DestinationChainID ids.ID RequestID uint32 Message []byte }
func (*CrossChainAppResponse) GetChainId ¶ added in v1.9.2
func (m *CrossChainAppResponse) GetChainId() []byte
func (*CrossChainAppResponse) GetRequestId ¶ added in v1.9.2
func (m *CrossChainAppResponse) GetRequestId() uint32
func (*CrossChainAppResponse) GetSourceChainID ¶ added in v1.9.2
func (m *CrossChainAppResponse) GetSourceChainID() ids.ID
type Disconnected ¶
type Disconnected struct{}
type GetAcceptedFailed ¶
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
type GetAcceptedFrontierFailed ¶
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
type GetAcceptedStateSummaryFailed ¶ added in v1.7.11
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
type GetAncestorsFailed ¶
func (*GetAncestorsFailed) GetChainId ¶ added in v1.9.2
func (m *GetAncestorsFailed) GetChainId() []byte
func (*GetAncestorsFailed) GetRequestId ¶ added in v1.9.2
func (m *GetAncestorsFailed) GetRequestId() uint32
type GetFailed ¶
func (*GetFailed) GetChainId ¶ added in v1.9.2
func (*GetFailed) GetRequestId ¶ added in v1.9.2
type GetStateSummaryFrontierFailed ¶ added in v1.7.11
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
type GossipRequest ¶
type GossipRequest struct{}
type InboundMessage ¶
type InboundMessage interface { // 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() any // 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 InternalAppRequestFailed ¶ added in v1.9.2
func InternalConnected ¶ added in v1.9.2
func InternalConnected(nodeID ids.NodeID, nodeVersion *version.Application) InboundMessage
func InternalCrossChainAppRequest ¶ added in v1.9.2
func InternalCrossChainAppRequestFailed ¶ added in v1.9.2
func InternalCrossChainAppResponse ¶ added in v1.9.2
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 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) InboundGetStateSummaryFrontier( chainID ids.ID, requestID uint32, deadline time.Duration, nodeID ids.NodeID, ) InboundMessage InboundStateSummaryFrontier( chainID ids.ID, requestID uint32, summary []byte, nodeID ids.NodeID, ) InboundMessage InboundGetAcceptedStateSummary( chainID ids.ID, requestID uint32, heights []uint64, deadline time.Duration, nodeID ids.NodeID, ) InboundMessage InboundAcceptedStateSummary( chainID ids.ID, requestID uint32, summaryIDs []ids.ID, nodeID ids.NodeID, ) InboundMessage InboundGetAcceptedFrontier( chainID ids.ID, requestID uint32, deadline time.Duration, nodeID ids.NodeID, ) InboundMessage InboundAcceptedFrontier( chainID ids.ID, requestID uint32, containerIDs []ids.ID, nodeID ids.NodeID, ) InboundMessage InboundGetAccepted( chainID ids.ID, requestID uint32, deadline time.Duration, containerIDs []ids.ID, nodeID ids.NodeID, ) InboundMessage InboundAccepted( chainID ids.ID, requestID uint32, containerIDs []ids.ID, nodeID ids.NodeID, ) InboundMessage InboundPushQuery( chainID ids.ID, requestID uint32, deadline time.Duration, container []byte, nodeID ids.NodeID, ) InboundMessage InboundPullQuery( chainID ids.ID, requestID uint32, deadline time.Duration, containerID ids.ID, nodeID ids.NodeID, ) InboundMessage InboundChits( chainID ids.ID, requestID uint32, containerIDs []ids.ID, nodeID ids.NodeID, ) InboundMessage InboundAppRequest( chainID ids.ID, requestID uint32, deadline time.Duration, msg []byte, nodeID ids.NodeID, ) InboundMessage InboundAppResponse( chainID ids.ID, requestID uint32, msg []byte, nodeID ids.NodeID, ) InboundMessage }
type MockOutboundMessage ¶ added in v1.9.2
type MockOutboundMessage struct {
// contains filtered or unexported fields
}
MockOutboundMessage is a mock of OutboundMessage interface.
func NewMockOutboundMessage ¶ added in v1.9.2
func NewMockOutboundMessage(ctrl *gomock.Controller) *MockOutboundMessage
NewMockOutboundMessage creates a new mock instance.
func (*MockOutboundMessage) BypassThrottling ¶ added in v1.9.2
func (m *MockOutboundMessage) BypassThrottling() bool
BypassThrottling mocks base method.
func (*MockOutboundMessage) Bytes ¶ added in v1.9.2
func (m *MockOutboundMessage) Bytes() []byte
Bytes mocks base method.
func (*MockOutboundMessage) BytesSavedCompression ¶ added in v1.9.2
func (m *MockOutboundMessage) BytesSavedCompression() int
BytesSavedCompression mocks base method.
func (*MockOutboundMessage) EXPECT ¶ added in v1.9.2
func (m *MockOutboundMessage) EXPECT() *MockOutboundMessageMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockOutboundMessage) Op ¶ added in v1.9.2
func (m *MockOutboundMessage) Op() Op
Op mocks base method.
type MockOutboundMessageMockRecorder ¶ added in v1.9.2
type MockOutboundMessageMockRecorder struct {
// contains filtered or unexported fields
}
MockOutboundMessageMockRecorder is the mock recorder for MockOutboundMessage.
func (*MockOutboundMessageMockRecorder) BypassThrottling ¶ added in v1.9.2
func (mr *MockOutboundMessageMockRecorder) BypassThrottling() *gomock.Call
BypassThrottling indicates an expected call of BypassThrottling.
func (*MockOutboundMessageMockRecorder) Bytes ¶ added in v1.9.2
func (mr *MockOutboundMessageMockRecorder) Bytes() *gomock.Call
Bytes indicates an expected call of Bytes.
func (*MockOutboundMessageMockRecorder) BytesSavedCompression ¶ added in v1.9.2
func (mr *MockOutboundMessageMockRecorder) BytesSavedCompression() *gomock.Call
BytesSavedCompression indicates an expected call of BytesSavedCompression.
func (*MockOutboundMessageMockRecorder) Op ¶ added in v1.9.2
func (mr *MockOutboundMessageMockRecorder) Op() *gomock.Call
Op indicates an expected call of Op.
type Op ¶
type Op byte
Op is an opcode
const ( // Handshake: PingOp Op = iota PongOp VersionOp 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 AppRequestFailedOp AppResponseOp AppGossipOp // Cross chain: CrossChainAppRequestOp CrossChainAppRequestFailedOp CrossChainAppResponseOp // 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 { Version( networkID uint32, myTime uint64, ip ips.IPPort, myVersion string, myVersionTime uint64, sig []byte, trackedSubnets []ids.ID, ) (OutboundMessage, error) PeerList( peers []ips.ClaimedIPPort, bypassThrottling bool, ) (OutboundMessage, error) Ping() (OutboundMessage, error) Pong(uptimePercentage uint8) (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, containerIDs []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, ) (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, ) (OutboundMessage, error) PullQuery( chainID ids.ID, requestID uint32, deadline time.Duration, containerID ids.ID, ) (OutboundMessage, error) Chits( chainID ids.ID, requestID uint32, containerIDs []ids.ID, ) (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) 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 ¶
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