Documentation ¶
Index ¶
- Constants
- type ChainMetrics
- type DB
- func (db *DB) AddDerived(derivedFrom eth.BlockRef, derived eth.BlockRef) error
- func (db *DB) Close() error
- func (db *DB) DerivedFrom(derived eth.BlockID) (derivedFrom types.BlockSeal, err error)
- func (db *DB) First() (derivedFrom types.BlockSeal, derived types.BlockSeal, err error)
- func (db *DB) FirstAfter(derivedFrom, derived eth.BlockID) (nextDerivedFrom, nextDerived types.BlockSeal, err error)
- func (db *DB) LastDerivedAt(derivedFrom eth.BlockID) (derived types.BlockSeal, err error)
- func (db *DB) Latest() (derivedFrom types.BlockSeal, derived types.BlockSeal, err error)
- func (db *DB) NextDerived(derived eth.BlockID) (derivedFrom types.BlockSeal, nextDerived types.BlockSeal, err error)
- func (db *DB) NextDerivedFrom(derivedFrom eth.BlockID) (nextDerivedFrom types.BlockSeal, err error)
- func (db *DB) PreviousDerived(derived eth.BlockID) (prevDerived types.BlockSeal, err error)
- func (db *DB) PreviousDerivedFrom(derivedFrom eth.BlockID) (prevDerivedFrom types.BlockSeal, err error)
- func (db *DB) Rewind(derivedFrom uint64) error
- type Entry
- type EntryBinary
- type EntryStore
- type EntryType
- type LinkEntry
- type Metrics
Constants ¶
const EntrySize = 100
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChainMetrics ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB implements an append only database for log data and cross-chain dependencies. Each entry is fixed size, and denotes an increment in L1 (derived-from) and/or L2 (derived) block. Data is an append-only log, that can be binary searched for any necessary derivation-link data.
func NewFromEntryStore ¶
func (*DB) AddDerived ¶
func (*DB) DerivedFrom ¶
DerivedFrom determines where a L2 block was first derived from. (a L2 block may repeat if the following L1 blocks are empty and don't produce additional L2 blocks)
func (*DB) FirstAfter ¶
func (db *DB) FirstAfter(derivedFrom, derived eth.BlockID) (nextDerivedFrom, nextDerived types.BlockSeal, err error)
FirstAfter determines the next entry after the given pair of derivedFrom, derived. Either one or both of the two entries will be an increment by 1
func (*DB) LastDerivedAt ¶
LastDerivedAt returns the last L2 block derived from the given L1 block.
func (*DB) Latest ¶
Latest returns the last known values: derivedFrom: the L1 block that the L2 block is safe for (not necessarily the first, multiple L2 blocks may be derived from the same L1 block). derived: the L2 block that was derived (not necessarily the first, the L1 block may have been empty and repeated the last safe L2 block).
func (*DB) NextDerived ¶
func (db *DB) NextDerived(derived eth.BlockID) (derivedFrom types.BlockSeal, nextDerived types.BlockSeal, err error)
NextDerived finds the next L2 block after derived, and what it was derived from
func (*DB) NextDerivedFrom ¶
NextDerivedFrom finds the next L1 block after derivedFrom
func (*DB) PreviousDerived ¶
func (*DB) PreviousDerivedFrom ¶
type EntryBinary ¶
type EntryBinary struct{}
func (EntryBinary) EntrySize ¶
func (EntryBinary) EntrySize() int
type EntryStore ¶
type Metrics ¶
type Metrics interface {
RecordDBDerivedEntryCount(count int64)
}
func AdaptMetrics ¶
func AdaptMetrics(chainMetrics ChainMetrics, kind string) Metrics