message

package
v1.11.10-rc.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2024 License: BSD-3-Clause Imports: 17 Imported by: 43

Documentation

Overview

Package message is a generated GoMock package.

Package message is a generated GoMock package.

Index

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,
		CrossChainAppRequestOp,
		CrossChainAppErrorOp,
		CrossChainAppResponseOp,
		ConnectedOp,
		ConnectedSubnetOp,
		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,
		ConnectedSubnetOp,
		DisconnectedOp,
	}

	AsynchronousOps = []Op{

		AppRequestOp,
		AppErrorOp,
		AppGossipOp,
		AppResponseOp,

		CrossChainAppRequestOp,
		CrossChainAppErrorOp,
		CrossChainAppResponseOp,
	}

	FailedToResponseOps = map[Op]Op{
		GetStateSummaryFrontierFailedOp: StateSummaryFrontierOp,
		GetAcceptedStateSummaryFailedOp: AcceptedStateSummaryOp,
		GetAcceptedFrontierFailedOp:     AcceptedFrontierOp,
		GetAcceptedFailedOp:             AcceptedOp,
		GetAncestorsFailedOp:            AncestorsOp,
		GetFailedOp:                     PutOp,
		QueryFailedOp:                   ChitsOp,
		AppErrorOp:                      AppResponseOp,
		CrossChainAppErrorOp:            CrossChainAppResponseOp,
	}
	UnrequestedOps = set.Of(
		GetAcceptedFrontierOp,
		GetAcceptedOp,
		GetAncestorsOp,
		GetOp,
		PushQueryOp,
		PullQueryOp,
		AppRequestOp,
		AppGossipOp,
		CrossChainAppRequestOp,
		GetStateSummaryFrontierOp,
		GetAcceptedStateSummaryOp,
	)
)

Functions

func GetChainID added in v1.9.2

func GetChainID(m any) (ids.ID, error)

func GetDeadline added in v1.9.2

func GetDeadline(m any) (time.Duration, bool)

func GetEngineType added in v1.9.6

func GetEngineType(m any) (p2p.EngineType, bool)

func GetRequestID added in v1.9.2

func GetRequestID(m any) (uint32, bool)

func GetSourceChainID added in v1.9.2

func GetSourceChainID(m any) (ids.ID, error)

func Unwrap added in v1.9.2

func Unwrap(m *p2p.Message) (fmt.Stringer, error)

Types

type Connected

type Connected struct {
	NodeVersion *version.Application `json:"node_version,omitempty"`
}

func (*Connected) String added in v1.10.3

func (m *Connected) String() string

type ConnectedSubnet added in v1.9.4

type ConnectedSubnet struct {
	SubnetID ids.ID `json:"subnet_id,omitempty"`
}

ConnectedSubnet contains the subnet ID of the subnet that the node is connected to.

func (*ConnectedSubnet) String added in v1.10.3

func (m *ConnectedSubnet) String() string

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 CrossChainAppRequest added in v1.9.1

type CrossChainAppRequest struct {
	SourceChainID      ids.ID `json:"source_chain_id,omitempty"`
	DestinationChainID ids.ID `json:"destination_chain_id,omitempty"`
	RequestID          uint32 `json:"request_id,omitempty"`
	Message            []byte `json:"message,omitempty"`
}

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

func (*CrossChainAppRequest) String added in v1.10.3

func (m *CrossChainAppRequest) String() string

type CrossChainAppRequestFailed added in v1.9.1

type CrossChainAppRequestFailed struct {
	SourceChainID      ids.ID `json:"source_chain_id,omitempty"`
	DestinationChainID ids.ID `json:"destination_chain_id,omitempty"`
	RequestID          uint32 `json:"request_id,omitempty"`
	ErrorCode          int32  `json:"error_code,omitempty"`
	ErrorMessage       string `json:"error_message,omitempty"`
}

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

func (*CrossChainAppRequestFailed) String added in v1.10.3

func (m *CrossChainAppRequestFailed) String() string

type CrossChainAppResponse added in v1.9.1

type CrossChainAppResponse struct {
	SourceChainID      ids.ID `json:"source_chain_id,omitempty"`
	DestinationChainID ids.ID `json:"destination_chain_id,omitempty"`
	RequestID          uint32 `json:"request_id,omitempty"`
	Message            []byte `json:"message,omitempty"`
}

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

