powergate: github.com/textileio/powergate/chainstore Index | Files

package chainstore

import "github.com/textileio/powergate/chainstore"


Package Files


type Store Uses

type Store struct {
    // contains filtered or unexported fields

Store allows to save snapshoted state.

func New Uses

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

New returns a new Store.

func (*Store) GetLastCheckpoint Uses

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 Uses

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 Uses

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 Uses

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

TipsetOrderer resolves ordering information between TipSets.

Package chainstore imports 11 packages (graph) and is imported by 6 packages. Updated 2020-09-21. Refresh now. Tools for package owners.