storage

package
v1.8.3 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2025 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// services
	SvcEvictor         = "soft-eviction"
	SvcLifeTimeManager = "wrk-lifetime-manager"
	SvcForceGC         = "wrk-force-gc"
)

Variables

This section is empty.

Functions

func GetSingleMock added in v1.1.1

func GetSingleMock(i int, path []byte, cfg config.Config) *model.Entry

func GetSingleMockWith added in v1.4.3

func GetSingleMockWith(i int, path []byte, cfg config.Config, brotli bool) *model.Entry

GetSingleMockWith builds a single mock Entry for the given index/path/config. Brotli compression is controlled by the brotli flag.

func LoadMocks added in v0.9.8

func LoadMocks(ctx context.Context, cfg config.Config, storage Storage, num int)

func LoadMocksWith added in v1.4.3

func LoadMocksWith(ctx context.Context, cfg config.Config, storage Storage, num int, brotli bool)

LoadMocksWith generates and stores num mock entries asynchronously.

func StreamEntryPointersConsecutive added in v1.2.0

func StreamEntryPointersConsecutive(ctx context.Context, cfg config.Config, path []byte, num int) <-chan *model.Entry

func StreamEntryPointersConsecutiveWith added in v1.4.3

func StreamEntryPointersConsecutiveWith(ctx context.Context, cfg config.Config, path []byte, num int, brotli bool) <-chan *model.Entry

StreamEntryPointersConsecutiveWith streams num entries (ordered) with given brotli flag.

Types

type DB added in v1.3.0

type DB struct {
	*lru.InMemoryStorage
	// contains filtered or unexported fields
}

DB wraps the LRU storage and supervises worker groups through a Governor.

func New added in v1.4.4

New constructs the storage, wires workers and starts the governor. All transitions are done through the governor (no direct goroutine starts here).

func (*DB) Close added in v1.3.0

func (db *DB) Close() error

Close performs a graceful shutdown: dump (if enabled), stop LRU, then stop the governor.

type Dump

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

func (*Dump) Dump

func (d *Dump) Dump(ctx context.Context) error

func (*Dump) Load

func (d *Dump) Load(ctx context.Context) error

func (*Dump) LoadVersion added in v1.0.3

func (d *Dump) LoadVersion(ctx context.Context, v string) error

type Dumper

type Dumper interface {
	Dump(ctx context.Context) error
	Load(ctx context.Context) error
	LoadVersion(ctx context.Context, v string) error
}

type Storage

type Storage interface {
	Get(*model.Entry) (entry *model.Entry, hit bool)
	GetByKey(key uint64) (*model.Entry, bool)
	Set(entry *model.Entry) (persisted bool)
	WalkShards(ctx context.Context, fn func(key uint64, shard *sharded.Shard[*model.Entry]))
	Remove(*model.Entry) (freedBytes int64, hit bool)
	Stat() (bytes int64, length int64)
	Clear()
	Close() error
}

Storage is a generic interface for cache storages.

Directories

Path Synopsis
Package sharded implements a high‑throughput, zero‑allocation sharded map intended for in‑memory cache workloads.
Package sharded implements a high‑throughput, zero‑allocation sharded map intended for in‑memory cache workloads.

Jump to

Keyboard shortcuts

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