statestore

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2021 License: Apache-2.0, MIT Imports: 9 Imported by: 1

Documentation

Overview

Package statestore provides an abstraction on top of go-statestore that allows you to make a StateStore that tracks its own version and knows how to migrate itself to the target version

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StateStore

type StateStore interface {
	Begin(i interface{}, state interface{}) error
	Get(i interface{}) StoredState
	Has(i interface{}) (bool, error)
	List(out interface{}) error
}

StateStore is a wrapper around a datastore for saving CBOR encoded structs

func NewMigratedStateStore

func NewMigratedStateStore(ss *statestore.StateStore, ms versioning.MigrationState) StateStore

NewMigratedStateStore returns an fsm whose functions will fail until the migration state says its ready

func NewVersionedStateStore

func NewVersionedStateStore(ds datastore.Batching, migrations versioning.VersionedMigrationList, target versioning.VersionKey) (StateStore, func(context.Context) error)

NewVersionedStateStore sets takes a datastore, fsm parameters, migrations list, and target version, and returns an fsm whose functions will fail till it's migrated to the target version and a function to run migrations

type StoredState

type StoredState interface {
	End() error
	Get(out cbg.CBORUnmarshaler) error
	Mutate(mutator interface{}) error
}

StoredState is an interface for accessing state

Jump to

Keyboard shortcuts

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