keeper

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_halo_portal_keeper_portal_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type Block

type Block struct {
	Id            uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`                                            // Auto-incremented ID (BlockHeight, BlockOffset)
	CreatedHeight uint64 `protobuf:"varint,2,opt,name=created_height,json=createdHeight,proto3" json:"created_height,omitempty"` // Height this block was created at.
	// contains filtered or unexported fields
}

Block groups a set of Msgs adding height and offset.

func (*Block) Descriptor deprecated

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

Deprecated: Use Block.ProtoReflect.Descriptor instead.

func (*Block) GetCreatedHeight

func (x *Block) GetCreatedHeight() uint64

func (*Block) GetId

func (x *Block) GetId() uint64

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

type BlockCreatedHeightIndexKey

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

func (BlockCreatedHeightIndexKey) WithCreatedHeight

func (this BlockCreatedHeightIndexKey) WithCreatedHeight(created_height uint64) BlockCreatedHeightIndexKey

type BlockIdIndexKey

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

func (BlockIdIndexKey) WithId

func (this BlockIdIndexKey) WithId(id uint64) BlockIdIndexKey

type BlockIndexKey

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

type BlockIterator

type BlockIterator struct {
	ormtable.Iterator
}

func (BlockIterator) Value

func (i BlockIterator) Value() (*Block, error)

type BlockPrimaryKey

type BlockPrimaryKey = BlockIdIndexKey

primary key starting index..

type BlockTable

type BlockTable interface {
	Insert(ctx context.Context, block *Block) error
	InsertReturningId(ctx context.Context, block *Block) (uint64, error)
	LastInsertedSequence(ctx context.Context) (uint64, error)
	Update(ctx context.Context, block *Block) error
	Save(ctx context.Context, block *Block) error
	Delete(ctx context.Context, block *Block) error
	Has(ctx context.Context, id uint64) (found bool, err error)
	// Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
	Get(ctx context.Context, id uint64) (*Block, error)
	HasByCreatedHeight(ctx context.Context, created_height uint64) (found bool, err error)
	// GetByCreatedHeight returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
	GetByCreatedHeight(ctx context.Context, created_height uint64) (*Block, error)
	List(ctx context.Context, prefixKey BlockIndexKey, opts ...ormlist.Option) (BlockIterator, error)
	ListRange(ctx context.Context, from, to BlockIndexKey, opts ...ormlist.Option) (BlockIterator, error)
	DeleteBy(ctx context.Context, prefixKey BlockIndexKey) error
	DeleteRange(ctx context.Context, from, to BlockIndexKey) error
	// contains filtered or unexported methods
}

func NewBlockTable

func NewBlockTable(db ormtable.Schema) (BlockTable, error)

type Keeper

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

func NewKeeper

func NewKeeper(storeService store.KVStoreService) (Keeper, error)

func (Keeper) Block

func (Keeper) EmitMsg

func (k Keeper) EmitMsg(ctx sdk.Context, typ types.MsgType, msgTypeID uint64, destChainID uint64, shardID xchain.ShardID) (uint64, error)

type Msg

type Msg struct {
	Id           uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`                                         // Auto-incremented ID
	BlockId      uint64 `protobuf:"varint,2,opt,name=block_id,json=blockId,proto3" json:"block_id,omitempty"`                // Block ID to which this msg belongs
	MsgType      uint32 `protobuf:"varint,3,opt,name=msg_type,json=msgType,proto3" json:"msg_type,omitempty"`                // Message type (ValidatorSet, Withdrawal, etc.)
	MsgTypeId    uint64 `protobuf:"varint,4,opt,name=msg_type_id,json=msgTypeId,proto3" json:"msg_type_id,omitempty"`        // ID of the type referred to be MsgType
	DestChainId  uint64 `protobuf:"varint,5,opt,name=dest_chain_id,json=destChainId,proto3" json:"dest_chain_id,omitempty"`  // Destination chain ID
	ShardId      uint64 `protobuf:"varint,6,opt,name=shard_id,json=shardId,proto3" json:"shard_id,omitempty"`                // Shard of the message
	StreamOffset uint64 `protobuf:"varint,7,opt,name=stream_offset,json=streamOffset,proto3" json:"stream_offset,omitempty"` // Offset of the message in the stream
	// contains filtered or unexported fields
}

Msg represents a single cross-chain message emitted by the consensus chain portal.

func (*Msg) Descriptor deprecated

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

Deprecated: Use Msg.ProtoReflect.Descriptor instead.

func (*Msg) GetBlockId

func (x *Msg) GetBlockId() uint64

func (*Msg) GetDestChainId

func (x *Msg) GetDestChainId() uint64

func (*Msg) GetId

func (x *Msg) GetId() uint64

func (*Msg) GetMsgType

func (x *Msg) GetMsgType() uint32

func (*Msg) GetMsgTypeId

func (x *Msg) GetMsgTypeId() uint64

func (*Msg) GetShardId

func (x *Msg) GetShardId() uint64

func (*Msg) GetStreamOffset

func (x *Msg) GetStreamOffset() uint64

func (*Msg) ProtoMessage

func (*Msg) ProtoMessage()

func (*Msg) ProtoReflect

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

func (*Msg) Reset

func (x *Msg) Reset()

func (*Msg) String

func (x *Msg) String() string

type MsgBlockIdIndexKey

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

func (MsgBlockIdIndexKey) WithBlockId

func (this MsgBlockIdIndexKey) WithBlockId(block_id uint64) MsgBlockIdIndexKey

type MsgIdIndexKey

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

