message

package
v1.0.0-sammy Latest Latest
Warning

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

Go to latest
Published: May 26, 2024 License: BSD-3-Clause Imports: 18 Imported by: 0

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

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

func GetDeadline

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

func GetEngineType

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

func GetRequestID

func GetRequestID(m any) (uint32, bool)

func GetSourceChainID

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

func Unwrap

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

Types

type Connected

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

func (*Connected) String

func (m *Connected) String() string

type ConnectedSubnet

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

func (m *ConnectedSubnet) String() string

type Creator

type Creator interface {
	OutboundMsgBuilder
	InboundMsgBuilder
}

func NewCreator

func NewCreator(
	log logging.Logger,
	metrics prometheus.Registerer,
	parentNamespace string,
	compressionType compression.Type,
	maxMessageTimeout time.Duration,
) (Creator, error)

type CrossChainAppRequest

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

func (m *CrossChainAppRequest) GetChainId() []byte

func (*CrossChainAppRequest) GetRequestId

func (m *CrossChainAppRequest) GetRequestId() uint32

func (*CrossChainAppRequest) GetSourceChainID

func (m *CrossChainAppRequest) GetSourceChainID() ids.ID

func (*CrossChainAppRequest) String

func (m *CrossChainAppRequest) String() string

type CrossChainAppRequestFailed

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

func (m *CrossChainAppRequestFailed) GetChainId() []byte

func (*CrossChainAppRequestFailed) GetRequestId

func (m *CrossChainAppRequestFailed) GetRequestId() uint32

func (*CrossChainAppRequestFailed) GetSourceChainID

func (m *CrossChainAppRequestFailed) GetSourceChainID() ids.ID

func (*CrossChainAppRequestFailed) String

func (m *CrossChainAppRequestFailed) String() string

type CrossChainAppResponse

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

func (m *CrossChainAppResponse) GetChainId() []byte

func (*CrossChainAppResponse) GetRequestId

func (m *CrossChainAppResponse) GetRequestId() uint32

func (*CrossChainAppResponse) GetSourceChainID

func (m *CrossChainAppResponse) GetSourceChainID() ids.ID

func (*CrossChainAppResponse) String

func (m *CrossChainAppResponse) String() string

type Disconnected

type Disconnected struct{}

func (Disconnected) String

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

func (m *GetAcceptedFailed) GetChainId() []byte

func (*GetAcceptedFailed) GetRequestId

func (m *GetAcceptedFailed) GetRequestId() uint32

func (*GetAcceptedFailed) String

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

func (m *GetAcceptedFrontierFailed) GetChainId() []byte

func (*GetAcceptedFrontierFailed) GetRequestId

func (m *GetAcceptedFrontierFailed) GetRequestId() uint32

func (*GetAcceptedFrontierFailed) String

func (m *GetAcceptedFrontierFailed) String() string

type GetAcceptedStateSummaryFailed

type GetAcceptedStateSummaryFailed struct {
	ChainID   ids.ID `json:"chain_id,omitempty"`
	RequestID uint32 `json:"request_id,omitempty"`
}

func (*GetAcceptedStateSummaryFailed) GetChainId

func (m *GetAcceptedStateSummaryFailed) GetChainId() []byte

func (*GetAcceptedStateSummaryFailed) GetRequestId

func (m *GetAcceptedStateSummaryFailed) GetRequestId() uint32

func (*GetAcceptedStateSummaryFailed) 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

func (m *GetAncestorsFailed) GetChainId() []byte

func (*GetAncestorsFailed) GetEngineType

func (m *GetAncestorsFailed) GetEngineType() p2p.EngineType

func (*GetAncestorsFailed) GetRequestId

func (m *GetAncestorsFailed) GetRequestId() uint32

func (*GetAncestorsFailed) String

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

func (m *GetFailed) GetChainId() []byte

func (*GetFailed) GetRequestId

func (m *GetFailed) GetRequestId() uint32

func (*GetFailed) String

func (m *GetFailed) String() string

type GetStateSummaryFrontierFailed

type GetStateSummaryFrontierFailed struct {
	ChainID   ids.ID `json:"chain_id,omitempty"`
	RequestID uint32 `json:"request_id,omitempty"`
}

