pbbstream

package
v0.0.2-0...-ec8d376 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BlockStream_Blocks_FullMethodName = "/sf.bstream.v1.BlockStream/Blocks"
)

Variables

View Source
var (
	ForkStep_name = map[int32]string{
		0: "STEP_UNKNOWN",
		1: "STEP_NEW",
		2: "STEP_UNDO",
		4: "STEP_IRREVERSIBLE",
	}
	ForkStep_value = map[string]int32{
		"STEP_UNKNOWN":      0,
		"STEP_NEW":          1,
		"STEP_UNDO":         2,
		"STEP_IRREVERSIBLE": 4,
	}
)

Enum value maps for ForkStep.

View Source
var (
	Protocol_name = map[int32]string{
		0: "UNKNOWN",
		1: "EOS",
		2: "ETH",
		3: "SOLANA",
		4: "NEAR",
		5: "COSMOS",
	}
	Protocol_value = map[string]int32{
		"UNKNOWN": 0,
		"EOS":     1,
		"ETH":     2,
		"SOLANA":  3,
		"NEAR":    4,
		"COSMOS":  5,
	}
)

Enum value maps for Protocol.

View Source
var (
	BlockRequest_Order_name = map[int32]string{
		0: "UNSPECIFIED",
		1: "ORDERED",
		2: "UNORDERED",
	}
	BlockRequest_Order_value = map[string]int32{
		"UNSPECIFIED": 0,
		"ORDERED":     1,
		"UNORDERED":   2,
	}
)

Enum value maps for BlockRequest_Order.

View Source
var BlockStream_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "sf.bstream.v1.BlockStream",
	HandlerType: (*BlockStreamServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Blocks",
			Handler:       _BlockStream_Blocks_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "sf/bstream/v1/bstream.proto",
}

BlockStream_ServiceDesc is the grpc.ServiceDesc for BlockStream service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var File_sf_bstream_v1_bstream_proto protoreflect.FileDescriptor

Functions

func RegisterBlockStreamServer

func RegisterBlockStreamServer(s grpc.ServiceRegistrar, srv BlockStreamServer)

Types

type BasicBlockRef

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

func (BasicBlockRef) ID

func (e BasicBlockRef) ID() string

func (BasicBlockRef) Num

func (e BasicBlockRef) Num() uint64

func (BasicBlockRef) String

func (e BasicBlockRef) String() string

type Block

