store

package
v0.35.27 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Overview

Package store provides a configuration-driven registry for logical stores. Logical stores reference physical backends from store/storage and can expose scoped views such as prefixed KV stores.

Index

Constants

View Source
const (
	KindKeyValue    = "keyvalue"
	KindMetrics     = "metrics"
	KindLog         = "log"
	KindObjectStore = "objectstore"
	KindSQL         = "sql"
)

Kind constants for logical store categories.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Kind     string
	Storage  string // reference to a physical storage backend
	Prefix   string // logical key prefix; SQL KV uses one segment as its table name
	Database string
	Table    string
	TopicID  string
	TTL      time.Duration
}

Config describes one logical Store entry. Serialization belongs to callers.

stores:
  peers:
    kind: keyvalue
    storage: main-kv
    prefix: peers

type ConfigError

type ConfigError struct {
	Name string
	Err  error
}

ConfigError identifies the logical Store entry whose construction failed.

func (*ConfigError) Error

func (e *ConfigError) Error() string

Error preserves the underlying construction error text.

func (*ConfigError) Unwrap

func (e *ConfigError) Unwrap() error

Unwrap exposes the underlying construction error.

type Stores

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

Stores holds named logical store instances created eagerly by New.

func New

func New(configs map[string]Config, physical *storage.Storage) (*Stores, error)

New creates logical stores on top of already-opened physical storage backends. TiKV roots start a bounded expiration worker owned by Stores; Close cancels and joins it. The caller owns the physical storage lifecycle and must close Stores before Storage.

func (*Stores) Close

func (r *Stores) Close() error

Close releases logical stores. Physical storage is always caller-owned.

func (*Stores) KV

func (r *Stores) KV(name string) (kv.Store, error)

KV returns the named kv.Store.

func (*Stores) Log

func (r *Stores) Log(name string) (logstore.Store, error)

Log returns the named logstore.Store.

func (*Stores) Metrics

func (r *Stores) Metrics(name string) (metrics.Store, error)

Metrics returns the named metrics.Store.

func (*Stores) ObjectStore

func (r *Stores) ObjectStore(name string) (objectstore.ObjectStore, error)

ObjectStore returns the named objectstore.ObjectStore.

func (*Stores) SQL

func (r *Stores) SQL(name string) (*sqlx.DB, error)

SQL returns the named *sqlx.DB.

func (*Stores) TTL added in v0.11.0

func (r *Stores) TTL(name string) (time.Duration, error)

TTL returns the initialization-time retention of one logical Store.

Directories

Path Synopsis
Package kv provides a key-value store interface with hierarchical path-based keys.
Package kv provides a key-value store interface with hierarchical path-based keys.
Package logstore defines structured records and queries for logging services.
Package logstore defines structured records and queries for logging services.
Package memory defines provider-neutral facts and ordered conversation history.
Package memory defines provider-neutral facts and ordered conversation history.
Package metrics defines a business-neutral store for numeric time series samples.
Package metrics defines a business-neutral store for numeric time series samples.
Package objectstore defines a generic object storage abstraction.
Package objectstore defines a generic object storage abstraction.
Package sqlmeta validates SQL Store tables and metadata on borrowed pools.
Package sqlmeta validates SQL Store tables and metadata on borrowed pools.
Package storage provides a configuration-driven registry for physical storage backends.
Package storage provides a configuration-driven registry for physical storage backends.
Package vecid assigns stable string IDs to embedding vectors via online nearest-centroid matching and offline DBSCAN re-clustering.
Package vecid assigns stable string IDs to embedding vectors via online nearest-centroid matching and offline DBSCAN re-clustering.
Package vecstore provides a vector approximate nearest-neighbor (ANN) search interface and implementations.
Package vecstore provides a vector approximate nearest-neighbor (ANN) search interface and implementations.

Jump to

Keyboard shortcuts

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