balance

package
v1.8.4 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCheckpointNotFound = errors.New("checkpoint not found")

	ErrStaleCheckpoint = errors.New("checkpoint is stale")
)

Functions

This section is empty.

Types

type Record

type Record struct {
	Id uint64

	TokenAccount   string
	Quarks         uint64
	SlotCheckpoint uint64

	LastUpdatedAt time.Time
}

Note: Only supports external balances

func (*Record) Clone

func (r *Record) Clone() Record

func (*Record) CopyTo

func (r *Record) CopyTo(dst *Record)

func (*Record) Validate

func (r *Record) Validate() error

type Store

type Store interface {
	// SaveCheckpoint saves a balance at a checkpoint. ErrStaleCheckpoint is returned
	// if the checkpoint is outdated
	SaveCheckpoint(ctx context.Context, record *Record) error

	// GetCheckpoint gets a balance checkpoint for a given account. ErrCheckpointNotFound
	// is returend if no DB record exists.
	GetCheckpoint(ctx context.Context, account string) (*Record, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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