pb

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmptyResponse = errors.New("received empty reponse from peer")
View Source
var File_p2p_pb_quai_messages_proto protoreflect.FileDescriptor

Functions

func ConvertAndMarshal

func ConvertAndMarshal(data interface{}) ([]byte, error)

Converts a custom go type to a proto type and marhsals it into a protobuf message

func DecodeQuaiRequest

func DecodeQuaiRequest(reqMsg *QuaiRequestMessage) (uint32, interface{}, common.Location, interface{}, error)

DecodeRequestMessage unmarshals a protobuf message into a Quai Request. Returns:

  1. The request ID
  2. The decoded type (i.e. *types.Header, *types.Block, etc)
  3. The location
  4. The request data
  5. An error

func DecodeQuaiResponse

func DecodeQuaiResponse(respMsg *QuaiResponseMessage) (uint32, interface{}, error)

Unmarshals a serialized protobuf message into a Quai Response message. Returns:

  1. The request ID
  2. The decoded type (i.e. *types.Header, *types.Block, etc)
  3. An error

func EncodeQuaiRequest

func EncodeQuaiRequest(id uint32, location common.Location, reqData interface{}, respDataType interface{}) ([]byte, error)

EncodeRequestMessage creates a marshaled protobuf message for a Quai Request. Returns the serialized protobuf message.

func EncodeQuaiResponse

func EncodeQuaiResponse(id uint32, location common.Location, respDataType interface{}, data interface{}) ([]byte, error)

EncodeResponse creates a marshaled protobuf message for a Quai Response. Returns the serialized protobuf message.

func UnmarshalAndConvert

func UnmarshalAndConvert(data []byte, sourceLocation common.Location, dataPtr *interface{}, datatype interface{}) error

Unmarshals a protobuf message into a proto type and converts it to a custom go type

Types

type GossipTransaction

type GossipTransaction struct {
	Transaction *types.ProtoTransaction `protobuf:"bytes,1,opt,name=transaction,proto3" json:"transaction,omitempty"`
	// contains filtered or unexported fields
}

func (*GossipTransaction) Descriptor deprecated

func (*GossipTransaction) Descriptor() ([]byte, []int)

Deprecated: Use GossipTransaction.ProtoReflect.Descriptor instead.

func (*GossipTransaction) GetTransaction

func (x *GossipTransaction) GetTransaction() *types.ProtoTransaction

func (*GossipTransaction) ProtoMessage

func (*GossipTransaction) ProtoMessage()

func (*GossipTransaction) ProtoReflect

func (x *GossipTransaction) ProtoReflect() protoreflect.Message

func (*GossipTransaction) Reset

func (x *GossipTransaction) Reset()

func (*GossipTransaction) String

func (x *GossipTransaction) String() string

type GossipWorkObject

type GossipWorkObject struct {
	WorkObject *types.ProtoWorkObject `protobuf:"bytes,1,opt,name=work_object,json=workObject,proto3" json:"work_object,omitempty"`
	// contains filtered or unexported fields
}

GossipSub messages for broadcasting blocks and transactions

func (*GossipWorkObject) Descriptor deprecated

func (*GossipWorkObject) Descriptor() ([]byte, []int)

Deprecated: Use GossipWorkObject.ProtoReflect.Descriptor instead.

func (*GossipWorkObject) GetWorkObject

func (x *GossipWorkObject) GetWorkObject() *types.ProtoWorkObject

func (*GossipWorkObject) ProtoMessage

func (*GossipWorkObject) ProtoMessage()

func (*GossipWorkObject) ProtoReflect

func (x *GossipWorkObject) ProtoReflect() protoreflect.Message

func (*GossipWorkObject) Reset

func (x *GossipWorkObject) Reset()

func (*GossipWorkObject) String

func (x *GossipWorkObject) String() string

type QuaiMessage

type QuaiMessage struct {

	// Types that are assignable to Payload:
	//
	//	*QuaiMessage_Request
	//	*QuaiMessage_Response
	Payload isQuaiMessage_Payload `protobuf_oneof:"payload"`
	// contains filtered or unexported fields
}

func DecodeQuaiMessage

func DecodeQuaiMessage(data []byte) (*QuaiMessage, error)

func (*QuaiMessage) Descriptor deprecated

func (*QuaiMessage) Descriptor() ([]byte, []int)

Deprecated: Use QuaiMessage.ProtoReflect.Descriptor instead.

func (*QuaiMessage) GetPayload

func (m *QuaiMessage) GetPayload() isQuaiMessage_Payload

func (*QuaiMessage) GetRequest

func (x *QuaiMessage) GetRequest() *QuaiRequestMessage

