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 InboundAccepted(chainID ids.ID, requestID uint32, containerIDs []ids.ID, nodeID ids.NodeID) InboundMessage
- func InboundAcceptedFrontier(chainID ids.ID, requestID uint32, containerIDs []ids.ID, nodeID ids.NodeID) InboundMessage
- func InboundAcceptedStateSummary(chainID ids.ID, requestID uint32, summaryIDs []ids.ID, nodeID ids.NodeID) 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, containerIDs []ids.ID, nodeID ids.NodeID) 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 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 ¶
Types ¶
type AppRequestFailed ¶
func (*AppRequestFailed) GetChainId ¶
func (m *AppRequestFailed) GetChainId() []byte
func (*AppRequestFailed) GetRequestId ¶
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 ¶
type CrossChainAppRequest struct {
SourceChainID ids.ID
DestinationChainID ids.ID
RequestID uint32
Message []byte
}
func (*CrossChainAppRequest) GetChainId ¶
func (m *CrossChainAppRequest) GetChainId() []byte
func (*CrossChainAppRequest) GetRequestId ¶
func (m *CrossChainAppRequest) GetRequestId() uint32
func (*CrossChainAppRequest) GetSourceChainID ¶
func (m *CrossChainAppRequest) GetSourceChainID() ids.ID
type CrossChainAppRequestFailed ¶
type CrossChainAppRequestFailed struct {
SourceChainID ids.ID
DestinationChainID ids.ID
RequestID uint32
}
func (*CrossChainAppRequestFailed) GetChainId ¶
func (m *CrossChainAppRequestFailed) GetChainId() []byte
func (*CrossChainAppRequestFailed) GetRequestId ¶
func (m *CrossChainAppRequestFailed) GetRequestId() uint32
func (*CrossChainAppRequestFailed) GetSourceChainID ¶
func (m *CrossChainAppRequestFailed) GetSourceChainID() ids.ID
type CrossChainAppResponse ¶
type CrossChainAppResponse struct {
SourceChainID ids.ID
DestinationChainID ids.ID
RequestID uint32
Message []byte
}
func (*CrossChainAppResponse) GetChainId ¶
func (m *CrossChainAppResponse) GetChainId() []byte
func (*CrossChainAppResponse) GetRequestId ¶
func (m *CrossChainAppResponse) GetRequestId() uint32
func (*CrossChainAppResponse) GetSourceChainID ¶
func (m *CrossChainAppResponse) GetSourceChainID() ids.ID
type Disconnected ¶
type Disconnected struct{}
type GetAcceptedFailed ¶
func (*GetAcceptedFailed) GetChainId ¶
func (m *GetAcceptedFailed) GetChainId() []byte
func (*GetAcceptedFailed) GetRequestId ¶
func (m *GetAcceptedFailed) GetRequestId() uint32
type GetAcceptedFrontierFailed ¶
func (*GetAcceptedFrontierFailed) GetChainId ¶
func (m *GetAcceptedFrontierFailed) GetChainId() []byte
func (*GetAcceptedFrontierFailed) GetRequestId ¶
func (m *GetAcceptedFrontierFailed) GetRequestId() uint32
type GetAcceptedStateSummaryFailed ¶
func (*GetAcceptedStateSummaryFailed) GetChainId ¶
func (m *GetAcceptedStateSummaryFailed) GetChainId() []byte
func (*GetAcceptedStateSummaryFailed) GetRequestId ¶
func (m *GetAcceptedStateSummaryFailed) GetRequestId() uint32
type GetAncestorsFailed ¶
func (*GetAncestorsFailed) GetChainId ¶
func (m *GetAncestorsFailed) GetChainId() []byte
func (*GetAncestorsFailed) GetRequestId ¶
func (m *GetAncestorsFailed) GetRequestId() uint32
type GetStateSummaryFrontierFailed ¶
func (*GetStateSummaryFrontierFailed) GetChainId ¶
func (m *GetStateSummaryFrontierFailed) GetChainId() []byte
func (*GetStateSummaryFrontierFailed) GetRequestId ¶
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 InboundAccepted ¶
func InboundAcceptedFrontier ¶
func InboundAppRequest ¶
func InboundAppResponse ¶
func InboundChits ¶
func InboundGetAccepted ¶
func InboundPullQuery ¶
func InboundPushQuery ¶
func InternalConnected ¶
func InternalConnected(nodeID ids.NodeID, nodeVersion *version.Application) InboundMessage
func InternalDisconnected ¶
func InternalDisconnected(nodeID ids.NodeID) InboundMessage
func InternalGetFailed ¶
func InternalGossipRequest ¶
func InternalGossipRequest( nodeID ids.NodeID, ) InboundMessage
func InternalQueryFailed ¶
func InternalTimeout ¶
func InternalTimeout(nodeID ids.NodeID) InboundMessage
func InternalVMMessage ¶
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 MockOutboundMessage ¶
type MockOutboundMessage struct {
// contains filtered or unexported fields
}
MockOutboundMessage is a mock of OutboundMessage interface.
func NewMockOutboundMessage ¶
func NewMockOutboundMessage(ctrl *gomock.Controller) *MockOutboundMessage
NewMockOutboundMessage creates a new mock instance.
func (*MockOutboundMessage) BypassThrottling ¶
func (m *MockOutboundMessage) BypassThrottling() bool
BypassThrottling mocks base method.
func (*MockOutboundMessage) Bytes ¶
func (m *MockOutboundMessage) Bytes() []byte
Bytes mocks base method.
func (*MockOutboundMessage) BytesSavedCompression ¶
func (m *MockOutboundMessage) BytesSavedCompression() int
BytesSavedCompression mocks base method.
func (*MockOutboundMessage) EXPECT ¶
func (m *MockOutboundMessage) EXPECT() *MockOutboundMessageMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockOutboundMessageMockRecorder ¶
type MockOutboundMessageMockRecorder struct {
// contains filtered or unexported fields
}
MockOutboundMessageMockRecorder is the mock recorder for MockOutboundMessage.
func (*MockOutboundMessageMockRecorder) BypassThrottling ¶
func (mr *MockOutboundMessageMockRecorder) BypassThrottling() *gomock.Call
BypassThrottling indicates an expected call of BypassThrottling.
func (*MockOutboundMessageMockRecorder) Bytes ¶
func (mr *MockOutboundMessageMockRecorder) Bytes() *gomock.Call
Bytes indicates an expected call of Bytes.
func (*MockOutboundMessageMockRecorder) BytesSavedCompression ¶
func (mr *MockOutboundMessageMockRecorder) BytesSavedCompression() *gomock.Call
BytesSavedCompression indicates an expected call of BytesSavedCompression.
func (*MockOutboundMessageMockRecorder) Op ¶
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 ¶
func (m *QueryFailed) GetChainId() []byte
func (*QueryFailed) GetRequestId ¶
func (m *QueryFailed) GetRequestId() uint32