func (*CrossChainAppResponse) String added in v1.10.3

func (m *CrossChainAppResponse) String() string

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

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 (m *GetFailed) GetChainId() []byte

func (*GetFailed) GetRequestId added in v1.9.2

func (m *GetFailed) GetRequestId() uint32

func (*GetFailed) String added in v1.10.3

func (m *GetFailed) String() string

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

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 InboundAccepted(
	chainID ids.ID,
	requestID uint32,
	containerIDs []ids.ID,
	nodeID ids.NodeID,
) InboundMessage

func InboundAcceptedFrontier added in v1.9.3

func InboundAcceptedFrontier(
	chainID ids.ID,
	requestID uint32,
	containerID ids.ID,
	nodeID ids.NodeID,
) InboundMessage

func InboundAcceptedStateSummary added in v1.9.3

func InboundAcceptedStateSummary(
	chainID ids.ID,
	requestID uint32,
	summaryIDs []ids.ID,
	nodeID ids.NodeID,
) InboundMessage

func InboundAppError added in v1.10.18

func InboundAppError(
	nodeID ids.NodeID,
	chainID ids.ID,
	requestID uint32,
	errorCode int32,
	errorMessage string,
) InboundMessage

func InboundAppRequest added in v1.9.3

func InboundAppRequest(
	chainID ids.ID,
	requestID uint32,
	deadline time.Duration,
	msg []byte,
	nodeID ids.NodeID,
) InboundMessage

func InboundAppResponse added in v1.9.3

func InboundAppResponse(
	chainID ids.ID,
	requestID uint32,
	msg []byte,
	nodeID ids.NodeID,
) InboundMessage

func InboundChits added in v1.9.3

func InboundChits(
	chainID ids.ID,
	requestID uint32,
	preferredID ids.ID,
	preferredIDAtHeight ids.ID,
	acceptedID ids.ID,
	nodeID ids.NodeID,
) InboundMessage

func InboundGetAccepted added in v1.9.3

func InboundGetAccepted(
	chainID ids.ID,
	requestID uint32,
	deadline time.Duration,
	containerIDs []ids.ID,
	nodeID ids.NodeID,
) InboundMessage

func InboundGetAcceptedFrontier added in v1.9.3

func InboundGetAcceptedFrontier(
	chainID ids.ID,
	requestID uint32,
	deadline time.Duration,
	nodeID ids.NodeID,
) InboundMessage

func InboundGetAcceptedStateSummary added in v1.9.3

func InboundGetAcceptedStateSummary(
	chainID ids.ID,
	requestID uint32,
	heights []uint64,
	deadline time.Duration,
	nodeID ids.NodeID,
) InboundMessage

func InboundGetStateSummaryFrontier added in v1.9.3

func InboundGetStateSummaryFrontier(
	chainID ids.ID,
	requestID uint32,
	deadline time.Duration,
	nodeID ids.NodeID,
) InboundMessage

func InboundPullQuery added in v1.9.3

func InboundPullQuery(
	chainID ids.ID,
	requestID uint32,
	deadline time.Duration,
	containerID ids.ID,
	requestedHeight uint64,
	nodeID ids.NodeID,
) InboundMessage

func InboundPushQuery added in v1.9.3

func InboundPushQuery(
	chainID ids.ID,
	requestID uint32,
	deadline time.Duration,
	container []byte,
	requestedHeight uint64,
	nodeID ids.NodeID,
) InboundMessage

func InboundStateSummaryFrontier added in v1.9.3

func InboundStateSummaryFrontier(
	chainID ids.ID,
	requestID uint32,
	summary []byte,
	nodeID ids.NodeID,
) InboundMessage

func InternalConnected added in v1.9.2

func InternalConnected(nodeID ids.NodeID, nodeVersion *version.Application) InboundMessage

func InternalConnectedSubnet added in v1.9.4

func InternalConnectedSubnet(nodeID ids.NodeID, subnetID ids.ID) InboundMessage

InternalConnectedSubnet returns a message that indicates the node with [nodeID] is connected to the subnet with the given [subnetID].

func InternalCrossChainAppError added in v1.10.18

func InternalCrossChainAppError(
	nodeID ids.NodeID,
	sourceChainID ids.ID,
	destinationChainID ids.ID,
	requestID uint32,
	errorCode int32,
	errorMessage string,
) InboundMessage

