chainstore

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store allows to save snapshoted state.

func New

func New(ds datastore.TxnDatastore, fr TipsetOrderer) (*Store, error)

New returns a new Store.

func (*Store) GetLastCheckpoint

func (s *Store) GetLastCheckpoint(v interface{}) (*types.TipSetKey, error)

GetLastCheckpoint returns the most recent saved state, and its TipSetKey. In case none exist, it will return a nil TipSetKey.

func (*Store) LoadAndPrune

func (s *Store) LoadAndPrune(ctx context.Context, currHead types.TipSetKey, value interface{}) (*types.TipSetKey, error)

LoadAndPrune loads into value the last saved state before the currHead tipset branch, and returns the TipSetKey of that state. If currHead invalidates saved checkpoints those will be deleted (auto-pruning).

func (*Store) Save

func (s *Store) Save(ctx context.Context, ts types.TipSetKey, state interface{}) error

Save saves a new current state which should be a child of the last known checkpoint.

type TipsetOrderer

type TipsetOrderer interface {
	Precedes(ctx context.Context, from, to types.TipSetKey) (bool, error)
}

TipsetOrderer resolves ordering information between TipSets.

Jump to

Keyboard shortcuts

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