Documentation
¶
Index ¶
- func NewBroadcaster(lggr logger.Logger) broadcaster
- type Broadcaster
- type Client
- type DbORM
- func (orm *DbORM) HeadByHash(ctx context.Context, hash common.Hash) (head *evmtypes.Head, err error)
- func (orm *DbORM) IdempotentInsertHead(ctx context.Context, head *evmtypes.Head) error
- func (orm *DbORM) LatestHead(ctx context.Context) (head *evmtypes.Head, err error)
- func (orm *DbORM) LatestHeads(ctx context.Context, minBlockNumer int64) (heads []*evmtypes.Head, err error)
- func (orm *DbORM) TrimOldHeads(ctx context.Context, minBlockNumber int64) (err error)
- type HeadSaver
- type HeadSet
- type Listener
- type ORM
- type Trackable
- type Tracker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewBroadcaster ¶
Types ¶
type Broadcaster ¶
Type Alias for EVM Head Tracker Components
type DbORM ¶
type DbORM struct {
// contains filtered or unexported fields
}
func (*DbORM) HeadByHash ¶
func (*DbORM) IdempotentInsertHead ¶
func (*DbORM) LatestHead ¶
func (*DbORM) LatestHeads ¶
type HeadSaver ¶
type HeadSaver interface {
heads.Saver[*evmtypes.Head, common.Hash]
// LatestHeadFromDB returns the highest seen head from DB.
LatestHeadFromDB(ctx context.Context) (*evmtypes.Head, error)
}
HeadSaver maintains chains persisted in DB. All methods are thread-safe.
var NullSaver HeadSaver = &nullSaver{}
func NewSaver ¶
func NewSaver(lggr logger.Logger, orm ORM, config heads.ChainConfig, htConfig heads.TrackerConfig) HeadSaver
type HeadSet ¶
type HeadSet interface {
// LatestHead returns the block header with the highest number that has been seen, or nil.
LatestHead() *evmtypes.Head
// HeadByHash returns a head for the specified hash, or nil.
HeadByHash(hash common.Hash) *evmtypes.Head
// AddHeads adds newHeads to the collection, eliminates duplicates,
// sorts by head number, fixes parents and cuts off old heads (historyDepth).
AddHeads(newHeads ...*evmtypes.Head) error
// Count returns number of heads in the collection.
Count() int
// MarkFinalized - finds `finalized` in the LatestHead and marks it and all direct ancestors as finalized.
// Trims old blocks whose height is smaller than minBlockToKeep
MarkFinalized(finalized common.Hash, minBlockToKeep int64) bool
}
HeadSet is a collection of heads. All methods are thread-safe.
func NewHeadSet ¶
func NewHeadSet() HeadSet
type ORM ¶
type ORM interface {
// IdempotentInsertHead inserts a head only if the hash is new. Will do nothing if hash exists already.
// No advisory lock required because this is thread safe.
IdempotentInsertHead(ctx context.Context, head *evmtypes.Head) error
// TrimOldHeads deletes heads such that only blocks >= minBlockNumber remain
TrimOldHeads(ctx context.Context, minBlockNumber int64) (err error)
// LatestHead returns the highest seen head
LatestHead(ctx context.Context) (head *evmtypes.Head, err error)
// LatestHeads returns the latest heads with blockNumbers >= minBlockNumber
LatestHeads(ctx context.Context, minBlockNumber int64) (heads []*evmtypes.Head, err error)
// HeadByHash fetches the head with the given hash from the db, returns nil if none exists
HeadByHash(ctx context.Context, hash common.Hash) (head *evmtypes.Head, err error)
}
func NewNullORM ¶
func NewNullORM() ORM
type Tracker ¶
Type Alias for EVM Head Tracker Components
var NullTracker Tracker = &nullTracker{}
func NewTracker ¶
func NewTracker( lggr logger.Logger, ethClient Client, config heads.ChainConfig, htConfig heads.TrackerConfig, headBroadcaster Broadcaster, headSaver HeadSaver, mailMon *mailbox.Monitor, ) Tracker
Click to show internal directories.
Click to hide internal directories.