func InternalCrossChainAppRequest added in v1.9.2

func InternalCrossChainAppRequest(
	nodeID ids.NodeID,
	sourceChainID ids.ID,
	destinationChainID ids.ID,
	requestID uint32,
	deadline time.Duration,
	msg []byte,
) InboundMessage

func InternalCrossChainAppResponse added in v1.9.2

func InternalCrossChainAppResponse(
	nodeID ids.NodeID,
	sourceChainID ids.ID,
	destinationChainID ids.ID,
	requestID uint32,
	msg []byte,
) InboundMessage

func InternalDisconnected added in v1.9.2

func InternalDisconnected(nodeID ids.NodeID) InboundMessage

func InternalGetAcceptedFailed added in v1.9.2

func InternalGetAcceptedFailed(
	nodeID ids.NodeID,
	chainID ids.ID,
	requestID uint32,
) InboundMessage

func InternalGetAcceptedFrontierFailed added in v1.9.2

func InternalGetAcceptedFrontierFailed(
	nodeID ids.NodeID,
	chainID ids.ID,
	requestID uint32,
) InboundMessage

func InternalGetAcceptedStateSummaryFailed added in v1.9.2

func InternalGetAcceptedStateSummaryFailed(
	nodeID ids.NodeID,
	chainID ids.ID,
	requestID uint32,
) InboundMessage

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 InternalGetFailed(
	nodeID ids.NodeID,
	chainID ids.ID,
	requestID uint32,
) InboundMessage

func InternalGetStateSummaryFrontierFailed added in v1.9.2

func InternalGetStateSummaryFrontierFailed(
	nodeID ids.NodeID,
	chainID ids.ID,
	requestID uint32,
) InboundMessage

func InternalGossipRequest added in v1.9.2

func InternalGossipRequest(
	nodeID ids.NodeID,
) InboundMessage

func InternalQueryFailed added in v1.9.2

func InternalQueryFailed(
	nodeID ids.NodeID,
	chainID ids.ID,
	requestID uint32,
) InboundMessage

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 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

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

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

Op indicates an expected call of Op.

type MockOutboundMsgBuilder added in v1.9.4

type MockOutboundMsgBuilder struct {
	// contains filtered or unexported fields
}

MockOutboundMsgBuilder is a mock of OutboundMsgBuilder interface.

func NewMockOutboundMsgBuilder added in v1.9.4

func NewMockOutboundMsgBuilder(ctrl *gomock.Controller) *MockOutboundMsgBuilder

NewMockOutboundMsgBuilder creates a new mock instance.

func (*MockOutboundMsgBuilder) Accepted added in v1.9.4

func (m *MockOutboundMsgBuilder) Accepted(arg0 ids.ID, arg1 uint32, arg2 []ids.ID) (OutboundMessage, error)

Accepted mocks base method.

func (*MockOutboundMsgBuilder) AcceptedFrontier added in v1.9.4

func (m *MockOutboundMsgBuilder) AcceptedFrontier(arg0 ids.ID, arg1 uint32, arg2 ids.ID) (OutboundMessage, error)

AcceptedFrontier mocks base method.

func (*MockOutboundMsgBuilder) AcceptedStateSummary added in v1.9.4

func (m *MockOutboundMsgBuilder) AcceptedStateSummary(arg0 ids.ID, arg1 uint32, arg2 []ids.ID) (OutboundMessage, error)

AcceptedStateSummary mocks base method.

func (*MockOutboundMsgBuilder) Ancestors added in v1.9.4

func (m *MockOutboundMsgBuilder) Ancestors(arg0 ids.ID, arg1 uint32, arg2 [][]byte) (OutboundMessage, error)

Ancestors mocks base method.

func (*MockOutboundMsgBuilder) AppError added in v1.11.0

func (m *MockOutboundMsgBuilder) AppError(arg0 ids.ID, arg1 uint32, arg2 int32, arg3 string) (OutboundMessage, error)

AppError mocks base method.

func (*MockOutboundMsgBuilder) AppGossip added in v1.9.4

func (m *MockOutboundMsgBuilder) AppGossip(arg0 ids.ID, arg1 []byte) (OutboundMessage, error)

AppGossip mocks base method.

func (*MockOutboundMsgBuilder) AppRequest added in v1.9.4