type Block struct {
	Number    uint64                 `protobuf:"varint,1,opt,name=number,proto3" json:"number,omitempty"`
	Id        string                 `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
	ParentId  string                 `protobuf:"bytes,3,opt,name=parent_id,json=parentId,proto3" json:"parent_id,omitempty"`
	Timestamp *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	LibNum    uint64                 `protobuf:"varint,5,opt,name=lib_num,json=libNum,proto3" json:"lib_num,omitempty"`
	// Deprecated: Marked as deprecated in sf/bstream/v1/bstream.proto.
	PayloadKind Protocol `protobuf:"varint,6,opt,name=payload_kind,json=payloadKind,proto3,enum=sf.bstream.v1.Protocol" json:"payload_kind,omitempty"`
	// Deprecated: Marked as deprecated in sf/bstream/v1/bstream.proto.
	PayloadVersion int32 `protobuf:"varint,7,opt,name=payload_version,json=payloadVersion,proto3" json:"payload_version,omitempty"`
	// Deprecated: Marked as deprecated in sf/bstream/v1/bstream.proto.
	PayloadBuffer []byte `protobuf:"bytes,8,opt,name=payload_buffer,json=payloadBuffer,proto3" json:"payload_buffer,omitempty"`
	// Deprecated: Marked as deprecated in sf/bstream/v1/bstream.proto.
	HeadNum   uint64     `protobuf:"varint,9,opt,name=head_num,json=headNum,proto3" json:"head_num,omitempty"`
	ParentNum uint64     `protobuf:"varint,10,opt,name=parent_num,json=parentNum,proto3" json:"parent_num,omitempty"`
	Payload   *anypb.Any `protobuf:"bytes,11,opt,name=payload,proto3" json:"payload,omitempty"`
	// contains filtered or unexported fields
}

Block is the chain agnostic representation of a block. It contains the block metadata like num, hash, parent num, etc as well as containing the payload.

**Required** Any changes to non-payload field on this object must be reflected in `BlockMeta` as well!

func (*Block) AsRef

func (b *Block) AsRef() BasicBlockRef

func (*Block) Descriptor deprecated

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

Deprecated: Use Block.ProtoReflect.Descriptor instead.

func (*Block) GetFirehoseBlockID

func (b *Block) GetFirehoseBlockID() string

func (*Block) GetFirehoseBlockNumber

func (b *Block) GetFirehoseBlockNumber() uint64

func (*Block) GetFirehoseBlockParentID

func (b *Block) GetFirehoseBlockParentID() string

func (*Block) GetFirehoseBlockParentNumber

func (b *Block) GetFirehoseBlockParentNumber() uint64

func (*Block) GetFirehoseBlockTime

func (b *Block) GetFirehoseBlockTime() time.Time

func (*Block) GetHeadNum deprecated

func (x *Block) GetHeadNum() uint64

Deprecated: Marked as deprecated in sf/bstream/v1/bstream.proto.

func (*Block) GetId

func (x *Block) GetId() string

func (*Block) GetLibNum

func (x *Block) GetLibNum() uint64

func (*Block) GetNumber

func (x *Block) GetNumber() uint64

func (*Block) GetParentId

func (x *Block) GetParentId() string

func (*Block) GetParentNum

func (x *Block) GetParentNum() uint64

func (*Block) GetPayload

func (x *Block) GetPayload() *anypb.Any

func (*Block) GetPayloadBuffer deprecated

func (x *Block) GetPayloadBuffer() []byte

Deprecated: Marked as deprecated in sf/bstream/v1/bstream.proto.

func (*Block) GetPayloadKind deprecated

func (x *Block) GetPayloadKind() Protocol

Deprecated: Marked as deprecated in sf/bstream/v1/bstream.proto.

func (*Block) GetPayloadVersion deprecated

func (x *Block) GetPayloadVersion() int32

Deprecated: Marked as deprecated in sf/bstream/v1/bstream.proto.

func (*Block) GetTimestamp

func (x *Block) GetTimestamp() *timestamppb.Timestamp

func (*Block) PreviousRef

func (b *Block) PreviousRef() *BasicBlockRef

func (*Block) ProtoMessage

func (*Block) ProtoMessage()

func (*Block) ProtoReflect

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

func (*Block) Reset

func (x *Block) Reset()

func (*Block) String

func (x *Block) String() string

func (*Block) Time

func (b *Block) Time() time.Time

func (*Block) ToBlocKMeta

func (b *Block) ToBlocKMeta() *BlockMeta

type BlockMeta

type BlockMeta struct {
	Number    uint64                 `protobuf:"varint,1,opt,name=number,proto3" json:"number,omitempty"`
	Id        string                 `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
	ParentId  string                 `protobuf:"bytes,3,opt,name=parent_id,json=parentId,proto3" json:"parent_id,omitempty"`
	Timestamp *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	LibNum    uint64                 `protobuf:"varint,5,opt,name=lib_num,json=libNum,proto3" json:"lib_num,omitempty"`
	ParentNum uint64                 `protobuf:"varint,10,opt,name=parent_num,json=parentNum,proto3" json:"parent_num,omitempty"`
	// contains filtered or unexported fields
}

BlockMeta is strictly equivalent to Block, except that it doesn't contain the payload nor any field related to payload.

First, it's used to store block meta information on disk or on a KV store. Second, it serves the purpose of being a lighter version of Block, that can to `proto.Unmarshal` a real `Block` while ignoring the payload.

**Required** Alignment of the fields in this struct is **required** to be the same as `Block` to allow for `proto.Unmarshal` to work.

func (*BlockMeta) Descriptor deprecated

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

Deprecated: Use BlockMeta.ProtoReflect.Descriptor instead.

func (*BlockMeta) GetId

func (x *BlockMeta) GetId() string

func (*BlockMeta) GetLibNum

func (x *BlockMeta) GetLibNum() uint64

func (*BlockMeta) GetNumber

func (x *BlockMeta) GetNumber() uint64

func (*BlockMeta) GetParentId

func (x *BlockMeta) GetParentId() string

func (*BlockMeta) GetParentNum

func (x *BlockMeta) GetParentNum() uint64

func (*BlockMeta) GetTimestamp

func (x *BlockMeta) GetTimestamp() *timestamppb.Timestamp

func (*BlockMeta) ProtoMessage

func (*BlockMeta) ProtoMessage()

func (*BlockMeta) ProtoReflect

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

func (*BlockMeta) Reset

func (x *BlockMeta) Reset()

func (*BlockMeta) String

func (x *BlockMeta) String() string

type BlockRef

type BlockRef struct {
	Num uint64 `protobuf:"varint,1,opt,name=num,proto3" json:"num,omitempty"`
	Id  string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*BlockRef) Descriptor deprecated

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

Deprecated: Use BlockRef.ProtoReflect.Descriptor instead.

func (*BlockRef) GetId

func (x *BlockRef) GetId() string

