heads

package
v1.9.3 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainHeads

type ChainHeads struct {
	Unsafe         entrydb.EntryIdx `json:"localUnsafe"`
	CrossUnsafe    entrydb.EntryIdx `json:"crossUnsafe"`
	LocalSafe      entrydb.EntryIdx `json:"localSafe"`
	CrossSafe      entrydb.EntryIdx `json:"crossSafe"`
	LocalFinalized entrydb.EntryIdx `json:"localFinalized"`
	CrossFinalized entrydb.EntryIdx `json:"crossFinalized"`
}

ChainHeads provides the serialization format for the current chain heads. The values here could be block numbers or just the index of entries in the log db. If they're log db entries, we can't detect if things changed because of a reorg though (if the logdb write succeeded and head update failed). So we probably need to store actual block IDs here... but then we don't have the block hash for every block in the log db. Only jumping the head forward on checkpoint blocks doesn't work though...

type HeadTracker

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

HeadTracker records the current chain head pointers for a single chain.

func NewHeadTracker

func NewHeadTracker(path string) (*HeadTracker, error)

func (*HeadTracker) Apply

func (t *HeadTracker) Apply(op Operation) error

func (*HeadTracker) Close

func (t *HeadTracker) Close() error

func (*HeadTracker) Current

func (t *HeadTracker) Current() *Heads

type Heads

type Heads struct {
	Chains map[types.ChainID]ChainHeads
}

func NewHeads

func NewHeads() *Heads

func (*Heads) Copy

func (h *Heads) Copy() *Heads

func (*Heads) Get

func (h *Heads) Get(id types.ChainID) ChainHeads

func (Heads) MarshalJSON

func (h Heads) MarshalJSON() ([]byte, error)

func (*Heads) Put

func (h *Heads) Put(id types.ChainID, head ChainHeads)

func (*Heads) UnmarshalJSON

func (h *Heads) UnmarshalJSON(data []byte) error

type Operation

type Operation interface {
	Apply(head *Heads) error
}

type OperationFn

type OperationFn func(heads *Heads) error

func (OperationFn) Apply

func (f OperationFn) Apply(heads *Heads) error

Jump to

Keyboard shortcuts

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