func (m *MockOutboundMsgBuilder) AppRequest(arg0 ids.ID, arg1 uint32, arg2 time.Duration, arg3 []byte) (OutboundMessage, error)

AppRequest mocks base method.

func (*MockOutboundMsgBuilder) AppResponse added in v1.9.4

func (m *MockOutboundMsgBuilder) AppResponse(arg0 ids.ID, arg1 uint32, arg2 []byte) (OutboundMessage, error)

AppResponse mocks base method.

func (*MockOutboundMsgBuilder) Chits added in v1.9.4

func (m *MockOutboundMsgBuilder) Chits(arg0 ids.ID, arg1 uint32, arg2, arg3, arg4 ids.ID) (OutboundMessage, error)

Chits mocks base method.

func (*MockOutboundMsgBuilder) EXPECT added in v1.9.4

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockOutboundMsgBuilder) Get added in v1.9.4

func (m *MockOutboundMsgBuilder) Get(arg0 ids.ID, arg1 uint32, arg2 time.Duration, arg3 ids.ID) (OutboundMessage, error)

Get mocks base method.

func (*MockOutboundMsgBuilder) GetAccepted added in v1.9.4

func (m *MockOutboundMsgBuilder) GetAccepted(arg0 ids.ID, arg1 uint32, arg2 time.Duration, arg3 []ids.ID) (OutboundMessage, error)

GetAccepted mocks base method.

func (*MockOutboundMsgBuilder) GetAcceptedFrontier added in v1.9.4

func (m *MockOutboundMsgBuilder) GetAcceptedFrontier(arg0 ids.ID, arg1 uint32, arg2 time.Duration) (OutboundMessage, error)

GetAcceptedFrontier mocks base method.

func (*MockOutboundMsgBuilder) GetAcceptedStateSummary added in v1.9.4

func (m *MockOutboundMsgBuilder) GetAcceptedStateSummary(arg0 ids.ID, arg1 uint32, arg2 time.Duration, arg3 []uint64) (OutboundMessage, error)

GetAcceptedStateSummary mocks base method.

func (*MockOutboundMsgBuilder) GetAncestors added in v1.9.4

func (m *MockOutboundMsgBuilder) GetAncestors(arg0 ids.ID, arg1 uint32, arg2 time.Duration, arg3 ids.ID, arg4 p2p.EngineType) (OutboundMessage, error)

GetAncestors mocks base method.

func (*MockOutboundMsgBuilder) GetPeerList added in v1.10.18

func (m *MockOutboundMsgBuilder) GetPeerList(arg0, arg1 []byte) (OutboundMessage, error)

GetPeerList mocks base method.

func (*MockOutboundMsgBuilder) GetStateSummaryFrontier added in v1.9.4

func (m *MockOutboundMsgBuilder) GetStateSummaryFrontier(arg0 ids.ID, arg1 uint32, arg2 time.Duration) (OutboundMessage, error)

GetStateSummaryFrontier mocks base method.

func (*MockOutboundMsgBuilder) Handshake added in v1.10.18

func (m *MockOutboundMsgBuilder) Handshake(arg0 uint32, arg1 uint64, arg2 netip.AddrPort, arg3 string, arg4, arg5, arg6 uint32, arg7 uint64, arg8, arg9 []byte, arg10 []ids.ID, arg11, arg12 []uint32, arg13, arg14 []byte) (OutboundMessage, error)

Handshake mocks base method.

func (*MockOutboundMsgBuilder) PeerList added in v1.9.4

func (m *MockOutboundMsgBuilder) PeerList(arg0 []*ips.ClaimedIPPort, arg1 bool) (OutboundMessage, error)

PeerList mocks base method.

func (*MockOutboundMsgBuilder) Ping added in v1.9.4

Ping mocks base method.

func (*MockOutboundMsgBuilder) Pong added in v1.9.4

Pong mocks base method.

func (*MockOutboundMsgBuilder) PullQuery added in v1.9.4

func (m *MockOutboundMsgBuilder) PullQuery(arg0 ids.ID, arg1 uint32, arg2 time.Duration, arg3 ids.ID, arg4 uint64) (OutboundMessage, error)

PullQuery mocks base method.

func (*MockOutboundMsgBuilder) PushQuery added in v1.9.4