func (*BlockRef) GetNum

func (x *BlockRef) GetNum() uint64

func (*BlockRef) ProtoMessage

func (*BlockRef) ProtoMessage()

func (*BlockRef) ProtoReflect

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

func (*BlockRef) Reset

func (x *BlockRef) Reset()

func (*BlockRef) String

func (x *BlockRef) String() string

type BlockRequest

type BlockRequest struct {

	// Number of blocks we want to get in burst upon connection, on a best effort basis.
	// -1 means "LIB"
	// any other "-X" value means "start at block X"
	Burst int64 `protobuf:"varint,1,opt,name=burst,proto3" json:"burst,omitempty"`
	// Type of blocks we're after here, is it 'ethereum' data, 'eos', etc.. The server can fail early
	// if he doesn't match the data he serves (services mismatch, etc..)
	ContentType string             `protobuf:"bytes,2,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"`
	Order       BlockRequest_Order `protobuf:"varint,3,opt,name=order,proto3,enum=sf.bstream.v1.BlockRequest_Order" json:"order,omitempty"`
	Requester   string             `protobuf:"bytes,4,opt,name=requester,proto3" json:"requester,omitempty"`
	// contains filtered or unexported fields
}

func (*BlockRequest) Descriptor deprecated

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

Deprecated: Use BlockRequest.ProtoReflect.Descriptor instead.

func (*BlockRequest) GetBurst

func (x *BlockRequest) GetBurst() int64

func (*BlockRequest) GetContentType

func (x *BlockRequest) GetContentType() string

func (*BlockRequest) GetOrder

func (x *BlockRequest) GetOrder() BlockRequest_Order

func (*BlockRequest) GetRequester

func (x *BlockRequest) GetRequester() string

func (*BlockRequest) ProtoMessage

func (*BlockRequest) ProtoMessage()

func (*BlockRequest) ProtoReflect

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

func (*BlockRequest) Reset

func (x *BlockRequest) Reset()

func (*BlockRequest) String

func (x *BlockRequest) String() string

type BlockRequest_Order

type BlockRequest_Order int32

Whether we can assume the data will come ordered, unless there is a chain reorganization. mindreaders output ordered data, whereas relayers can output unordered data. The server can fail early if the assumption of the caller cannot be fulfilled.

const (
	BlockRequest_UNSPECIFIED BlockRequest_Order = 0
	BlockRequest_ORDERED     BlockRequest_Order = 1
	BlockRequest_UNORDERED   BlockRequest_Order = 2
)

func (BlockRequest_Order) Descriptor

func (BlockRequest_Order) Enum

func (BlockRequest_Order) EnumDescriptor deprecated

func (BlockRequest_Order) EnumDescriptor() ([]byte, []int)

Deprecated: Use BlockRequest_Order.Descriptor instead.

func (BlockRequest_Order) Number

func (BlockRequest_Order) String

func (x BlockRequest_Order) String() string

func (BlockRequest_Order) Type

type BlockStreamClient

type BlockStreamClient interface {
	Blocks(ctx context.Context, in *BlockRequest, opts ...grpc.CallOption) (BlockStream_BlocksClient, error)
}

BlockStreamClient is the client API for BlockStream service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

type BlockStreamServer

type BlockStreamServer interface {
	Blocks(*BlockRequest, BlockStream_BlocksServer) error
}

BlockStreamServer is the server API for BlockStream service. All implementations should embed UnimplementedBlockStreamServer for forward compatibility

type BlockStream_BlocksClient

type BlockStream_BlocksClient interface {
	Recv() (*Block, error)
	grpc.ClientStream
}

type BlockStream_BlocksServer

type BlockStream_BlocksServer interface {
	Send(*Block) error
	grpc.ServerStream
}

type Cursor

type Cursor struct {
	Block     *BlockRef `protobuf:"bytes,1,opt,name=block,proto3" json:"block,omitempty"`
	HeadBlock *BlockRef `protobuf:"bytes,2,opt,name=head_block,json=headBlock,proto3" json:"head_block,omitempty"`
	Lib       *BlockRef `protobuf:"bytes,3,opt,name=lib,proto3" json:"lib,omitempty"`
	Step      ForkStep  `protobuf:"varint,4,opt,name=step,proto3,enum=sf.bstream.v1.ForkStep" json:"step,omitempty"`
	// contains filtered or unexported fields
}

Cursor is used to generate a string cursor, currently being utilized in forkable

func (*Cursor) Descriptor deprecated

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

Deprecated: Use Cursor.ProtoReflect.Descriptor instead.

func (*Cursor) GetBlock

func (x *Cursor) GetBlock() *BlockRef

func (*Cursor) GetHeadBlock