func (*GetStateSummaryFrontierFailed) GetChainId

func (m *GetStateSummaryFrontierFailed) GetChainId() []byte

func (*GetStateSummaryFrontierFailed) GetRequestId

func (m *GetStateSummaryFrontierFailed) GetRequestId() uint32

func (*GetStateSummaryFrontierFailed) String

type GossipRequest

type GossipRequest struct{}

func (GossipRequest) String

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

func InboundAccepted(
	chainID ids.ID,
	requestID uint32,
	containerIDs []ids.ID,
	nodeID ids.NodeID,
) InboundMessage

func InboundAcceptedFrontier

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

func InboundAcceptedStateSummary

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

func InboundAppError

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

func InboundAppRequest

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

func InboundAppResponse

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

func InboundChits

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

func InboundGetAccepted

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

func InboundGetAcceptedFrontier

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

func InboundGetAcceptedStateSummary

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

func InboundGetStateSummaryFrontier

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

func InboundPullQuery

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

func InboundPushQuery

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

func InboundStateSummaryFrontier

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

func InternalConnected

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

func InternalConnectedSubnet

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

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

func InternalCrossChainAppRequest

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

func InternalCrossChainAppResponse

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

func InternalDisconnected

func InternalDisconnected(nodeID ids.NodeID) InboundMessage

func InternalGetAcceptedFailed

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

func InternalGetAcceptedFrontierFailed

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

func InternalGetAcceptedStateSummaryFailed

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

func InternalGetAncestorsFailed

func InternalGetAncestorsFailed(
	nodeID ids.NodeID,
	chainID ids.ID,
	requestID uint32,
	engineType p2p.EngineType,
) InboundMessage

func InternalGetFailed

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

func InternalGetStateSummaryFrontierFailed

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

func InternalGossipRequest

func InternalGossipRequest(
	nodeID ids.NodeID,
) InboundMessage

func InternalQueryFailed

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

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

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

func (*MockOutboundMessage) Op

func (m *MockOutboundMessage) Op() Op

Op mocks base method.

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

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

Op indicates an expected call of Op.

type MockOutboundMsgBuilder

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

MockOutboundMsgBuilder is a mock of OutboundMsgBuilder interface.

func NewMockOutboundMsgBuilder

func NewMockOutboundMsgBuilder(ctrl *gomock.Controller) *MockOutboundMsgBuilder

NewMockOutboundMsgBuilder creates a new mock instance.

func (*MockOutboundMsgBuilder) Accepted

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

Accepted mocks base method.

func (*MockOutboundMsgBuilder) AcceptedFrontier

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

AcceptedFrontier mocks base method.

func (*MockOutboundMsgBuilder) AcceptedStateSummary

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

AcceptedStateSummary mocks base method.

func (*MockOutboundMsgBuilder) Ancestors

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

Ancestors mocks base method.

func (*MockOutboundMsgBuilder) AppError

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

AppError mocks base method.

func (*MockOutboundMsgBuilder) AppGossip

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

AppGossip mocks base method.

func (*MockOutboundMsgBuilder) AppRequest

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

AppRequest mocks base method.

func (*MockOutboundMsgBuilder) AppResponse

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

AppResponse mocks base method.

func (*MockOutboundMsgBuilder) Chits

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

Chits mocks base method.

func (*MockOutboundMsgBuilder) EXPECT

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

func (*MockOutboundMsgBuilder) Get

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

Get mocks base method.

func (*MockOutboundMsgBuilder) GetAccepted

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

GetAccepted mocks base method.

func (*MockOutboundMsgBuilder) GetAcceptedFrontier

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

GetAcceptedFrontier mocks base method.

func (*MockOutboundMsgBuilder) GetAcceptedStateSummary

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

GetAcceptedStateSummary mocks base method.

func (*MockOutboundMsgBuilder) GetAncestors

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

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

GetPeerList mocks base method.

func (*MockOutboundMsgBuilder) GetStateSummaryFrontier

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

GetStateSummaryFrontier mocks base method.

func (*MockOutboundMsgBuilder) Handshake

