store

package
v0.0.0-...-7cdd60a Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: LGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const BeaconStateDir = "states"
View Source
const BeaconStateFilename = "beacon_state_%d.ssz"
View Source
const BeaconStoreName = "beacon-state"

Variables

This section is empty.

Functions

This section is empty.

Types

type BeaconState

type BeaconState struct {
	ID                     uint64
	AttestedSlot           uint64
	FinalizedSlot          uint64
	AttestedSyncPeriod     uint64
	FinalizedSyncPeriod    uint64
	AttestedStateFilename  string
	FinalizedStateFilename string
	Timestamp              time.Time
}

type BeaconStore

type BeaconStore interface {
	Connect() error
	Close()
	FindBeaconStateWithinRange(slot, boundary uint64) (StoredBeaconData, error)
	GetBeaconStateData(slot uint64) ([]byte, error)
	WriteEntry(attestedSlot, finalizedSlot uint64, attestedStateData, finalizedStateData []byte) error
}

type Store

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

func New

func New(location string, maxEntries uint64, protocol protocol.Protocol) Store

func (*Store) Close

func (s *Store) Close()

func (*Store) Connect

func (s *Store) Connect() error

func (*Store) DeleteStateFile

func (s *Store) DeleteStateFile(filename string) error

func (*Store) FindBeaconStateWithinRange

func (s *Store) FindBeaconStateWithinRange(minSlot, maxSlot uint64) (StoredBeaconData, error)

FindBeaconStateWithinRange finds a finalized and attested beacon header pair within the provided range.

func (*Store) GetBeaconStateData

func (s *Store) GetBeaconStateData(slot uint64) ([]byte, error)

GetBeaconStateData finds a beacon state at a slot.

func (*Store) ListBeaconStates

func (s *Store) ListBeaconStates() ([]BeaconState, error)

func (*Store) PruneOldStates

func (s *Store) PruneOldStates() ([]uint64, error)

func (*Store) ReadStateFile

func (s *Store) ReadStateFile(filename string) ([]byte, error)

func (*Store) StateFileExists

func (s *Store) StateFileExists(filename string) bool

func (*Store) WriteEntry

func (s *Store) WriteEntry(attestedSlot, finalizedSlot uint64, attestedStateData, finalizedStateData []byte) error

type StoredBeaconData

type StoredBeaconData struct {
	AttestedSlot         uint64
	FinalizedSlot        uint64
	AttestedBeaconState  []byte
	FinalizedBeaconState []byte
}

Jump to

Keyboard shortcuts

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