storage

package
v1.11.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConfigurationNotFound = errors.New("configuration not found")
)
View Source
var (
	ErrLedgerStoreNotFound = errors.New("ledger store not found")
)

Functions

func CommitTransaction added in v1.8.0

func CommitTransaction(ctx context.Context) error

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 IsTransactionRegistered added in v1.8.0

func IsTransactionRegistered(ctx context.Context) bool

func IsTransactional added in v1.8.0

func IsTransactional(ctx context.Context) bool

func OnTransactionCommitted added in v1.10.6

func OnTransactionCommitted(ctx context.Context, callback func())

func RegisterTransaction added in v1.8.0

func RegisterTransaction(ctx context.Context, transaction any,
	commitFn func(ctx context.Context) error, rollbackFn func(ctx context.Context) error)

func RegisteredTransaction added in v1.8.0

func RegisteredTransaction(ctx context.Context) any

func RollbackTransaction added in v1.8.0

func RollbackTransaction(ctx context.Context) error

func TransactionalContext added in v1.8.0

func TransactionalContext(ctx context.Context) context.Context

Types

type Code

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

type Driver

type Driver[STORE any] interface {
	LedgerStoreProvider[STORE]
	Initialize(ctx context.Context) error
	Close(ctx context.Context) error
	Name() string

	GetSystemStore() SystemStore
}

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 LedgerStore added in v1.8.0

type LedgerStore interface {
	Delete(ctx context.Context) error
	Initialize(ctx context.Context) (bool, error)
	Close(ctx context.Context) error
}

type LedgerStoreProvider added in v1.8.0

type LedgerStoreProvider[STORE any] interface {
	GetLedgerStore(ctx context.Context, name string, create bool) (STORE, bool, error)
}

type LedgerStoreProviderFn added in v1.8.0

type LedgerStoreProviderFn[STORE any] func(ctx context.Context, name string, create bool) (STORE, bool, error)

func (LedgerStoreProviderFn[STORE]) GetLedgerStore added in v1.8.0

func (fn LedgerStoreProviderFn[STORE]) GetLedgerStore(ctx context.Context, name string, create bool) (STORE, bool, error)

type SystemStore added in v1.8.0

type SystemStore interface {
	GetConfiguration(ctx context.Context, key string) (string, error)
	InsertConfiguration(ctx context.Context, key, value string) error
	ListLedgers(ctx context.Context) ([]string, error)
	DeleteLedger(ctx context.Context, name string) 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