storage

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: May 27, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsError added in v1.0.4

func IsError(err error) bool

func IsErrorCode added in v1.0.4

func IsErrorCode(err error, code Code) bool

func IsTooManyClientError added in v1.0.4

func IsTooManyClientError(err error) bool

func NewCachedStateStorage

func NewCachedStateStorage(underlying Store) *cachedStateStorage

func NoOpDriver added in v1.3.2

func NoOpDriver() *noOpDriver

func NoOpStore

func NoOpStore() *noOpStore

Types

type CachedStorageDriver added in v1.3.2

type CachedStorageDriver struct {
	Driver
}

func NewCachedStorageDriver added in v1.3.2

func NewCachedStorageDriver(underlying Driver) *CachedStorageDriver

func (*CachedStorageDriver) GetStore added in v1.3.2

func (f *CachedStorageDriver) GetStore(ctx context.Context, name string, create bool) (Store, bool, error)

type Code

type Code string
const (
	ConstraintFailed Code = "CONSTRAINT_FAILED"
	TooManyClient    Code = "TOO_MANY_CLIENT"
	Unknown          Code = "UNKNOWN"
)

type Driver

type Driver interface {
	Initialize(ctx context.Context) error
	GetStore(ctx context.Context, name string, create bool) (Store, bool, error)
	Close(ctx context.Context) error
	List(ctx context.Context) ([]string, error)
	DeleteStore(ctx context.Context, name string) error
	Name() string
}

type Error

type Error struct {
	Code          Code
	OriginalError error
}

func NewError

func NewError(code Code, originalError error) *Error

func (Error) Error

func (e Error) Error() string

func (Error) Is added in v1.0.4

func (e Error) Is(err error) bool

type Store

type Store interface {
	GetLastTransaction(ctx context.Context) (*core.Transaction, error)
	CountTransactions(context.Context, query.Query) (uint64, error)
	GetTransactions(context.Context, query.Query) (sharedapi.Cursor, error)
	GetTransaction(context.Context, uint64) (core.Transaction, error)
	GetAccount(context.Context, string) (core.Account, error)
	AggregateVolumes(context.Context, string) (core.Volumes, error)
	CountAccounts(context.Context, query.Query) (uint64, error)
	GetAccounts(context.Context, query.Query) (sharedapi.Cursor, error)

	AppendLog(ctx context.Context, log ...core.Log) error
	LastLog(ctx context.Context) (*core.Log, error)
	Logs(ctx context.Context) ([]core.Log, error)

	LoadMapping(ctx context.Context) (*core.Mapping, error)
	SaveMapping(ctx context.Context, m core.Mapping) error
	Initialize(context.Context) (bool, error)
	Name() string
	Close(context.Context) error
}

Directories

Path Synopsis
File is part of the build only if cgo is enabled.
File is part of the build only if cgo is enabled.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