snapshot

package
v0.0.0-...-56b3d09 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SnapshotStatus_Done    = snapshot_types.SnapshotStatus_Done
	SnapshotStatus_Pending = snapshot_types.SnapshotStatus_Pending
	SnapshotStatus_Fail    = snapshot_types.SnapshotStatus_Fail
)
View Source
const (
	SnapshotListMaxResults        = 1000
	TaskBufferSize                = 256
	SchedulerTickInterval         = 8 * time.Second
	ScheduledSnapshotsBeforePrune = 16
)

Variables

View Source
var (
	SnapshotBlobPrefix     = []byte("arch-snap-blob-")
	SnapshotMetadataPrefix = []byte("arch-snap-metadata-")
	SchedulePrefix         = []byte("arch-schedule-")
)
View Source
var (
	ErrBlockNotFound     = errors.New("block not found")
	ErrSnapshotNotFound  = errors.New("snapshot not found")
	ErrSchedulerDisabled = errors.New("scheduler is disabled")
	ErrMissingBlob       = errors.New("missing blob")
)

Functions

func DeleteSchedule

func DeleteSchedule(db ethdb.KeyValueWriter, id uint64)

func DeleteSnapshotBlob

func DeleteSnapshotBlob(db ethdb.KeyValueWriter, address common.Address, storageRoot common.Hash)

func DeleteSnapshotMetadata

func DeleteSnapshotMetadata(db ethdb.KeyValueWriter, address common.Address, blockHash common.Hash)

func HasSnapshotBlob

func HasSnapshotBlob(db ethdb.KeyValueReader, address common.Address, storageRoot common.Hash) bool

func HasSnapshotBlobAnyAccount

func HasSnapshotBlobAnyAccount(db ethdb.Iteratee, storageRoot common.Hash) bool

func HasSnapshotMetadata

func HasSnapshotMetadata(db ethdb.KeyValueReader, address common.Address, storageRoot common.Hash) bool

func ReadSnapshotBlob

func ReadSnapshotBlob(db ethdb.KeyValueReader, address common.Address, storageRoot common.Hash) []byte

func ReadSnapshotBlobAnyAccount

func ReadSnapshotBlobAnyAccount(db ethdb.Iteratee, storageRoot common.Hash) []byte

func WriteSchedule

func WriteSchedule(db ethdb.KeyValueWriter, id uint64, schedule snapshot_types.Schedule)

func WriteSnapshotBlob

func WriteSnapshotBlob(db ethdb.KeyValueWriter, address common.Address, storageRoot common.Hash, storage []byte)

func WriteSnapshotMetadata

func WriteSnapshotMetadata(db ethdb.KeyValueWriter, metadata SnapshotMetadata)

Types

type Ethereum

type Ethereum interface {
	BlockChain() *core.BlockChain
	ChainDb() ethdb.Database
}

type Schedule

type Schedule = snapshot_types.Schedule

type ScheduleIterator

type ScheduleIterator struct {
	ethdb.Iterator
}

func IterateSchedules

func IterateSchedules(db ethdb.Iteratee) *ScheduleIterator

func (*ScheduleIterator) ID

func (it *ScheduleIterator) ID() uint64

func (*ScheduleIterator) Schedule

func (it *ScheduleIterator) Schedule() snapshot_types.Schedule

type Scheduler

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

func NewScheduler

func NewScheduler(db ethdb.Database, blockNumber uint64) *Scheduler

func (*Scheduler) AddSchedule

func (s *Scheduler) AddSchedule(schedule snapshot_types.Schedule, blockNumber uint64) (snapshot_types.ScheduleResponse, error)

func (*Scheduler) DeleteSchedule

func (s *Scheduler) DeleteSchedule(id uint64) error

func (*Scheduler) GetSchedules

func (s *Scheduler) GetSchedules() (map[uint64]snapshot_types.Schedule, error)

func (*Scheduler) RunSchedule

func (s *Scheduler) RunSchedule(blockNumber uint64, f func(schedule snapshot_types.Schedule)) bool

type SnapshotBlobIterator

type SnapshotBlobIterator struct {
	ethdb.Iterator
}

func IterateSnapshotBlobs

func IterateSnapshotBlobs(db ethdb.Iteratee) *SnapshotBlobIterator

func (*SnapshotBlobIterator) Address

func (it *SnapshotBlobIterator) Address() common.Address

func (*SnapshotBlobIterator) Blob

func (it *SnapshotBlobIterator) Blob() []byte

func (*SnapshotBlobIterator) StorageRoot

func (it *SnapshotBlobIterator) StorageRoot() common.Hash

type SnapshotMaker

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

func NewSnapshotMaker

func NewSnapshotMaker(enableScheduling bool) *SnapshotMaker

func (*SnapshotMaker) IsSchedulerEnabled

func (s *SnapshotMaker) IsSchedulerEnabled() bool

func (*SnapshotMaker) NewReader

func (s *SnapshotMaker) NewReader(ethereum Ethereum) SnapshotReader

func (*SnapshotMaker) NewWriter

func (s *SnapshotMaker) NewWriter(ethereum Ethereum) SnapshotWriter

func (*SnapshotMaker) RunScheduler

func (s *SnapshotMaker) RunScheduler()

func (*SnapshotMaker) RunSnapshotWorker

func (s *SnapshotMaker) RunSnapshotWorker()

type SnapshotMetadata

type SnapshotMetadata = snapshot_types.SnapshotMetadata

func ReadSnapshotMetadata

func ReadSnapshotMetadata(db ethdb.KeyValueReader, address common.Address, blockHash common.Hash) SnapshotMetadata

type SnapshotMetadataIterator

type SnapshotMetadataIterator struct {
	ethdb.Iterator
}

func IterateAccountSnapshotMetadata

func IterateAccountSnapshotMetadata(db ethdb.Iteratee, address common.Address) *SnapshotMetadataIterator

func IterateSnapshotMetadata

func IterateSnapshotMetadata(db ethdb.Iteratee) *SnapshotMetadataIterator

func (*SnapshotMetadataIterator) Address

func (it *SnapshotMetadataIterator) Address() common.Address

func (*SnapshotMetadataIterator) BlockHash

func (it *SnapshotMetadataIterator) BlockHash() common.Hash

func (*SnapshotMetadataIterator) Metadata

type SnapshotQuery

type SnapshotQuery = snapshot_types.SnapshotQuery

type SnapshotReader

type SnapshotReader interface {
	Get(address common.Address, blockHash common.Hash) (SnapshotResponse, error)
	Last(address common.Address) (SnapshotMetadataWithStatus, error)
	List(address common.Address) ([]SnapshotMetadataWithStatus, error)
	GetSchedules() (map[uint64]snapshot_types.Schedule, error)
}

type SnapshotResponse

type SnapshotResponse = snapshot_types.SnapshotResponse

type SnapshotStatus

type SnapshotStatus = snapshot_types.SnapshotStatus

type SnapshotWriter

type SnapshotWriter interface {
	New(query SnapshotQuery) ([]SnapshotMetadataWithStatus, error)
	Update(query SnapshotQuery) ([]SnapshotMetadataWithStatus, error)
	Delete(query SnapshotQuery) error
	Prune() error
	AddSchedule(schedule snapshot_types.Schedule) (snapshot_types.ScheduleResponse, error)
	DeleteSchedule(id uint64) error
}

type WorkerTask

type WorkerTask struct {
	Metadata  SnapshotMetadata
	Replace   bool
	BlockRoot common.Hash
	BlockHash common.Hash
	CopyFrom  common.Address
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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