func (m *MockOutboundMsgBuilder) Handshake(arg0 uint32, arg1 uint64, arg2 ips.IPPort, 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

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

PeerList mocks base method.

func (*MockOutboundMsgBuilder) Ping

Ping mocks base method.

func (*MockOutboundMsgBuilder) Pong

Pong mocks base method.

func (*MockOutboundMsgBuilder) PullQuery

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

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

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

Put mocks base method.

func (*MockOutboundMsgBuilder) StateSummaryFrontier

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

StateSummaryFrontier mocks base method.

type MockOutboundMsgBuilderMockRecorder

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

MockOutboundMsgBuilderMockRecorder is the mock recorder for MockOutboundMsgBuilder.

func (*MockOutboundMsgBuilderMockRecorder) Accepted

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

Accepted indicates an expected call of Accepted.

func (*MockOutboundMsgBuilderMockRecorder) AcceptedFrontier

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

AcceptedFrontier indicates an expected call of AcceptedFrontier.

func (*MockOutboundMsgBuilderMockRecorder) AcceptedStateSummary

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

AcceptedStateSummary indicates an expected call of AcceptedStateSummary.

func (*MockOutboundMsgBuilderMockRecorder) Ancestors

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

Ancestors indicates an expected call of Ancestors.

func (*MockOutboundMsgBuilderMockRecorder) AppError

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

AppError indicates an expected call of AppError.

func (*MockOutboundMsgBuilderMockRecorder) AppGossip

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

AppGossip indicates an expected call of AppGossip.

func (*MockOutboundMsgBuilderMockRecorder) AppRequest

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

AppRequest indicates an expected call of AppRequest.

func (*MockOutboundMsgBuilderMockRecorder) AppResponse

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

AppResponse indicates an expected call of AppResponse.

func (*MockOutboundMsgBuilderMockRecorder) Chits

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

Chits indicates an expected call of Chits.

func (*MockOutboundMsgBuilderMockRecorder) Get

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

Get indicates an expected call of Get.

func (*MockOutboundMsgBuilderMockRecorder) GetAccepted

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

GetAccepted indicates an expected call of GetAccepted.

func (*MockOutboundMsgBuilderMockRecorder) GetAcceptedFrontier

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

GetAcceptedFrontier indicates an expected call of GetAcceptedFrontier.

func (*MockOutboundMsgBuilderMockRecorder) GetAcceptedStateSummary

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

GetAcceptedStateSummary indicates an expected call of GetAcceptedStateSummary.

func (*MockOutboundMsgBuilderMockRecorder) GetAncestors

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

GetAncestors indicates an expected call of GetAncestors.

func (*MockOutboundMsgBuilderMockRecorder) GetPeerList

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

GetPeerList indicates an expected call of GetPeerList.

func (*MockOutboundMsgBuilderMockRecorder) GetStateSummaryFrontier

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

GetStateSummaryFrontier indicates an expected call of GetStateSummaryFrontier.

func (*MockOutboundMsgBuilderMockRecorder) Handshake

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

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

PeerList indicates an expected call of PeerList.

func (*MockOutboundMsgBuilderMockRecorder) Ping

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

Ping indicates an expected call of Ping.

func (*MockOutboundMsgBuilderMockRecorder) Pong

Pong indicates an expected call of Pong.

func (*MockOutboundMsgBuilderMockRecorder) PullQuery

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

PullQuery indicates an expected call of PullQuery.

func (*MockOutboundMsgBuilderMockRecorder) PushQuery

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

PushQuery indicates an expected call of PushQuery.

func (*MockOutboundMsgBuilderMockRecorder) Put

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

Put indicates an expected call of Put.

func (*MockOutboundMsgBuilderMockRecorder) StateSummaryFrontier

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

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 ips.IPPort,
		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

func (m *QueryFailed) GetChainId() []byte

func (*QueryFailed) GetRequestId

func (m *QueryFailed) GetRequestId() uint32

func (*QueryFailed) String

func (m *QueryFailed) String() string

type Timeout

type Timeout struct{}

func (Timeout) String

func (Timeout) String() string

type VMMessage

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

func (*VMMessage) String

func (m *VMMessage) String() string

Jump to

Keyboard shortcuts

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