func (m *MockOutboundMsgBuilder) PushQuery(arg0 ids.ID, arg1 uint32, arg2 time.Duration, arg3 []byte, arg4 uint64) (OutboundMessage, error)

PushQuery mocks base method.

func (*MockOutboundMsgBuilder) Put added in v1.9.4

func (m *MockOutboundMsgBuilder) Put(arg0 ids.ID, arg1 uint32, arg2 []byte) (OutboundMessage, error)

Put mocks base method.

func (*MockOutboundMsgBuilder) StateSummaryFrontier added in v1.9.4

func (m *MockOutboundMsgBuilder) StateSummaryFrontier(arg0 ids.ID, arg1 uint32, arg2 []byte) (OutboundMessage, error)

StateSummaryFrontier mocks base method.

type MockOutboundMsgBuilderMockRecorder added in v1.9.4

type MockOutboundMsgBuilderMockRecorder struct {
	// contains filtered or unexported fields
}

MockOutboundMsgBuilderMockRecorder is the mock recorder for MockOutboundMsgBuilder.

func (*MockOutboundMsgBuilderMockRecorder) Accepted added in v1.9.4

func (mr *MockOutboundMsgBuilderMockRecorder) Accepted(arg0, arg1, arg2 any) *gomock.Call

Accepted indicates an expected call of Accepted.

func (*MockOutboundMsgBuilderMockRecorder) AcceptedFrontier added in v1.9.4

func (mr *MockOutboundMsgBuilderMockRecorder) AcceptedFrontier(arg0, arg1, arg2 any) *gomock.Call

AcceptedFrontier indicates an expected call of AcceptedFrontier.

func (*MockOutboundMsgBuilderMockRecorder) AcceptedStateSummary added in v1.9.4

func (mr *MockOutboundMsgBuilderMockRecorder) AcceptedStateSummary(arg0, arg1, arg2 any) *gomock.Call

AcceptedStateSummary indicates an expected call of AcceptedStateSummary.

func (*MockOutboundMsgBuilderMockRecorder) Ancestors added in v1.9.4

func (mr *MockOutboundMsgBuilderMockRecorder) Ancestors(arg0, arg1, arg2 any) *gomock.Call

Ancestors indicates an expected call of Ancestors.

func (*MockOutboundMsgBuilderMockRecorder) AppError added in v1.11.0

func (mr *MockOutboundMsgBuilderMockRecorder) AppError(arg0, arg1, arg2, arg3 any) *gomock.Call

AppError indicates an expected call of AppError.

func (*MockOutboundMsgBuilderMockRecorder) AppGossip added in v1.9.4

func (mr *MockOutboundMsgBuilderMockRecorder) AppGossip(arg0, arg1 any) *gomock.Call

AppGossip indicates an expected call of AppGossip.

func (*MockOutboundMsgBuilderMockRecorder) AppRequest added in v1.9.4

func (mr *MockOutboundMsgBuilderMockRecorder) AppRequest(arg0, arg1, arg2, arg3 any) *gomock.Call

AppRequest indicates an expected call of AppRequest.

func (*MockOutboundMsgBuilderMockRecorder) AppResponse added in v1.9.4

func (mr *MockOutboundMsgBuilderMockRecorder) AppResponse(arg0, arg1, arg2 any) *gomock.Call

AppResponse indicates an expected call of AppResponse.

func (*MockOutboundMsgBuilderMockRecorder) Chits added in v1.9.4

