storage

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAborted = errors.New("aborted transactions")

Functions

func DefaultModule

func DefaultModule() fx.Option

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 NewRememberConfigStorage

func NewRememberConfigStorage(underlying Store, logger logging.Logger) *rememberConfigStorage

func NoOpStore

func NoOpStore() *noOpStore

Types

type BuiltInFactory

type BuiltInFactory struct {
	Driver Driver
}

func (*BuiltInFactory) Close

func (f *BuiltInFactory) Close(ctx context.Context) error

func (*BuiltInFactory) GetStore

func (f *BuiltInFactory) GetStore(name string) (Store, error)

type CachedStorageFactory

type CachedStorageFactory struct {
	// contains filtered or unexported fields
}

func NewCachedStorageFactory

func NewCachedStorageFactory(underlying Factory) *CachedStorageFactory

func (*CachedStorageFactory) Close

func (f *CachedStorageFactory) Close(ctx context.Context) error

func (*CachedStorageFactory) GetStore

func (f *CachedStorageFactory) GetStore(name string) (Store, 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
	NewStore(name string) (Store, error)
	Close(ctx context.Context) 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 Factory

type Factory interface {
	GetStore(name string) (Store, error)
	Close(ctx context.Context) error
}

func NewDefaultFactory

func NewDefaultFactory(driver Driver) Factory

func NoOpFactory

func NoOpFactory() Factory

type RememberConfigStorageFactory

type RememberConfigStorageFactory struct {
	Factory
	// contains filtered or unexported fields
}

func NewRememberConfigStorageFactory

func NewRememberConfigStorageFactory(underlying Factory) *RememberConfigStorageFactory

func (*RememberConfigStorageFactory) GetStore

func (f *RememberConfigStorageFactory) GetStore(name string) (Store, error)

type Store

type Store interface {
	LastTransaction(context.Context) (*core.Transaction, error)
	LastMetaID(context.Context) (int64, error)
	SaveTransactions(context.Context, []core.Transaction) (map[int]error, error)
	CountTransactions(context.Context) (int64, error)
	FindTransactions(context.Context, query.Query) (query.Cursor, error)
	GetTransaction(context.Context, string) (core.Transaction, error)
	AggregateBalances(context.Context, string) (map[string]int64, error)
	AggregateVolumes(context.Context, string) (map[string]map[string]int64, error)
	CountAccounts(context.Context) (int64, error)
	FindAccounts(context.Context, query.Query) (query.Cursor, error)
	SaveMeta(context.Context, int64, string, string, string, string, string) error
	GetMeta(context.Context, string, string) (core.Metadata, error)
	CountMeta(context.Context) (int64, error)
	LoadMapping(ctx context.Context) (*core.Mapping, error)
	SaveMapping(ctx context.Context, m core.Mapping) error
	Initialize(context.Context) 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