Documentation
¶
Index ¶
- Variables
- func DeriveMigrationAccount(source ed25519.PublicKey, secret []byte) (ed25519.PublicKey, ed25519.PrivateKey, error)
- func HasMigrationHeader(ctx context.Context) (bool, error)
- func MarkComplete(ctx context.Context, store Store, account ed25519.PublicKey, prev State) error
- func MigrateBatch(ctx context.Context, m Migrator, accounts ...ed25519.PublicKey) error
- type Migrator
- type State
- type Status
- type Store
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrMultisig = errors.New("multisig wallet") ErrNotFound = errors.New("account not found") ErrBurned = errors.New("account was burned") )
View Source
var ErrStatusMismatch = errors.New("previous state does not match stored")
ErrStatusMismatch indicates the expected previous state was not what was stored.
Functions ¶
func DeriveMigrationAccount ¶ added in v0.2.6
func DeriveMigrationAccount(source ed25519.PublicKey, secret []byte) (ed25519.PublicKey, ed25519.PrivateKey, error)
DeriveMigrationAccount derives a migration account address.
func HasMigrationHeader ¶ added in v0.2.6
HasMigrationHeader indicates whether or not the provided context contains a header indicating a migration should occur.
func MarkComplete ¶ added in v0.2.6
MarkComplete is a utility function to mark the state for an account as complete.
Types ¶
type Migrator ¶ added in v0.2.6
type Migrator interface {
// InitiateMigration initiates a migration for a given account.
//
// The commitment provided indicates the commitment that should be used for
// transactions and queries before returning. It should be noted that any
// commitment less than MAX will not mark a migration as completed.
InitiateMigration(context.Context, ed25519.PublicKey, solana.Commitment) error
}
func NewContextAwareMigrator ¶ added in v0.2.6
func NewNoopMigrator ¶ added in v0.2.6
func NewNoopMigrator() Migrator
func NewTeeMigrator ¶ added in v0.2.6
type Status ¶
type Status int
Status is the 'marked' status of a migration.
The source of truth for an account's migration status is completely recoverable from the chain, and will be used as a fallback. If the status is marked as complete, the migrators will _not_ consult the chain.
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
}
Click to show internal directories.
Click to hide internal directories.