migration

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrStatusMismatch = errors.New("previous state does not match stored")

ErrStatusMismatch indicates the expected previous state was not what was stored.

Functions

This section is empty.

Types

type State

type State struct {
	Status       Status
	Signature    solana.Signature
	LastModified time.Time
}

State represents the recorded migration state about an account.

var ZeroState State

type Status

type Status int

Status is the 'marked' status of a migration.

const (
	// StatusNone indicates either no migration has occurred, or no
	// information about a migration is stored.
	StatusNone Status = iota

	// StatusInProgress indicates that a migration transaction was
	// likely submitted, but its result is unknown.
	StatusInProgress

	// StatusComplete indicates that a migration transaction reached
	// max lockout with certainty.
	StatusComplete
)

type Store

type Store interface {
	// Get returns the recorded state, if any, for an account.
	//
	// ZeroState is returned if there is no persisted state.
	Get(ctx context.Context, account ed25519.PublicKey) (State, error)

	// Update updates the state for an account. The previous state must match
	// what was stored. Implementations must support atomic compare-and-swap.
	Update(ctx context.Context, account ed25519.PublicKey, prev, next State) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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