libkvstore

package
v1.0.0-rc.9 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const SQLiteSchema = `` /* 194-byte string literal not displayed */

Variables

View Source
var (
	ErrNotFound         = errors.New("key not found")
	ErrInvalidValue     = errors.New("invalid value for operation")
	ErrKeyExists        = errors.New("key already exists")
	ErrTxFailed         = errors.New("transaction failed")
	ErrTxConflict       = errors.New("transaction conflict")
	ErrLockUnavailable  = errors.New("lock unavailable")
	ErrConnectionFailed = errors.New("connection failed")
)

Functions

func SetupLocalPDInstance

func SetupLocalPDInstance(ctx context.Context) (string, testcontainers.Container, func(), error)

func SetupLocalTiKVInstance

func SetupLocalTiKVInstance(ctx context.Context) (string, testcontainers.Container, func(), error)

func SetupLocalValKeyInstance

func SetupLocalValKeyInstance(ctx context.Context) (string, testcontainers.Container, func(), error)

Types

type Config

type Config struct {
	KVAddr      string `json:"kv_addr"`
	KVUsername  string `json:"kv_username,omitempty"`
	KVPassword  string `json:"kv_password,omitempty"`
	KVDB        int    `json:"kv_db,omitempty"`
	KVNamespace string `json:"kv_namespace,omitempty"`
}

type KVExecutor

type KVExecutor interface {
	Get(ctx context.Context, key Key) (json.RawMessage, error)
	Set(ctx context.Context, key Key, value json.RawMessage) error
	SetWithTTL(ctx context.Context, key Key, value json.RawMessage, ttl time.Duration) error
	Delete(ctx context.Context, key Key) error
	Exists(ctx context.Context, key Key) (bool, error)
	Keys(ctx context.Context, pattern string) ([]Key, error)

	ListPush(ctx context.Context, key Key, value json.RawMessage) error
	ListRange(ctx context.Context, key Key, start, stop int64) ([]json.RawMessage, error)
	ListTrim(ctx context.Context, key Key, start, stop int64) error
	ListLength(ctx context.Context, key Key) (int64, error)
	ListRPop(ctx context.Context, key Key) (json.RawMessage, error)

	SetAdd(ctx context.Context, key Key, member json.RawMessage) error
	SetMembers(ctx context.Context, key Key) ([]json.RawMessage, error)
	SetRemove(ctx context.Context, key Key, member json.RawMessage) error
}

type KVManager

type KVManager interface {
	Executor(ctx context.Context) (KVExecutor, error)
	Close() error
}

type Key

type Key = string

type KeyValue

type KeyValue struct {
	Key   string
	Value json.RawMessage
	TTL   time.Time
}

type SQLiteManager added in v0.28.0

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

func NewSQLiteManager added in v0.28.0

func NewSQLiteManager(db libdbexec.DBManager) *SQLiteManager

func (*SQLiteManager) Close added in v0.28.0

func (m *SQLiteManager) Close() error

func (*SQLiteManager) Executor added in v0.28.0

func (m *SQLiteManager) Executor(_ context.Context) (KVExecutor, error)

type VKExecutor

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

func (*VKExecutor) Delete

func (r *VKExecutor) Delete(ctx context.Context, key Key) error

func (*VKExecutor) Exists

func (r *VKExecutor) Exists(ctx context.Context, key Key) (bool, error)

func (*VKExecutor) Get

func (r *VKExecutor) Get(ctx context.Context, key Key) (json.RawMessage, error)

func (*VKExecutor) Keys

func (r *VKExecutor) Keys(ctx context.Context, pattern string) ([]Key, error)

func (*VKExecutor) ListLength

func (r *VKExecutor) ListLength(ctx context.Context, key Key) (int64, error)

func (*VKExecutor) ListPush

func (r *VKExecutor) ListPush(ctx context.Context, key Key, value json.RawMessage) error

func (*VKExecutor) ListRPop

func (r *VKExecutor) ListRPop(ctx context.Context, key Key) (json.RawMessage, error)

func (*VKExecutor) ListRange

func (r *VKExecutor) ListRange(ctx context.Context, key Key, start, stop int64) ([]json.RawMessage, error)

func (*VKExecutor) ListTrim

func (r *VKExecutor) ListTrim(ctx context.Context, key Key, start, stop int64) error

func (*VKExecutor) Set

func (r *VKExecutor) Set(ctx context.Context, key Key, value json.RawMessage) error

func (*VKExecutor) SetAdd

func (r *VKExecutor) SetAdd(ctx context.Context, key Key, member json.RawMessage) error

func (*VKExecutor) SetMembers

func (r *VKExecutor) SetMembers(ctx context.Context, key Key) ([]json.RawMessage, error)

func (*VKExecutor) SetRemove

func (r *VKExecutor) SetRemove(ctx context.Context, key Key, member json.RawMessage) error

func (*VKExecutor) SetWithTTL

func (r *VKExecutor) SetWithTTL(ctx context.Context, key Key, value json.RawMessage, ttl time.Duration) error

type VKManager

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

func NewManager

func NewManager(cfg Config, ttl time.Duration) (*VKManager, error)

func (*VKManager) Close

func (m *VKManager) Close() error

func (*VKManager) Executor

func (m *VKManager) Executor(ctx context.Context) (KVExecutor, error)

Jump to

Keyboard shortcuts

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