history

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound      = errors.New("not found")
	ErrInvalidUpdate = errors.New("invalid update")
)

Functions

This section is empty.

Types

type ReadOptions

type ReadOptions struct {
	Descending bool
	Start      []byte
	Limit      int
}

func (*ReadOptions) GetDescending

func (r *ReadOptions) GetDescending() bool

func (*ReadOptions) GetLimit

func (r *ReadOptions) GetLimit() int

func (*ReadOptions) GetStart

func (r *ReadOptions) GetStart() []byte

type Reader

type Reader interface {
	// GetTransaction returns the model.Entry associated with the specified txHash.
	//
	// ErrNotFound is returned if no entry has been written.
	GetTransaction(ctx context.Context, txHash []byte) (*model.Entry, error)

	// GetAccountTransactions returns the model.Entry's with the specified options.
	//
	// If no options are specified, the results will be in ascending order starting
	// from the beginning (with an undefined limit).
	GetAccountTransactions(ctx context.Context, account string, opts *ReadOptions) ([]*model.Entry, error)

	// GetLatestForAccount returns the latest model.Entry in an accounts history.
	//
	// The entry is not guaranteed to be committed. As a result, it should be filtered
	// before being returned to callers / users.
	//
	// If no entries exist for the account, ErrNotFound is returned.
	GetLatestForAccount(ctx context.Context, account string) (*model.Entry, error)
}

type ReaderWriter

type ReaderWriter interface {
	Reader
	Writer
}

type Writer

type Writer interface {
	// Write writes a model.Entry to a history store.
	//
	// ErrInvalidUpdate is returned if the entry would overwrite
	// an existing entry in an invalid way. For example, revert the
	// transaction state to an earlier one.
	Write(context.Context, *model.Entry) error
}

Directories

Path Synopsis
dynamodb/committer
Package dynamodb implements a dynamodb backed ingestion.Committer.
Package dynamodb implements a dynamodb backed ingestion.Committer.

Jump to

Keyboard shortcuts

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