store

package
v0.0.0-...-2eef473 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: LGPL-3.0 Imports: 7 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()
	FindBeaconStateWithinSyncPeriod(slot, boundary uint64, findMin bool) (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) FindBeaconStateWithinSyncPeriod

func (s *Store) FindBeaconStateWithinSyncPeriod(slot, boundary uint64, findMin bool) (StoredBeaconData, error)

FindBeaconStateWithinSyncPeriod finds an attested and a finalized header pair within the same sync period. bool findMin specifies whether the largest or smallest slot should be found. if findMin = true, the earliest block in the sync committee will be returned, otherwise the largest. This is used for FinalizedUpdates, where the latest block ideally wants to be synced, and for SyncCommitteeUpdates, where the earliest slot with the next sync committee wants to be located.

func (*Store) GetBeaconStateData

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

GetBeaconStateData finds a beacon state at a slot.

func (*Store) PruneOldStates

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

func (*Store) ReadStateFile

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

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