memory

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package memory provides an in-memory registry.Store for tests, examples and single-process use.

Nothing persists. It holds the whole registry under one mutex, so every operation is atomic by construction, which makes it the reference the SQL store is compared against by the shared conformance suite.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store is an in-memory registry. It is safe for concurrent use.

func NewStore

func NewStore() *Store

NewStore returns an empty registry.

func (*Store) ActiveKEK

func (s *Store) ActiveKEK(ctx context.Context, purpose keyforge.Purpose) (keyforge.KEKVersion, error)

ActiveKEK implements keyforge.Store.

func (*Store) AddVersion

func (s *Store) AddVersion(ctx context.Context, v registry.VersionRecord) error

AddVersion implements registry.Store.

func (*Store) AdvanceDEK

func (s *Store) AdvanceDEK(ctx context.Context, purpose keyforge.Purpose, subject string, from uint32, next keyforge.DEKRecord) (keyforge.DEKRecord, error)

AdvanceDEK implements keyforge.Store.

func (*Store) Bootstrap

func (s *Store) Bootstrap(ctx context.Context, purpose keyforge.Purpose, ref provider.KeyRef, version uint32, at time.Time) error

Bootstrap registers a KEK for a purpose with its first version active, which is the usual starting point for a test or an example.

func (*Store) CompleteShred

func (s *Store) CompleteShred(ctx context.Context, purpose keyforge.Purpose, subject string, at time.Time) (registry.ShredRecord, error)

CompleteShred implements registry.Store.

func (*Store) CountDEKStates

func (s *Store) CountDEKStates(ctx context.Context, purpose keyforge.Purpose) (map[keyforge.DEKState]int, error)

CountDEKStates implements registry.Store.

func (*Store) CountDEKs

func (s *Store) CountDEKs(ctx context.Context, kekID envelope.ID, version uint32) (int, error)

CountDEKs implements registry.Store.

func (*Store) CreateKEK

func (s *Store) CreateKEK(ctx context.Context, k registry.KEK) error

CreateKEK implements registry.Store.

func (*Store) CurrentDEK

func (s *Store) CurrentDEK(ctx context.Context, purpose keyforge.Purpose, subject string) (keyforge.DEKRecord, error)

CurrentDEK implements keyforge.Store.

func (*Store) GetDEK

func (s *Store) GetDEK(ctx context.Context, id envelope.ID) (keyforge.DEKRecord, error)

GetDEK implements keyforge.Store.

func (*Store) GetKEK

func (s *Store) GetKEK(ctx context.Context, id envelope.ID) (registry.KEK, error)

GetKEK implements registry.Store.

func (*Store) GetSentinel

func (s *Store) GetSentinel(ctx context.Context, kekID envelope.ID, version uint32) (registry.Sentinel, error)

GetSentinel implements registry.Store.

func (*Store) GetShred

func (s *Store) GetShred(ctx context.Context, purpose keyforge.Purpose, subject string) (registry.ShredRecord, error)

GetShred implements registry.Store.

func (*Store) GetVersion

func (s *Store) GetVersion(ctx context.Context, kekID envelope.ID, version uint32) (registry.VersionRecord, error)

GetVersion implements registry.Store.

func (*Store) KEK

func (s *Store) KEK(ctx context.Context, id envelope.ID) (provider.KeyRef, error)

KEK implements keyforge.Store.

func (*Store) KEKForPurpose

func (s *Store) KEKForPurpose(ctx context.Context, purpose keyforge.Purpose) (registry.KEK, error)

KEKForPurpose implements registry.Store.

func (*Store) KEKVersionUsable

func (s *Store) KEKVersionUsable(ctx context.Context, id envelope.ID, version uint32) (bool, error)

KEKVersionUsable implements keyforge.Store.

func (*Store) ListDEKs

func (s *Store) ListDEKs(ctx context.Context, f registry.DEKFilter) ([]keyforge.DEKRecord, error)

ListDEKs implements registry.Store.

func (*Store) ListKEKs

func (s *Store) ListKEKs(ctx context.Context) ([]registry.KEK, error)

ListKEKs implements registry.Store.

func (*Store) ListSentinels

func (s *Store) ListSentinels(ctx context.Context, kekID envelope.ID) ([]registry.Sentinel, error)

ListSentinels implements registry.Store.

func (*Store) ListShreds

func (s *Store) ListShreds(ctx context.Context) ([]registry.ShredRecord, error)

ListShreds implements registry.Store.

func (*Store) ListVersions

func (s *Store) ListVersions(ctx context.Context, kekID envelope.ID) ([]registry.VersionRecord, error)

ListVersions implements registry.Store.

func (*Store) MarkDEK

func (s *Store) MarkDEK(ctx context.Context, id envelope.ID, to keyforge.DEKState) error

MarkDEK implements registry.Store.

func (*Store) PutSentinel

func (s *Store) PutSentinel(ctx context.Context, sn registry.Sentinel) error

PutSentinel implements registry.Store.

func (*Store) ReserveEncryptions

func (s *Store) ReserveEncryptions(ctx context.Context, id envelope.ID, n, limit uint64) (uint64, error)

ReserveEncryptions implements keyforge.Store.

func (*Store) RewrapDEK

func (s *Store) RewrapDEK(ctx context.Context, r registry.Rewrap) error

RewrapDEK implements registry.Store.

func (*Store) ShredSubject

func (s *Store) ShredSubject(ctx context.Context, purpose keyforge.Purpose, subject string, at time.Time) (registry.ShredRecord, error)

ShredSubject implements registry.Store.

func (*Store) TransitionVersion

func (s *Store) TransitionVersion(ctx context.Context, kekID envelope.ID, version uint32, to registry.VersionState, opts registry.TransitionOptions) error

TransitionVersion implements registry.Store.

Jump to

Keyboard shortcuts

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