Documentation
¶
Overview ¶
Package postgres provides a PostgreSQL implementation of store.Store using grove ORM.
Index ¶
- Variables
- type Store
- func (s *Store) Close() error
- func (s *Store) Keys() key.Store
- func (s *Store) Migrate(ctx context.Context) error
- func (s *Store) Ping(ctx context.Context) error
- func (s *Store) Policies() policy.Store
- func (s *Store) Rotations() rotation.Store
- func (s *Store) Scopes() scope.Store
- func (s *Store) Usages() usage.Store
Constants ¶
This section is empty.
Variables ¶
var Migrations = migrate.NewGroup("keysmith")
Migrations is the grove migration group for the Keysmith Postgres store. Each migration lives in a file of its own, named <14 digit version>_<name>.go, and registers itself with Migrations.Add.
Store.Migrate runs the group through grove's orchestrator, which takes the migration lock first, so several processes can start against one database at once. A host that runs its migrations centrally can register this group with its own orchestrator instead and turn Store.Migrate off (the Forge extension's WithDisableMigrate).
The versions and names match the ones keysmith has always recorded in grove_migrations, so a database that already applied them skips them.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the PostgreSQL-backed store implementation using grove ORM.
func NewFromDSN ¶
NewFromDSN creates a new PostgreSQL store by connecting to the given DSN.
func (*Store) Migrate ¶
Migrate applies the pending migrations in Migrations through grove's orchestrator. It holds grove's migration lock (a Postgres advisory lock) while it runs, so nodes that start together against one database take turns, and every one after the first finds nothing left to apply.
Source Files
¶
- 20240101000001_create_keys.go
- 20240101000002_create_policies.go
- 20240101000003_create_scopes.go
- 20240101000004_create_usage.go
- 20240101000005_create_rotations.go
- 20260930000001_rotation_hints_and_old_hash_index.go
- 20260930000002_drop_usage_agg.go
- 20260930000003_close_legacy_grace.go
- 20261007000001_key_version.go
- helpers.go
- key.go
- migrations.go
- models.go
- policy.go
- rotation.go
- scope.go
- store.go
- usage.go