core

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: CC0-1.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLimited = errors.New("limited")

Functions

func Close

func Close() error

func Open

func Open(options badger.Options, gcIntervalSeconds int) (*badger.DB, error)

Types

type Config

type Config struct {
	MaxScanIterators   uint           `mapstructure:"maxScanIterators"`
	ScanRangeThreshold uint           `mapstructure:"scanRangeThreshold"`
	FilterTtlMinutes   int            `mapstructure:"filterTtlMinutes"`
	GcIntervalSeconds  int            `mapstructure:"gcIntervalSeconds"`
	BadgerConfig       badger.Options `mapstructure:"options"`
}

type DB

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

func NewDB

func NewDB(config Config, codec codec.Codec) (*DB, error)

func (*DB) BadgerDB

func (db *DB) BadgerDB() *badger.DB

For debugging/testing/etc purposes For production purposes use db.View(...) and db.InsertSomething functions

func (*DB) Close

func (db *DB) Close() error

func (*DB) InsertBlockFilter

func (db *DB) InsertBlockFilter(chainId uint64, filterId primitives.Data32, filter *dbt.BlockFilter) error

func (*DB) InsertIndexerState

func (db *DB) InsertIndexerState(chainId uint64, data []byte) error

func (*DB) InsertLogFilter

func (db *DB) InsertLogFilter(chainId uint64, filterId primitives.Data32, filter *dbt.LogFilter) error

func (*DB) InsertTransactionFilter

func (db *DB) InsertTransactionFilter(chainId uint64, filterId primitives.Data32, filter *dbt.TransactionFilter) error

func (*DB) NewWriter

func (db *DB) NewWriter() *Writer

func (*DB) Update

func (db *DB) Update(fn func(txn *ViewTxn) error) error

func (*DB) View

func (db *DB) View(fn func(txn *ViewTxn) error) error

type ViewTxn

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

Wrapper that hides internals from outer packages

func (*ViewTxn) DeleteBlockFilter

func (txn *ViewTxn) DeleteBlockFilter(chainId uint64, filterId dbp.Data32) error

func (*ViewTxn) DeleteFilter

func (txn *ViewTxn) DeleteFilter(chainId uint64, filterId dbp.Data32) error

func (*ViewTxn) DeleteLogFilter

func (txn *ViewTxn) DeleteLogFilter(chainId uint64, filterId dbp.Data32) error

func (*ViewTxn) DeleteTransactionFilter

func (txn *ViewTxn) DeleteTransactionFilter(chainId uint64, filterId dbp.Data32) error

func (*ViewTxn) ReadBlock

func (txn *ViewTxn) ReadBlock(chainId uint64, key dbt.BlockKey, fullTransactions bool) (*response.Block, error)

func (*ViewTxn) ReadBlockFilter

func (txn *ViewTxn) ReadBlockFilter(chainId uint64, filterId dbp.Data32) (*db.BlockFilter, error)

func (*ViewTxn) ReadBlockHashes

func (txn *ViewTxn) ReadBlockHashes(
	ctx context.Context,
	chainId uint64,
	from *dbt.BlockKey,
	to *dbt.BlockKey,
	limit int,
) ([]primitives.Data32, *dbt.BlockKey, error)

func (*ViewTxn) ReadBlockKey

func (txn *ViewTxn) ReadBlockKey(chainId uint64, hash primitives.Data32) (*dbt.BlockKey, error)

func (*ViewTxn) ReadBlockTxCount

func (txn *ViewTxn) ReadBlockTxCount(chainId uint64, key dbt.BlockKey) (primitives.HexUint, error)

func (*ViewTxn) ReadEarliestBlockKey

func (txn *ViewTxn) ReadEarliestBlockKey(chainId uint64) (*dbt.BlockKey, error)

func (*ViewTxn) ReadEarliestLogKey

func (txn *ViewTxn) ReadEarliestLogKey(chainId uint64) (*db.LogKey, error)

func (*ViewTxn) ReadEarliestTxKey

func (txn *ViewTxn) ReadEarliestTxKey(chainId uint64) (*dbt.TransactionKey, error)

func (*ViewTxn) ReadFilter

func (txn *ViewTxn) ReadFilter(chainId uint64, filterId dbp.Data32) (any, error)

func (*ViewTxn) ReadIndexerState

func (txn *ViewTxn) ReadIndexerState(chainId uint64) ([]byte, error)

func (*ViewTxn) ReadLatestBlockKey

func (txn *ViewTxn) ReadLatestBlockKey(chainId uint64) (*dbt.BlockKey, error)

func (*ViewTxn) ReadLatestLogKey

func (txn *ViewTxn) ReadLatestLogKey(chainId uint64) (*db.LogKey, error)

func (*ViewTxn) ReadLatestTxKey

func (txn *ViewTxn) ReadLatestTxKey(chainId uint64) (*dbt.TransactionKey, error)

func (*ViewTxn) ReadLogFilter

func (txn *ViewTxn) ReadLogFilter(chainId uint64, filterId dbp.Data32) (*db.LogFilter, error)

func (*ViewTxn) ReadLogs

func (txn *ViewTxn) ReadLogs(
	ctx context.Context,
	chainId uint64,
	from *db.LogKey,
	to *db.LogKey,
	addresses []primitives.Data20,
	topics [][]primitives.Data32,
	limit int,
) ([]*response.Log, *db.LogKey, error)

func (*ViewTxn) ReadTransactionFilter

func (txn *ViewTxn) ReadTransactionFilter(chainId uint64, filterId dbp.Data32) (*db.TransactionFilter, error)

func (*ViewTxn) ReadTransactions

func (txn *ViewTxn) ReadTransactions(
	ctx context.Context,
	chainId uint64,
	from *dbt.TransactionKey,
	to *dbt.TransactionKey,
	full bool,
	limit int,
) ([]any, *dbt.TransactionKey, error)

func (*ViewTxn) ReadTx

func (txn *ViewTxn) ReadTx(chainId uint64, key dbt.TransactionKey) (*response.Transaction, error)

func (*ViewTxn) ReadTxKey

func (txn *ViewTxn) ReadTxKey(chainId uint64, hash primitives.Data32) (*dbt.TransactionKey, error)

func (*ViewTxn) ReadTxReceipt

func (txn *ViewTxn) ReadTxReceipt(chainId uint64, key dbt.TransactionKey) (*response.TransactionReceipt, error)

type Writer

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

Wrapper that hides internals from outer packages

func (*Writer) Cancel

func (w *Writer) Cancel()

func (*Writer) Flush

func (w *Writer) Flush() error

func (*Writer) InsertBlock

func (w *Writer) InsertBlock(chainId, height uint64, hash primitives.Data32, data *dbt.Block) error

func (*Writer) InsertLog

func (w *Writer) InsertLog(chainId, height, txIndex, logIndex uint64, data *dbt.Log) error

func (*Writer) InsertTransaction

func (w *Writer) InsertTransaction(chainId, height, index uint64, hash primitives.Data32, data *dbt.Transaction) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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