func (x *Cursor) GetHeadBlock() *BlockRef

func (*Cursor) GetLib

func (x *Cursor) GetLib() *BlockRef

func (*Cursor) GetStep

func (x *Cursor) GetStep() ForkStep

func (*Cursor) ProtoMessage

func (*Cursor) ProtoMessage()

func (*Cursor) ProtoReflect

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

func (*Cursor) Reset

func (x *Cursor) Reset()

func (*Cursor) String

func (x *Cursor) String() string

type ForkStep

type ForkStep int32
const (
	ForkStep_STEP_UNKNOWN ForkStep = 0
	// Block is new head block of the chain, that is linear with the previous block
	ForkStep_STEP_NEW ForkStep = 1
	// Block is now forked and should be undone, it's not the head block of the chain anymore
	ForkStep_STEP_UNDO ForkStep = 2
	// Block is now irreversible and can be committed to (finality is chain specific, see chain documentation for more details)
	ForkStep_STEP_IRREVERSIBLE ForkStep = 4
)

func (ForkStep) Descriptor

func (ForkStep) Descriptor() protoreflect.EnumDescriptor

func (ForkStep) Enum

func (x ForkStep) Enum() *ForkStep

func (ForkStep) EnumDescriptor deprecated

func (ForkStep) EnumDescriptor() ([]byte, []int)

Deprecated: Use ForkStep.Descriptor instead.

func (ForkStep) Number

func (x ForkStep) Number() protoreflect.EnumNumber

func (ForkStep) String

func (x ForkStep) String() string

func (ForkStep) Type

type GenericBlockIndex

type GenericBlockIndex struct {
	Kv []*KeyToBitmap `protobuf:"bytes,4,rep,name=kv,proto3" json:"kv,omitempty"`
	// contains filtered or unexported fields
}

func (*GenericBlockIndex) Descriptor deprecated

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

Deprecated: Use GenericBlockIndex.ProtoReflect.Descriptor instead.

func (*GenericBlockIndex) GetKv

func (x *GenericBlockIndex) GetKv() []*KeyToBitmap

func (*GenericBlockIndex) ProtoMessage

func (*GenericBlockIndex) ProtoMessage()

func (*GenericBlockIndex) ProtoReflect

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

func (*GenericBlockIndex) Reset

func (x *GenericBlockIndex) Reset()

func (*GenericBlockIndex) String

func (x *GenericBlockIndex) String() string

type KeyToBitmap

type KeyToBitmap struct {
	Key    []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	Bitmap []byte `protobuf:"bytes,2,opt,name=bitmap,proto3" json:"bitmap,omitempty"`
	// contains filtered or unexported fields
}

func (*KeyToBitmap) Descriptor deprecated

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

Deprecated: Use KeyToBitmap.ProtoReflect.Descriptor instead.

func (*KeyToBitmap) GetBitmap

func (x *KeyToBitmap) GetBitmap() []byte

func (*KeyToBitmap) GetKey

func (x *KeyToBitmap) GetKey() []byte

func (*KeyToBitmap) ProtoMessage

func (*KeyToBitmap) ProtoMessage()

func (*KeyToBitmap) ProtoReflect

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

func (*KeyToBitmap) Reset

func (x *KeyToBitmap) Reset()

func (*KeyToBitmap) String

func (x *KeyToBitmap) String() string

type Protocol

type Protocol int32
const (
	Protocol_UNKNOWN Protocol = 0
	Protocol_EOS     Protocol = 1
	Protocol_ETH     Protocol = 2
	Protocol_SOLANA  Protocol = 3
	Protocol_NEAR    Protocol = 4
	Protocol_COSMOS  Protocol = 5
)

func (Protocol) Descriptor

func (Protocol) Descriptor() protoreflect.EnumDescriptor

func (Protocol) Enum

func (x Protocol) Enum() *Protocol

func (Protocol) EnumDescriptor deprecated

func (Protocol) EnumDescriptor() ([]byte, []int)

Deprecated: Use Protocol.Descriptor instead.

func (Protocol) Number

func (x Protocol) Number() protoreflect.EnumNumber

func (Protocol) String

func (x Protocol) String() string

func (Protocol) Type

type UnimplementedBlockStreamServer

type UnimplementedBlockStreamServer struct {
}

UnimplementedBlockStreamServer should be embedded to have forward compatible implementations.

func (UnimplementedBlockStreamServer) Blocks

type UnsafeBlockStreamServer

type UnsafeBlockStreamServer interface {
	// contains filtered or unexported methods
}

UnsafeBlockStreamServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to BlockStreamServer will result in compilation errors.

Jump to

Keyboard shortcuts

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