indexer

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: GPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_monitor_xmonitor_indexer_indexer_proto protoreflect.FileDescriptor

Functions

func Start

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

Start streams goroutines that streams xblocks and indexes xmsgs vs xreceipt metrics.

Types

type Block

type Block struct {
	Id          uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`                                      // Auto-incremented ID
	ChainId     uint64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`             // Source chain ID as per https://chainlist.org
	BlockHeight uint64 `protobuf:"varint,3,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` // Height of the source-chain block
	BlockHash   []byte `protobuf:"bytes,4,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"`        // Hash of the source-chain block
	BlockJson   []byte `protobuf:"bytes,5,opt,name=block_json,json=blockJson,proto3" json:"block_json,omitempty"`        // xchain.Block JSON
	// contains filtered or unexported fields
}

func (*Block) Descriptor deprecated

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

Deprecated: Use Block.ProtoReflect.Descriptor instead.

func (*Block) GetBlockHash

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

func (*Block) GetBlockHeight

func (x *Block) GetBlockHeight() uint64

func (*Block) GetBlockJson

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

func (*Block) GetChainId

func (x *Block) GetChainId() 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

func (*Block) XChainBlock

func (b *Block) XChainBlock() (xchain.Block, error)

type BlockChainIdBlockHeightBlockHashIndexKey

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

func (BlockChainIdBlockHeightBlockHashIndexKey) WithChainId

func (BlockChainIdBlockHeightBlockHashIndexKey) WithChainIdBlockHeight

func (this BlockChainIdBlockHeightBlockHashIndexKey) WithChainIdBlockHeight(chain_id uint64, block_height uint64) BlockChainIdBlockHeightBlockHashIndexKey

func (BlockChainIdBlockHeightBlockHashIndexKey) WithChainIdBlockHeightBlockHash