func (*QuaiMessage) GetResponse

func (x *QuaiMessage) GetResponse() *QuaiResponseMessage

func (*QuaiMessage) ProtoMessage

func (*QuaiMessage) ProtoMessage()

func (*QuaiMessage) ProtoReflect

func (x *QuaiMessage) ProtoReflect() protoreflect.Message

func (*QuaiMessage) Reset

func (x *QuaiMessage) Reset()

func (*QuaiMessage) String

func (x *QuaiMessage) String() string

type QuaiMessage_Request

type QuaiMessage_Request struct {
	Request *QuaiRequestMessage `protobuf:"bytes,1,opt,name=request,proto3,oneof"`
}

type QuaiMessage_Response

type QuaiMessage_Response struct {
	Response *QuaiResponseMessage `protobuf:"bytes,2,opt,name=response,proto3,oneof"`
}

type QuaiRequestMessage

type QuaiRequestMessage struct {
	Id       uint32                `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Location *common.ProtoLocation `protobuf:"bytes,2,opt,name=location,proto3" json:"location,omitempty"`
	// Types that are assignable to Data:
	//
	//	*QuaiRequestMessage_Hash
	//	*QuaiRequestMessage_Number
	Data isQuaiRequestMessage_Data `protobuf_oneof:"data"`
	// Types that are assignable to Request:
	//
	//	*QuaiRequestMessage_WorkObjectBlock
	//	*QuaiRequestMessage_WorkObjectBlocks
	//	*QuaiRequestMessage_WorkObjectHeader
	//	*QuaiRequestMessage_BlockHash
	Request isQuaiRequestMessage_Request `protobuf_oneof:"request"`
	// contains filtered or unexported fields
}

QuaiRequestMessage is the main 'envelope' for QuaiProtocol request messages

func (*QuaiRequestMessage) Descriptor deprecated

func (*QuaiRequestMessage) Descriptor() ([]byte, []int)

Deprecated: Use QuaiRequestMessage.ProtoReflect.Descriptor instead.

func (*QuaiRequestMessage) GetBlockHash

func (x *QuaiRequestMessage) GetBlockHash() *common.ProtoHash

func (*QuaiRequestMessage) GetData

func (m *QuaiRequestMessage) GetData() isQuaiRequestMessage_Data

func (*QuaiRequestMessage) GetHash

func (x *QuaiRequestMessage) GetHash() *common.ProtoHash

func (*QuaiRequestMessage) GetId

func (x *QuaiRequestMessage) GetId() uint32

func (*QuaiRequestMessage) GetLocation

func (x *QuaiRequestMessage) GetLocation() *common.ProtoLocation

func (*QuaiRequestMessage) GetNumber

func (x *QuaiRequestMessage) GetNumber() []byte

func (*QuaiRequestMessage) GetRequest

func (m *QuaiRequestMessage) GetRequest() isQuaiRequestMessage_Request

func (*QuaiRequestMessage) GetWorkObjectBlock

func (x *QuaiRequestMessage) GetWorkObjectBlock() *types.ProtoWorkObjectBlockView

func (*QuaiRequestMessage) GetWorkObjectBlocks added in v0.31.0

func (x *QuaiRequestMessage) GetWorkObjectBlocks() *types.ProtoWorkObjectBlocksView

func (*QuaiRequestMessage) GetWorkObjectHeader

func (x *QuaiRequestMessage) GetWorkObjectHeader() *types.ProtoWorkObjectHeaderView

func (*QuaiRequestMessage) ProtoMessage

func (*QuaiRequestMessage) ProtoMessage()

func (*QuaiRequestMessage) ProtoReflect

func (x *QuaiRequestMessage) ProtoReflect() protoreflect.Message

func (*QuaiRequestMessage) Reset

func (x *QuaiRequestMessage) Reset()

func (*QuaiRequestMessage) String

func (x *QuaiRequestMessage) String() string

type QuaiRequestMessage_BlockHash

type QuaiRequestMessage_BlockHash struct {
	BlockHash *common.ProtoHash `protobuf:"bytes,8,opt,name=block_hash,json=blockHash,proto3,oneof"`
}

type QuaiRequestMessage_Hash

type QuaiRequestMessage_Hash struct {
	Hash *common.ProtoHash `protobuf:"bytes,3,opt,name=hash,proto3,oneof"`
}

type QuaiRequestMessage_Number

type QuaiRequestMessage_Number struct {
	Number []byte `protobuf:"bytes,4,opt,name=number,proto3,oneof"`
}

type QuaiRequestMessage_WorkObjectBlock

type QuaiRequestMessage_WorkObjectBlock struct {
	WorkObjectBlock *types.ProtoWorkObjectBlockView `protobuf:"bytes,5,opt,name=work_object_block,json=workObjectBlock,proto3,oneof"`
}

type QuaiRequestMessage_WorkObjectBlocks added in v0.31.0

type QuaiRequestMessage_WorkObjectBlocks struct {
	WorkObjectBlocks *types.ProtoWorkObjectBlocksView `protobuf:"bytes,6,opt,name=work_object_blocks,json=workObjectBlocks,proto3,oneof"`
}

type QuaiRequestMessage_WorkObjectHeader

type QuaiRequestMessage_WorkObjectHeader struct {
	WorkObjectHeader *types.ProtoWorkObjectHeaderView `protobuf:"bytes,7,opt,name=work_object_header,json=workObjectHeader,proto3,oneof"`
}

type QuaiResponseMessage

type QuaiResponseMessage struct {
	Id       uint32                `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Location *common.ProtoLocation `protobuf:"bytes,2,opt,name=location,proto3" json:"location,omitempty"`
	// Types that are assignable to Response:
	//
	//	*QuaiResponseMessage_WorkObjectHeaderView
	//	*QuaiResponseMessage_WorkObjectBlockView
	//	*QuaiResponseMessage_WorkObjectBlocksView
	//	*QuaiResponseMessage_BlockHash
	Response isQuaiResponseMessage_Response `protobuf_oneof:"response"`
	// contains filtered or unexported fields
}

