db

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknownChain = errors.New("unknown chain")
)

Functions

func Resume

func Resume(logDB LogStorage) error

Resume prepares the given LogStore to resume recording events. It returns the block number of the last block that is guaranteed to have been fully recorded to the database and rewinds the database to ensure it can resume recording from the first log of the next block.

Types

type ChainsDB

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

func NewChainsDB

func NewChainsDB(logDBs map[types.ChainID]LogStorage, heads HeadsStorage) *ChainsDB

func (*ChainsDB) AddLog

func (db *ChainsDB) AddLog(chain types.ChainID, logHash backendTypes.TruncatedHash, block eth.BlockID, timestamp uint64, logIdx uint32, execMsg *backendTypes.ExecutingMessage) error

func (*ChainsDB) Close

func (db *ChainsDB) Close() error

func (*ChainsDB) LatestBlockNum

func (db *ChainsDB) LatestBlockNum(chain types.ChainID) uint64

func (*ChainsDB) Resume

func (db *ChainsDB) Resume() error

Resume prepares the chains db to resume recording events after a restart. It rewinds the database to the last block that is guaranteed to have been fully recorded to the database to ensure it can resume recording from the first log of the next block.

func (*ChainsDB) Rewind

func (db *ChainsDB) Rewind(chain types.ChainID, headBlockNum uint64) error

type HeadsStorage

type HeadsStorage interface {
}

type LogStorage

type LogStorage interface {
	io.Closer
	AddLog(logHash backendTypes.TruncatedHash, block eth.BlockID, timestamp uint64, logIdx uint32, execMsg *backendTypes.ExecutingMessage) error
	Rewind(newHeadBlockNum uint64) error
	LatestBlockNum() uint64
	ClosestBlockInfo(blockNum uint64) (uint64, backendTypes.TruncatedHash, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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