func (this BlockChainIdBlockHeightBlockHashIndexKey) WithChainIdBlockHeightBlockHash(chain_id uint64, block_height uint64, block_hash []byte) BlockChainIdBlockHeightBlockHashIndexKey

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)
	HasByChainIdBlockHeightBlockHash(ctx context.Context, chain_id uint64, block_height uint64, block_hash []byte) (found bool, err error)
	// GetByChainIdBlockHeightBlockHash returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
	GetByChainIdBlockHeightBlockHash(ctx context.Context, chain_id uint64, block_height uint64, block_hash []byte) (*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 Cursor

type Cursor struct {
	ChainId     uint64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
	ConfLevel   uint32 `protobuf:"varint,2,opt,name=conf_level,json=confLevel,proto3" json:"conf_level,omitempty"`
	BlockHeight uint64 `protobuf:"varint,3,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"`
	// contains filtered or unexported fields
}

func (*Cursor) Descriptor deprecated

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

Deprecated: Use Cursor.ProtoReflect.Descriptor instead.

func (*Cursor) GetBlockHeight

func (x *Cursor) GetBlockHeight() uint64

func (*Cursor) GetChainId

func (x *Cursor) GetChainId() uint64

func (*Cursor) GetConfLevel

func (x *Cursor) GetConfLevel() uint32

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 CursorChainIdConfLevelIndexKey

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

func (CursorChainIdConfLevelIndexKey) WithChainId

func (CursorChainIdConfLevelIndexKey) WithChainIdConfLevel

func (this CursorChainIdConfLevelIndexKey) WithChainIdConfLevel(chain_id uint64, conf_level uint32) CursorChainIdConfLevelIndexKey

type CursorIndexKey

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

type CursorIterator

type CursorIterator struct {
	ormtable.Iterator
}

func (CursorIterator) Value

func (i CursorIterator) Value() (*Cursor, error)

type CursorPrimaryKey

type CursorPrimaryKey = CursorChainIdConfLevelIndexKey

primary key starting index..

type CursorTable

type CursorTable interface {
	Insert(ctx context.Context, cursor *Cursor) error
	Update(ctx context.Context, cursor *Cursor) error
	Save(ctx context.Context, cursor *Cursor) error
	Delete(ctx context.Context, cursor *Cursor) error
	Has(ctx context.Context, chain_id uint64, conf_level uint32) (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, chain_id uint64, conf_level uint32) (*Cursor, error)
	List(ctx context.Context, prefixKey CursorIndexKey, opts ...ormlist.Option) (CursorIterator, error)
	ListRange(ctx context.Context, from, to CursorIndexKey, opts ...ormlist.Option) (CursorIterator, error)
	DeleteBy(ctx context.Context, prefixKey CursorIndexKey) error
	DeleteRange(ctx context.Context, from, to CursorIndexKey) error
	// contains filtered or unexported methods
}

func NewCursorTable

func NewCursorTable(db ormtable.Schema) (CursorTable, error)

type IndexerStore

type IndexerStore interface {
	BlockTable() BlockTable
	MsgLinkTable() MsgLinkTable
	CursorTable() CursorTable
	// contains filtered or unexported methods
}

func NewIndexerStore

func NewIndexerStore(db ormtable.Schema) (IndexerStore, error)
type MsgLink struct {
	IdHash         []byte `protobuf:"bytes,1,opt,name=id_hash,json=idHash,proto3" json:"id_hash,omitempty"` // RouteScan IDHash of the MsgID
	MsgBlockId     uint64 `protobuf:"varint,2,opt,name=msg_block_id,json=msgBlockId,proto3" json:"msg_block_id,omitempty"`
	ReceiptBlockId uint64 `protobuf:"varint,3,opt,name=receipt_block_id,json=receiptBlockId,proto3" json:"receipt_block_id,omitempty"`
	// contains filtered or unexported fields
}

func (*MsgLink) Descriptor deprecated

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

Deprecated: Use MsgLink.ProtoReflect.Descriptor instead.

func (*MsgLink) GetIdHash

func (x *MsgLink) GetIdHash() []byte

func (*MsgLink) GetMsgBlockId

func (x *MsgLink) GetMsgBlockId() uint64

func (*MsgLink) GetReceiptBlockId

func (x *MsgLink) GetReceiptBlockId() uint64

func (*MsgLink) Hash

func (l *MsgLink) Hash() (common.Hash, error)

func (*MsgLink) IsMsg added in v0.10.0

func (l *MsgLink) IsMsg(msg xchain.Msg) bool

IsMsg returns true if the message belongs to this link.

func (*MsgLink) IsReceipt added in v0.10.0

func (l *MsgLink) IsReceipt(receipt xchain.Receipt) bool

IsReceipt returns true if the receipt belongs to this link.

func (*MsgLink) ProtoMessage

func (*MsgLink) ProtoMessage()

func (*MsgLink) ProtoReflect

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

func (*MsgLink) Reset

func (x *MsgLink) Reset()

func (*MsgLink) String

func (x *MsgLink) String() string

type MsgLinkIdHashIndexKey

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

func (MsgLinkIdHashIndexKey) WithIdHash

func (this MsgLinkIdHashIndexKey) WithIdHash(id_hash []byte) MsgLinkIdHashIndexKey

type MsgLinkIndexKey

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

type MsgLinkIterator

type MsgLinkIterator struct {
	ormtable.Iterator
}

func (MsgLinkIterator) Value

func (i MsgLinkIterator) Value() (*MsgLink, error)

type MsgLinkPrimaryKey

type MsgLinkPrimaryKey = MsgLinkIdHashIndexKey

primary key starting index..

type MsgLinkTable

type MsgLinkTable interface {
	Insert(ctx context.Context, msgLink *MsgLink) error
	Update(ctx context.Context, msgLink *MsgLink) error
	Save(ctx context.Context, msgLink *MsgLink) error
	Delete(ctx context.Context, msgLink *MsgLink) error
	Has(ctx context.Context, id_hash []byte) (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_hash []byte) (*MsgLink, error)
	List(ctx context.Context, prefixKey MsgLinkIndexKey, opts ...ormlist.Option) (MsgLinkIterator, error)
	ListRange(ctx context.Context, from, to MsgLinkIndexKey, opts ...ormlist.Option) (MsgLinkIterator, error)
	DeleteBy(ctx context.Context, prefixKey MsgLinkIndexKey) error
	DeleteRange(ctx context.Context, from, to MsgLinkIndexKey) error
	// contains filtered or unexported methods
}

func NewMsgLinkTable

func NewMsgLinkTable(db ormtable.Schema) (MsgLinkTable, error)

Jump to

Keyboard shortcuts

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