evmstore

package
v0.0.0-...-2cf946a Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2022 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	logger.Instance
	// contains filtered or unexported fields
}

Store is a node persistent storage working over physical key-value database.

func NewStore

func NewStore(mainDB kvdb.Store, cfg StoreConfig) *Store

NewStore creates store over key-value db.

func (*Store) ApplyGenesis

func (s *Store) ApplyGenesis(g opera.Genesis, startingRoot hash.Hash) (evmBlock *evmcore.EvmBlock, err error)

ApplyGenesis writes initial state.

func (*Store) Cap

func (s *Store) Cap(max, min int)

func (*Store) Commit

func (s *Store) Commit(root hash.Hash) error

Commit changes.

func (*Store) EvmDatabase

func (s *Store) EvmDatabase() state.Database

func (*Store) EvmKvdbTable

func (s *Store) EvmKvdbTable() kvdb.Store

func (*Store) EvmLogs

func (s *Store) EvmLogs() *topicsdb.Index

func (*Store) EvmTable

func (s *Store) EvmTable() ethdb.Database

func (*Store) GetCachedEvmBlock

func (s *Store) GetCachedEvmBlock(n idx.Block) *evmcore.EvmBlock

func (*Store) GetReceipts

func (s *Store) GetReceipts(n idx.Block) types.Receipts

GetReceipts returns stored transaction receipts.

func (*Store) GetTx

func (s *Store) GetTx(txid common.Hash) *types.Transaction

GetTx returns stored non-event transaction.

func (*Store) GetTxPosition

func (s *Store) GetTxPosition(txid common.Hash) *TxPosition

GetTxPosition returns stored transaction block and position.

func (*Store) IndexLogs

func (s *Store) IndexLogs(recs ...*types.Log)

IndexLogs indexes EVM logs

func (*Store) InitEvmSnapshot

func (s *Store) InitEvmSnapshot(root hash.Hash) (err error)

func (*Store) SetCachedEvmBlock

func (s *Store) SetCachedEvmBlock(n idx.Block, b *evmcore.EvmBlock)

func (*Store) SetRawReceipts

func (s *Store) SetRawReceipts(n idx.Block, receipts []*types.ReceiptForStorage) (size int)

SetRawReceipts stores raw transaction receipts.

func (*Store) SetReceipts

func (s *Store) SetReceipts(n idx.Block, receipts types.Receipts)

SetReceipts stores transaction receipts.

func (*Store) SetTx

func (s *Store) SetTx(txid common.Hash, tx *types.Transaction)

SetTx stores non-event transaction.

func (*Store) SetTxPosition

func (s *Store) SetTxPosition(txid common.Hash, position TxPosition)

SetTxPosition stores transaction block and position.

func (*Store) StateDB

func (s *Store) StateDB(from hash.Hash) (*state.StateDB, error)

StateDB returns state database.

type StoreCacheConfig

type StoreCacheConfig struct {
	// Cache size for Receipts (size in bytes).
	ReceiptsSize uint
	// Cache size for Receipts (number of blocks).
	ReceiptsBlocks int
	// Cache size for TxPositions.
	TxPositions int
	// Cache size for EVM database.
	EvmDatabase int
	// Cache size for EVM snapshot.
	EvmSnap int
	// Cache size for EvmBlock (number of blocks).
	EvmBlocksNum int
	// Cache size for EvmBlock (size in bytes).
	EvmBlocksSize uint
}

StoreCacheConfig is a config for the db.

type StoreConfig

type StoreConfig struct {
	Cache           StoreCacheConfig
	EnableSnapshots bool
	// Enables tracking of SHA3 preimages in the VM
	EnablePreimageRecording bool
}

StoreConfig is a config for store db.

func DefaultStoreConfig

func DefaultStoreConfig(scale cachescale.Func) StoreConfig

DefaultStoreConfig for product.

func LiteStoreConfig

func LiteStoreConfig() StoreConfig

LiteStoreConfig is for tests or inmemory.

type TxPosition

type TxPosition struct {
	Block       idx.Block
	Event       hash.Event
	EventOffset uint32
	BlockOffset uint32
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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