func (MsgIdIndexKey) WithId

func (this MsgIdIndexKey) WithId(id uint64) MsgIdIndexKey

type MsgIndexKey

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

type MsgIterator

type MsgIterator struct {
	ormtable.Iterator
}

func (MsgIterator) Value

func (i MsgIterator) Value() (*Msg, error)

type MsgPrimaryKey

type MsgPrimaryKey = MsgIdIndexKey

primary key starting index..

type MsgTable

type MsgTable interface {
	Insert(ctx context.Context, msg *Msg) error
	InsertReturningId(ctx context.Context, msg *Msg) (uint64, error)
	LastInsertedSequence(ctx context.Context) (uint64, error)
	Update(ctx context.Context, msg *Msg) error
	Save(ctx context.Context, msg *Msg) error
	Delete(ctx context.Context, msg *Msg) error
	Has(ctx context.Context, id uint64) (found bool, err error)
	// Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
	Get(ctx context.Context, id uint64) (*Msg, error)
	List(ctx context.Context, prefixKey MsgIndexKey, opts ...ormlist.Option) (MsgIterator, error)
	ListRange(ctx context.Context, from, to MsgIndexKey, opts ...ormlist.Option) (MsgIterator, error)
	DeleteBy(ctx context.Context, prefixKey MsgIndexKey) error
	DeleteRange(ctx context.Context, from, to MsgIndexKey) error
	// contains filtered or unexported methods
}

func NewMsgTable

func NewMsgTable(db ormtable.Schema) (MsgTable, error)

type Offset

type Offset struct {
	Id          uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`                                        // Auto-incremented ID
	DestChainId uint64 `protobuf:"varint,2,opt,name=dest_chain_id,json=destChainId,proto3" json:"dest_chain_id,omitempty"` // Destination chain ID
	ShardId     uint64 `protobuf:"varint,3,opt,name=shard_id,json=shardId,proto3" json:"shard_id,omitempty"`               // Shard ID
	Offset      uint64 `protobuf:"varint,4,opt,name=offset,proto3" json:"offset,omitempty"`                                // Offset of the last message in the stream
	// contains filtered or unexported fields
}

func (*Offset) Descriptor deprecated

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

Deprecated: Use Offset.ProtoReflect.Descriptor instead.

func (*Offset) GetDestChainId

func (x *Offset) GetDestChainId() uint64

func (*Offset) GetId

func (x *Offset) GetId() uint64

func (*Offset) GetOffset

func (x *Offset) GetOffset() uint64

func (*Offset) GetShardId

func (x *Offset) GetShardId() uint64

func (*Offset) ProtoMessage

func (*Offset) ProtoMessage()

func (*Offset) ProtoReflect

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

func (*Offset) Reset

func (x *Offset) Reset()

func (*Offset) String

func (x *Offset) String() string

type OffsetDestChainIdShardIdIndexKey

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

func (OffsetDestChainIdShardIdIndexKey) WithDestChainId

func (this OffsetDestChainIdShardIdIndexKey) WithDestChainId(dest_chain_id uint64) OffsetDestChainIdShardIdIndexKey

func (OffsetDestChainIdShardIdIndexKey) WithDestChainIdShardId

func (this OffsetDestChainIdShardIdIndexKey) WithDestChainIdShardId(dest_chain_id uint64, shard_id uint64) OffsetDestChainIdShardIdIndexKey

type OffsetIdIndexKey

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

func (OffsetIdIndexKey) WithId

func (this OffsetIdIndexKey) WithId(id uint64) OffsetIdIndexKey

type OffsetIndexKey

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

type OffsetIterator

type OffsetIterator struct {
	ormtable.Iterator
}

func (OffsetIterator) Value

func (i OffsetIterator) Value() (*Offset, error)

type OffsetPrimaryKey

type OffsetPrimaryKey = OffsetIdIndexKey

primary key starting index..

type OffsetTable

type OffsetTable interface {
	Insert(ctx context.Context, offset *Offset) error
	InsertReturningId(ctx context.Context, offset *Offset) (uint64, error)
	LastInsertedSequence(ctx context.Context) (uint64, error)
	Update(ctx context.Context, offset *Offset) error
	Save(ctx context.Context, offset *Offset) error
	Delete(ctx context.Context, offset *Offset) error
	Has(ctx context.Context, id uint64) (found bool, err error)
	// Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
	Get(ctx context.Context, id uint64) (*Offset, error)
	HasByDestChainIdShardId(ctx context.Context, dest_chain_id uint64, shard_id uint64) (found bool, err error)
	// GetByDestChainIdShardId returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
	GetByDestChainIdShardId(ctx context.Context, dest_chain_id uint64, shard_id uint64) (*Offset, error)
	List(ctx context.Context, prefixKey OffsetIndexKey, opts ...ormlist.Option) (OffsetIterator, error)
	ListRange(ctx context.Context, from, to OffsetIndexKey, opts ...ormlist.Option) (OffsetIterator, error)
	DeleteBy(ctx context.Context, prefixKey OffsetIndexKey) error
	DeleteRange(ctx context.Context, from, to OffsetIndexKey) error
	// contains filtered or unexported methods
}

func NewOffsetTable

func NewOffsetTable(db ormtable.Schema) (OffsetTable, error)

type PortalStore

type PortalStore interface {
	BlockTable() BlockTable
	MsgTable() MsgTable
	OffsetTable() OffsetTable
	// contains filtered or unexported methods
}

func NewPortalStore

func NewPortalStore(db ormtable.Schema) (PortalStore, error)

Jump to

Keyboard shortcuts

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