Documentation
¶
Overview ¶
Package store is the Isopace persistence layer: a small collection/key/value Store interface for the durable records an operational deployment keeps — RBAC policy, configuration snapshots, audit summaries — kept deliberately narrow so it maps onto many backends.
MemStore is the in-process backend. A SQL-backed store is a drop-in adapter over the standard library's database/sql (the driver is the deployment's blank-import choice, so the core takes on no driver dependency); the durable space.Store is the queue analogue for store-and-forward. The PutJSON and GetJSON helpers marshal typed records over any Store.
Index ¶
- Variables
- func GetJSON[T any](ctx context.Context, s Store, collection, key string) (T, error)
- func PutJSON[T any](ctx context.Context, s Store, collection, key string, v T) error
- type MemStore
- func (m *MemStore) Close() error
- func (m *MemStore) Delete(_ context.Context, collection, key string) error
- func (m *MemStore) Get(_ context.Context, collection, key string) ([]byte, error)
- func (m *MemStore) List(_ context.Context, collection string) ([]string, error)
- func (m *MemStore) Put(_ context.Context, collection, key string, value []byte) error
- type Store
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("store: not found")
ErrNotFound is returned by Get for a missing collection/key.
Functions ¶
Types ¶
type MemStore ¶
type MemStore struct {
// contains filtered or unexported fields
}
MemStore is the in-process Store backend: a map of collections to key/value maps. Values are copied on Put and Get so a caller cannot mutate stored data through a returned slice.
type Store ¶
type Store interface {
Get(ctx context.Context, collection, key string) ([]byte, error)
Put(ctx context.Context, collection, key string, value []byte) error
Delete(ctx context.Context, collection, key string) error
List(ctx context.Context, collection string) ([]string, error)
Close() error
}
Store is a collection/key/value persistence interface. A collection is a namespace (like a table); within it, keys map to opaque byte values. Implementations must be safe for concurrent use.