accountinfo

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAccountInfoNotFound = errors.New("account info not found")
)
View Source
var (
	ErrNotFound = errors.New("account info not found")
)

Functions

This section is empty.

Types

type Cache

type Cache interface {
	// Put puts a list of account info associated with the given owner.
	Put(ctx context.Context, info *accountpb.AccountInfo) error

	// Get gets an account's info, if it exists in the cache.
	//
	// ErrAccountInfoNotFound is returned if no account info was found for the provided key.
	Get(ctx context.Context, key ed25519.PublicKey) (*accountpb.AccountInfo, error)

	// Delete a cached entry.
	Del(ctx context.Context, key ed25519.PublicKey) (ok bool, err error)
}

type State

type State struct {
	Account ed25519.PublicKey
	Owner   ed25519.PublicKey
	Balance int64
	Slot    uint64
}

type StateStore

type StateStore interface {
	// Put puts an account's state into the store.
	Put(ctx context.Context, state *State) error

	// Get gets an account's state, if it exists in the store.
	//
	// ErrNotFound is returned if no account state was found for the provided key.
	Get(ctx context.Context, account ed25519.PublicKey) (*State, error)

	// Delete deletes an account's state.
	//
	// Delete is idempotent
	Delete(ctx context.Context, account ed25519.PublicKey) error

	// Returns token accounts by owner
	//
	// If no token accounts are associated with the owner, an empty slice will be returned.
	GetAccountsByOwner(ctx context.Context, owner ed25519.PublicKey) ([]ed25519.PublicKey, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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