QuaiResponseMessage is the main 'envelope' for QuaiProtocol response messages

func (*QuaiResponseMessage) Descriptor deprecated

func (*QuaiResponseMessage) Descriptor() ([]byte, []int)

Deprecated: Use QuaiResponseMessage.ProtoReflect.Descriptor instead.

func (*QuaiResponseMessage) GetBlockHash

func (x *QuaiResponseMessage) GetBlockHash() *common.ProtoHash

func (*QuaiResponseMessage) GetId

func (x *QuaiResponseMessage) GetId() uint32

func (*QuaiResponseMessage) GetLocation

func (x *QuaiResponseMessage) GetLocation() *common.ProtoLocation

func (*QuaiResponseMessage) GetResponse

func (m *QuaiResponseMessage) GetResponse() isQuaiResponseMessage_Response

func (*QuaiResponseMessage) GetWorkObjectBlockView

func (x *QuaiResponseMessage) GetWorkObjectBlockView() *types.ProtoWorkObjectBlockView

func (*QuaiResponseMessage) GetWorkObjectBlocksView added in v0.31.0

func (x *QuaiResponseMessage) GetWorkObjectBlocksView() *types.ProtoWorkObjectBlocksView

func (*QuaiResponseMessage) GetWorkObjectHeaderView

func (x *QuaiResponseMessage) GetWorkObjectHeaderView() *types.ProtoWorkObjectHeaderView

func (*QuaiResponseMessage) ProtoMessage

func (*QuaiResponseMessage) ProtoMessage()

func (*QuaiResponseMessage) ProtoReflect

func (x *QuaiResponseMessage) ProtoReflect() protoreflect.Message

func (*QuaiResponseMessage) Reset

func (x *QuaiResponseMessage) Reset()

func (*QuaiResponseMessage) String

func (x *QuaiResponseMessage) String() string

type QuaiResponseMessage_BlockHash

type QuaiResponseMessage_BlockHash struct {
	BlockHash *common.ProtoHash `protobuf:"bytes,6,opt,name=block_hash,json=blockHash,proto3,oneof"`
}

type QuaiResponseMessage_WorkObjectBlockView

type QuaiResponseMessage_WorkObjectBlockView struct {
	WorkObjectBlockView *types.ProtoWorkObjectBlockView `protobuf:"bytes,4,opt,name=work_object_block_view,json=workObjectBlockView,proto3,oneof"`
}

type QuaiResponseMessage_WorkObjectBlocksView added in v0.31.0

type QuaiResponseMessage_WorkObjectBlocksView struct {
	WorkObjectBlocksView *types.ProtoWorkObjectBlocksView `protobuf:"bytes,5,opt,name=work_object_blocks_view,json=workObjectBlocksView,proto3,oneof"`
}

type QuaiResponseMessage_WorkObjectHeaderView

type QuaiResponseMessage_WorkObjectHeaderView struct {
	WorkObjectHeaderView *types.ProtoWorkObjectHeaderView `protobuf:"bytes,3,opt,name=work_object_header_view,json=workObjectHeaderView,proto3,oneof"`
}

Jump to

Keyboard shortcuts

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