storage

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSlaveMutable = errors.New("mutable transaction on slave")
)

Functions

This section is empty.

Types

type Builder added in v1.2.0

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

func (*Builder) Build added in v1.2.0

func (b *Builder) Build(logger *slog.Logger, conf *config.Config) (*Storage, error)

type Engine

type Engine interface {
	Set(ctx context.Context, key, value string) error
	Get(ctx context.Context, key string) (string, error)
	Del(ctx context.Context, key string) error
}

type Option added in v1.2.0

type Option func(s *Storage)

func WithEngine added in v1.2.0

func WithEngine(e Engine) Option

func WithReplica added in v1.2.0

func WithReplica(r Replica) Option

func WithWAL added in v1.2.0

func WithWAL(w WAL) Option

type Replica added in v1.2.0

type Replica interface {
	IsSlave() bool
	Shutdown(ctx context.Context) error
}

type SlaveReplica added in v1.2.0

type SlaveReplica interface {
	StartHandle(fn func(cid compute.CommandID, args []string) error)
}

type Storage added in v1.1.0

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

func NewStorage added in v1.1.0

func NewStorage(opts ...Option) (*Storage, error)

func (*Storage) Del added in v1.1.0

func (s *Storage) Del(ctx context.Context, key string) error

func (*Storage) Get added in v1.1.0

func (s *Storage) Get(ctx context.Context, key string) (string, error)

func (*Storage) Set added in v1.1.0

func (s *Storage) Set(ctx context.Context, key, value string) error

func (*Storage) Shutdown added in v1.1.0

func (s *Storage) Shutdown(ctx context.Context) error

type WAL added in v1.1.0

type WAL interface {
	Append(cid compute.CommandID, args []string) concurrency.FutureError
	Restore(fn func(cid compute.CommandID, args []string) error) error
	Shutdown(ctx context.Context) error
}

Directories

Path Synopsis
wal

Jump to

Keyboard shortcuts

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