Documentation
¶
Overview ¶
Package filecache provides a local filesystem-backed implementation of cache.ReadWriterOf[blob.Entry] with persistent snapshots and immutable blob files.
Index ¶
- func PrefixSplit(lengths ...int) func(version string) []string
- type Config
- type Storage
- func (s *Storage[K]) Close() error
- func (s *Storage[K]) Delete(ctx context.Context, key K) error
- func (s *Storage[K]) Read(ctx context.Context, key K) (blob.Entry, error)
- func (s *Storage[K]) Write(ctx context.Context, key K, entry blob.Entry) error
- func (s *Storage[K]) WriteAndRead(ctx context.Context, key K, entry blob.Entry) (_ blob.Entry, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrefixSplit ¶ added in v0.5.0
PrefixSplit creates a version path splitter that uses consecutive prefix lengths as nested directory names. For example PrefixSplit(1) uses the first character, and PrefixSplit(2, 2) matches the default layout.
Types ¶
type Config ¶ added in v0.5.0
type Config[K comparable] struct { // IndexPolicy configures the in-memory index backend. IndexPolicy cache.Policy // RetentionPolicy configures blob-storage retention and eviction behavior. blob.RetentionPolicy // IndexShardFunc customizes shard selection in the typed in-memory index. IndexShardFunc func(K) uint64 // SplitPath converts a version into nested path segments under data dir. // If nil, two 2-character prefix directories are used. SplitPath func(version string) []string }
Config controls file-backed storage layout and index behavior.
type Storage ¶
type Storage[K comparable] struct { // contains filtered or unexported fields }
Storage is a local filesystem-backed blob storage.
func NewStorage ¶
func NewStorage[K comparable](path string, options ...func(cfg *Config[K])) (*Storage[K], error)
NewStorage creates a local filesystem-backed blob storage.
Click to show internal directories.
Click to hide internal directories.