store

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package store defines the composite store interface for Keysmith.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeyNotFound      = errors.New("keysmith: key not found")
	ErrPolicyNotFound   = errors.New("keysmith: policy not found")
	ErrScopeNotFound    = errors.New("keysmith: scope not found")
	ErrRotationNotFound = errors.New("keysmith: rotation record not found")
)

Not-found sentinels. Every backend returns these (possibly wrapped), so callers can tell a missing row from a failed query with errors.Is. The root keysmith package re-exports them under the same names.

View Source
var ErrKeyConflict = errors.New("keysmith: key changed since it was read")

ErrKeyConflict is returned by key.Store.UpdateIfVersion when the key exists but its stored version is not the one the caller read: another write landed in between. Every backend returns it (possibly wrapped), and the root keysmith package re-exports it under the same name.

Functions

func NotFound

func NotFound(entity string) error

NotFound maps an entity name to its sentinel. Backends call it from their errNotFound helper.

Types

type Store

type Store interface {
	// Keys returns the key store.
	Keys() key.Store

	// Policies returns the policy store.
	Policies() policy.Store

	// Usages returns the usage store.
	Usages() usage.Store

	// Rotations returns the rotation store.
	Rotations() rotation.Store

	// Scopes returns the scope store.
	Scopes() scope.Store

	// Migrate runs database migrations.
	Migrate(ctx context.Context) error

	// Ping checks database connectivity.
	Ping(ctx context.Context) error

	// Close releases database resources.
	Close() error
}

Store composes all Keysmith subsystem stores via accessor methods. Implementations must provide all subsystem stores plus lifecycle methods.

Directories

Path Synopsis
Package memory provides an in-memory implementation of store.Store for testing.
Package memory provides an in-memory implementation of store.Store for testing.
Package mongo provides a MongoDB implementation of store.Store using grove ORM.
Package mongo provides a MongoDB implementation of store.Store using grove ORM.
Package postgres provides a PostgreSQL implementation of store.Store using grove ORM.
Package postgres provides a PostgreSQL implementation of store.Store using grove ORM.
Package sqlite provides a SQLite implementation of store.Store using grove ORM.
Package sqlite provides a SQLite implementation of store.Store using grove ORM.

Jump to

Keyboard shortcuts

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