func (mr *MockOutboundMsgBuilderMockRecorder) Chits(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call

Chits indicates an expected call of Chits.

func (*MockOutboundMsgBuilderMockRecorder) Get added in v1.9.4

func (mr *MockOutboundMsgBuilderMockRecorder) Get(arg0, arg1, arg2, arg3 any) *gomock.Call

Get indicates an expected call of Get.

func (*MockOutboundMsgBuilderMockRecorder) GetAccepted added in v1.9.4

func (mr *MockOutboundMsgBuilderMockRecorder) GetAccepted(arg0, arg1, arg2, arg3 any) *gomock.Call

GetAccepted indicates an expected call of GetAccepted.

func (*MockOutboundMsgBuilderMockRecorder) GetAcceptedFrontier added in v1.9.4

func (mr *MockOutboundMsgBuilderMockRecorder) GetAcceptedFrontier(arg0, arg1, arg2 any) *gomock.Call

GetAcceptedFrontier indicates an expected call of GetAcceptedFrontier.

func (*MockOutboundMsgBuilderMockRecorder) GetAcceptedStateSummary added in v1.9.4

func (mr *MockOutboundMsgBuilderMockRecorder) GetAcceptedStateSummary(arg0, arg1, arg2, arg3 any) *gomock.Call

GetAcceptedStateSummary indicates an expected call of GetAcceptedStateSummary.

func (*MockOutboundMsgBuilderMockRecorder) GetAncestors added in v1.9.4

func (mr *MockOutboundMsgBuilderMockRecorder) GetAncestors(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call

GetAncestors indicates an expected call of GetAncestors.

func (*MockOutboundMsgBuilderMockRecorder) GetPeerList added in v1.10.18

func (mr *MockOutboundMsgBuilderMockRecorder) GetPeerList(arg0, arg1 any) *gomock.Call

GetPeerList indicates an expected call of GetPeerList.

func (*MockOutboundMsgBuilderMockRecorder) GetStateSummaryFrontier added in v1.9.4

func (mr *MockOutboundMsgBuilderMockRecorder) GetStateSummaryFrontier(arg0, arg1, arg2 any) *gomock.Call

GetStateSummaryFrontier indicates an expected call of GetStateSummaryFrontier.

func (*MockOutboundMsgBuilderMockRecorder) Handshake added in v1.10.18

func (mr *MockOutboundMsgBuilderMockRecorder) Handshake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14 any) *gomock.Call

Handshake indicates an expected call of Handshake.

func (*MockOutboundMsgBuilderMockRecorder) PeerList added in v1.9.4

func (mr *MockOutboundMsgBuilderMockRecorder) PeerList(arg0, arg1 any) *gomock.Call

PeerList indicates an expected call of PeerList.

func (*MockOutboundMsgBuilderMockRecorder) Ping added in v1.9.4

func (mr *MockOutboundMsgBuilderMockRecorder) Ping(arg0, arg1 any) *gomock.Call

Ping indicates an expected call of Ping.

func (*MockOutboundMsgBuilderMockRecorder) Pong added in v1.9.4

Pong indicates an expected call of Pong.

func (*MockOutboundMsgBuilderMockRecorder) PullQuery added in v1.9.4

func (mr *MockOutboundMsgBuilderMockRecorder) PullQuery(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call

PullQuery indicates an expected call of PullQuery.

func (*MockOutboundMsgBuilderMockRecorder) PushQuery added in v1.9.4

func (mr *MockOutboundMsgBuilderMockRecorder) PushQuery(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call

PushQuery indicates an expected call of PushQuery.

func (*MockOutboundMsgBuilderMockRecorder) Put added in v1.9.4

func (mr *MockOutboundMsgBuilderMockRecorder) Put(arg0, arg1, arg2 any) *gomock.Call

Put indicates an expected call of Put.

func (*MockOutboundMsgBuilderMockRecorder) StateSummaryFrontier added in v1.9.4

func (mr *MockOutboundMsgBuilderMockRecorder) StateSummaryFrontier(arg0, arg1, arg2 any) *gomock.Call

StateSummaryFrontier indicates an expected call of StateSummaryFrontier.

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
	// Cross chain:
	CrossChainAppRequestOp
	CrossChainAppErrorOp
	CrossChainAppResponseOp
	// Internal:
	ConnectedOp
	ConnectedSubnetOp
	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)

func ToOp added in v1.9.2

func ToOp(m *p2p.Message) (Op, error)

func (Op) String

func (op Op) String() string

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,
	) (OutboundMessage, error)

	GetPeerList(
		knownPeersFilter []byte,
		knownPeersSalt []byte,
	) (OutboundMessage, error)

	PeerList(
		peers []*ips.ClaimedIPPort,
		bypassThrottling bool,
	) (OutboundMessage, error)

	Ping(
		primaryUptime uint32,
		subnetUptimes []*p2p.SubnetUptime,
	) (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,
	) (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

type Timeout

type Timeout struct{}

func (Timeout) String added in v1.10.3

func (Timeout) String() string

type VMMessage

type VMMessage struct {
	Notification uint32 `json:"notification,omitempty"`
}

func (*VMMessage) String added in v1.10.3

func (m *VMMessage) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL