emitcache

package
v0.3.1 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: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_monitor_xmonitor_emitcache_emitcursor_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Get(ctx context.Context, height uint64, stream xchain.StreamID) (xchain.EmitCursor, bool, error)
	AtOrBefore(ctx context.Context, height uint64, stream xchain.StreamID) (xchain.EmitCursor, bool, error)
}

func Start

func Start(
	ctx context.Context,
	network netconf.Network,
	xprov xchain.Provider,
	db db.DB,
) (Cache, error)

Start subscribes the xprovider iot populate the emit cursor cache. It returns a cache that will be populated and trimmed asynchronously.

type EmitCursor

type EmitCursor struct {
	Id         uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`                                     // Auto-incremented ID
	SrcChainId uint64 `protobuf:"varint,2,opt,name=src_chain_id,json=srcChainId,proto3" json:"src_chain_id,omitempty"` // Source chain ID as per https://chainlist.org
	Height     uint64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"`                             // Block Height
	DstChainId uint64 `protobuf:"varint,4,opt,name=dst_chain_id,json=dstChainId,proto3" json:"dst_chain_id,omitempty"` // Destination Chain ID as per https://chainlist.org
	ShardId    uint64 `protobuf:"varint,5,opt,name=shard_id,json=shardId,proto3" json:"shard_id,omitempty"`            // Shard ID
	MsgOffset  uint64 `protobuf:"varint,6,opt,name=msg_offset,json=msgOffset,proto3" json:"msg_offset,omitempty"`      // XMsg Stream Offset
	// contains filtered or unexported fields
}

EmitCursor stores historical emit cursors for all evm portals.

func (*EmitCursor) Descriptor deprecated

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

Deprecated: Use EmitCursor.ProtoReflect.Descriptor instead.

func (*EmitCursor) GetDstChainId

func (x *EmitCursor) GetDstChainId() uint64

func (*EmitCursor) GetHeight

func (x *EmitCursor) GetHeight() uint64

func (*EmitCursor) GetId

func (x *EmitCursor) GetId() uint64

func (*EmitCursor) GetMsgOffset

func (x *EmitCursor) GetMsgOffset() uint64

func (*EmitCursor) GetShardId

func (x *EmitCursor) GetShardId() uint64

func (*EmitCursor) GetSrcChainId

func (x *EmitCursor) GetSrcChainId() uint64

func (*EmitCursor) ProtoMessage

func (*EmitCursor) ProtoMessage()

func (*EmitCursor) ProtoReflect

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

func (*EmitCursor) Reset

func (x *EmitCursor) Reset()

func (*EmitCursor) String

func (x *EmitCursor) String() string

type EmitCursorIdIndexKey

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

func (EmitCursorIdIndexKey) WithId

type EmitCursorIndexKey

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

type EmitCursorIterator

type EmitCursorIterator struct {
	ormtable.Iterator
}

func (EmitCursorIterator) Value

func (i EmitCursorIterator) Value() (*EmitCursor, error)

type EmitCursorPrimaryKey

type EmitCursorPrimaryKey = EmitCursorIdIndexKey

primary key starting index..

type EmitCursorSrcChainIdDstChainIdShardIdHeightIndexKey

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

func (EmitCursorSrcChainIdDstChainIdShardIdHeightIndexKey) WithSrcChainId

func (EmitCursorSrcChainIdDstChainIdShardIdHeightIndexKey) WithSrcChainIdDstChainId

func (EmitCursorSrcChainIdDstChainIdShardIdHeightIndexKey) WithSrcChainIdDstChainIdShardId

func (this EmitCursorSrcChainIdDstChainIdShardIdHeightIndexKey) WithSrcChainIdDstChainIdShardId(src_chain_id uint64, dst_chain_id uint64, shard_id uint64) EmitCursorSrcChainIdDstChainIdShardIdHeightIndexKey

func (EmitCursorSrcChainIdDstChainIdShardIdHeightIndexKey) WithSrcChainIdDstChainIdShardIdHeight

func (this EmitCursorSrcChainIdDstChainIdShardIdHeightIndexKey) WithSrcChainIdDstChainIdShardIdHeight(src_chain_id uint64, dst_chain_id uint64, shard_id uint64, height uint64) EmitCursorSrcChainIdDstChainIdShardIdHeightIndexKey

type EmitCursorTable

type EmitCursorTable interface {
	Insert(ctx context.Context, emitCursor *EmitCursor) error
	InsertReturningId(ctx context.Context, emitCursor *EmitCursor) (uint64, error)
	LastInsertedSequence(ctx context.Context) (uint64, error)
	Update(ctx context.Context, emitCursor *EmitCursor) error
	Save(ctx context.Context, emitCursor *EmitCursor) error
	Delete(ctx context.Context, emitCursor *EmitCursor) 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) (*EmitCursor, error)
	HasBySrcChainIdDstChainIdShardIdHeight(ctx context.Context, src_chain_id uint64, dst_chain_id uint64, shard_id uint64, height uint64) (found bool, err error)
	// GetBySrcChainIdDstChainIdShardIdHeight returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
	GetBySrcChainIdDstChainIdShardIdHeight(ctx context.Context, src_chain_id uint64, dst_chain_id uint64, shard_id uint64, height uint64) (*EmitCursor, error)
	List(ctx context.Context, prefixKey EmitCursorIndexKey, opts ...ormlist.Option) (EmitCursorIterator, error)
	ListRange(ctx context.Context, from, to EmitCursorIndexKey, opts ...ormlist.Option) (EmitCursorIterator, error)
	DeleteBy(ctx context.Context, prefixKey EmitCursorIndexKey) error
	DeleteRange(ctx context.Context, from, to EmitCursorIndexKey) error
	// contains filtered or unexported methods
}

func NewEmitCursorTable

func NewEmitCursorTable(db ormtable.Schema) (EmitCursorTable, error)

type EmitcursorStore

type EmitcursorStore interface {
	EmitCursorTable() EmitCursorTable
	// contains filtered or unexported methods
}

func NewEmitcursorStore

func NewEmitcursorStore(db ormtable.Schema) (EmitcursorStore, error)

Jump to

Keyboard shortcuts

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