db

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

DB allows to access the nodes public nodeDB

func CreateDBFromConfig added in v0.10.0

func CreateDBFromConfig(cfg *config.HostConfig, regMetrics gethmetrics.Registry, logger gethlog.Logger) (*DB, error)

func NewInMemoryDB

func NewInMemoryDB(regMetrics gethmetrics.Registry, logger gethlog.Logger) *DB

NewInMemoryDB returns a new instance of the Node DB

func NewLevelDBBackedDB

func NewLevelDBBackedDB(dbPath string, regMetrics gethmetrics.Registry, logger gethlog.Logger) (*DB, error)

NewLevelDBBackedDB creates a persistent DB for the host, if dbPath == "" it will generate a temp file

func (*DB) AddBatch added in v0.14.0

func (db *DB) AddBatch(batch *common.ExtBatch) error

AddBatch adds a batch and its header to the DB

func (*DB) AddBlock added in v0.15.0

func (db *DB) AddBlock(header *types.Header) error

AddBlock adds a types.Header to the known headers

func (*DB) AddRollupHeader

func (db *DB) AddRollupHeader(rollup *common.ExtRollup, block *common.L1Block) error

AddRollupHeader adds a rollup to the DB

func (*DB) GetBatch added in v0.8.0

func (db *DB) GetBatch(batchHash gethcommon.Hash) (*common.ExtBatch, error)

GetBatch returns the batch with the given hash.

func (*DB) GetBatchBySequenceNumber added in v0.14.0

func (db *DB) GetBatchBySequenceNumber(sequenceNumber *big.Int) (*common.ExtBatch, error)

GetBatchBySequenceNumber returns the batch with the given sequence number.

func (*DB) GetBatchHash added in v0.7.0

func (db *DB) GetBatchHash(number *big.Int) (*gethcommon.Hash, error)

GetBatchHash returns the hash of a batch given its number.

func (*DB) GetBatchHeader added in v0.7.0

func (db *DB) GetBatchHeader(hash gethcommon.Hash) (*common.BatchHeader, error)

GetBatchHeader returns the batch header given the hash.

func (*DB) GetBatchListing added in v0.15.0

func (db *DB) GetBatchListing(pagination *common.QueryPagination) (*common.BatchListingResponse, error)

GetBatchListing returns BatchListingResponse given a pagination todo change this when the db changes - this is not super performant

func (*DB) GetBatchNumber added in v0.7.1

func (db *DB) GetBatchNumber(txHash gethcommon.Hash) (*big.Int, error)

GetBatchNumber returns the number of the batch containing the given transaction hash.

func (*DB) GetBatchTxs added in v0.7.1

func (db *DB) GetBatchTxs(batchHash gethcommon.Hash) ([]gethcommon.Hash, error)

GetBatchTxs returns the transaction hashes of the batch with the given hash.

func (*DB) GetBlockAtTip added in v0.15.0

func (db *DB) GetBlockAtTip() (*types.Header, error)

GetBlockAtTip returns the block at current Head or Tip

func (*DB) GetBlockByHash added in v0.15.0

func (db *DB) GetBlockByHash(hash gethcommon.Hash) (*types.Header, error)

GetBlockByHash returns the block header given the hash.

func (*DB) GetBlockByHeight added in v0.15.0

func (db *DB) GetBlockByHeight(height *big.Int) (*types.Header, error)

GetBlockByHeight returns the block header given the height

func (*DB) GetBlockListing added in v0.15.0

func (db *DB) GetBlockListing(pagination *common.QueryPagination) (*common.BlockListingResponse, error)

GetBlockListing returns a list of blocks given the pagination

func (*DB) GetHeadBatchHeader added in v0.7.0

func (db *DB) GetHeadBatchHeader() (*common.BatchHeader, error)

GetHeadBatchHeader returns the header of the node's current head batch.

func (*DB) GetRollupHeader

func (db *DB) GetRollupHeader(hash gethcommon.Hash) (*common.RollupHeader, error)

GetRollupHeader returns the rollup with the given hash.

func (*DB) GetRollupHeaderByBlock added in v0.15.0

func (db *DB) GetRollupHeaderByBlock(blockHash gethcommon.Hash) (*common.RollupHeader, error)

GetRollupHeaderByBlock returns the rollup for the given block

func (*DB) GetTipRollupHeader added in v0.14.0

func (db *DB) GetTipRollupHeader() (*common.RollupHeader, error)

GetTipRollupHeader returns the header of the node's current tip rollup.

func (*DB) GetTotalTransactions

func (db *DB) GetTotalTransactions() (*big.Int, error)

GetTotalTransactions returns the total number of batched transactions.

func (*DB) Stop added in v0.10.0

func (db *DB) Stop() error

Stop is especially important for graceful shutdown of LevelDB as it may flush data to disk that is currently in cache

type ObscuroLevelDB added in v0.10.0

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

ObscuroLevelDB is a very thin wrapper around a level DB database for compatibility with our internal interfaces In particular, it overrides the Get method to return the obscuro ErrNotFound

func (*ObscuroLevelDB) Close added in v0.10.0

func (o *ObscuroLevelDB) Close() error

func (*ObscuroLevelDB) Compact added in v0.10.0

func (o *ObscuroLevelDB) Compact(start []byte, limit []byte) error

func (*ObscuroLevelDB) Delete added in v0.10.0

func (o *ObscuroLevelDB) Delete(key []byte) error

func (*ObscuroLevelDB) Get added in v0.10.0

func (o *ObscuroLevelDB) Get(key []byte) ([]byte, error)

Get is overridden here to return our internal NotFound error

func (*ObscuroLevelDB) Has added in v0.10.0

func (o *ObscuroLevelDB) Has(key []byte) (bool, error)

func (*ObscuroLevelDB) NewBatch added in v0.10.0

func (o *ObscuroLevelDB) NewBatch() ethdb.Batch

func (*ObscuroLevelDB) NewBatchWithSize added in v0.17.0

func (o *ObscuroLevelDB) NewBatchWithSize(int) ethdb.Batch

func (*ObscuroLevelDB) NewIterator added in v0.10.0

func (o *ObscuroLevelDB) NewIterator(prefix []byte, start []byte) ethdb.Iterator

func (*ObscuroLevelDB) NewSnapshot added in v0.17.0

func (o *ObscuroLevelDB) NewSnapshot() (ethdb.Snapshot, error)

func (*ObscuroLevelDB) Put added in v0.10.0

func (o *ObscuroLevelDB) Put(key []byte, value []byte) error

func (*ObscuroLevelDB) Stat added in v0.10.0

func (o *ObscuroLevelDB) Stat(property string) (string, error)

Jump to

Keyboard shortcuts

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