era

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SlotsPerEra = 8192
)

Variables

View Source
var (
	SlotIndexType                   = EntryType{'i', '2'} // starting-slot | index | index | index ... | count
	VersionType                     = EntryType{'e', '2'} // always 0-length
	CompressedSignedBeaconBlockType = EntryType{1, 0}
	CompressedBeaconStateType       = EntryType{2, 0}
	EmptyType                       = EntryType{0, 0} // may have a length, data should be skipped
)
View Source
var ErrNotExist = errors.New("entry does not exist")

Functions

func CoppySnappyEntry

func CoppySnappyEntry(f io.Reader, w io.Writer, sr *snappy.Reader, expectType EntryType) error

func ReadBlockOffset

func ReadBlockOffset(f io.ReadSeeker, i uint64) (int64, error)

ReadBlockOffset reads the file offset of block i (slot relative to group slot-index). Seeker f must be positioned at the end of a group. Returns offset relative to start of file.

func ReadInt64

func ReadInt64(f io.Reader) (int64, error)

func ReadSlot

func ReadSlot(f io.Reader) (common.Slot, error)

func ReadStateOffsetAndSlot

func ReadStateOffsetAndSlot(f io.ReadSeeker) (offset int64, slot common.Slot, err error)

ReadStateOffsetAndSlot reads the file offset of the state. Seeker f must be positioned at the end of a group. Returns offset relative to start of file. Seeker f will be positioned where it started after a successful read. The slot of the state is returned as well.

func ReadUint64

func ReadUint64(f io.Reader) (uint64, error)

func SeekBlock

func SeekBlock(f io.ReadSeeker, i uint64, groupEnd int64) error

func SeekGroupStart

func SeekGroupStart(f io.ReadSeeker, groupEnd int64) error

func SeekState

func SeekState(f io.ReadSeeker, groupEnd int64) (slot common.Slot, err error)

func Tell

func Tell(f io.Seeker) (int64, error)

Types

type EntryType

type EntryType [2]byte

func CopyEntry

func CopyEntry(f io.Reader, w io.Writer) (EntryType, error)

func ReadHeader

func ReadHeader(f io.Reader) (EntryType, uint32, error)

type Store

type Store struct {
	// era file paths indexed by state starting-slot
	Files map[common.Slot]string
}

func NewStore

func NewStore() *Store

func (*Store) Block

func (s *Store) Block(slot common.Slot, dest common.SSZObj) error

func (*Store) Bounds

func (s *Store) Bounds() (min, max common.Slot)

func (*Store) Load

func (s *Store) Load(dirPath string) error

func (*Store) State

func (s *Store) State(slot common.Slot, dest common.SSZObj) error

Jump to

Keyboard shortcuts

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