Documentation
¶
Overview ¶
Package memory provides a fully in-memory implementation of store.Store. Safe for concurrent access. Intended for unit testing and development.
Index ¶
- type Store
- func (m *Store) ClaimDueRotation(_ context.Context, key, appID string, now, until time.Time) (bool, error)
- func (m *Store) Close() error
- func (m *Store) CountAudit(_ context.Context, appID string) (int64, error)
- func (m *Store) CountAuditMatching(_ context.Context, appID string, opts audit.ListOpts) (int64, error)
- func (m *Store) CountConfig(_ context.Context, appID string) (int64, error)
- func (m *Store) CountConfigMatching(_ context.Context, appID string, opts config.ListOpts) (int64, error)
- func (m *Store) CountFlagDefinitions(_ context.Context, appID string) (int64, error)
- func (m *Store) CountFlagDefinitionsMatching(_ context.Context, appID string, opts flag.ListOpts) (int64, error)
- func (m *Store) CountOverrides(_ context.Context, appID string) (int64, error)
- func (m *Store) CountRotationPolicies(_ context.Context, appID string) (int64, error)
- func (m *Store) CountSecrets(_ context.Context, appID string) (int64, error)
- func (m *Store) CountSecretsMatching(_ context.Context, appID string, opts secret.ListOpts) (int64, error)
- func (m *Store) CountSecretsUnencrypted(_ context.Context, appID string) (int64, error)
- func (m *Store) CountVersionEncryption(_ context.Context, appID string) (secret.VersionEncryptionCounts, error)
- func (m *Store) DefineFlag(_ context.Context, f *flag.Definition) error
- func (m *Store) DeleteConfig(_ context.Context, key, appID string) error
- func (m *Store) DeleteFlagDefinition(_ context.Context, key, appID string) error
- func (m *Store) DeleteFlagTenantOverride(_ context.Context, key, appID, tenantID string) error
- func (m *Store) DeleteOverride(_ context.Context, key, appID, tenantID string) error
- func (m *Store) DeleteRotationPolicy(_ context.Context, key, appID string) error
- func (m *Store) DeleteSecret(_ context.Context, key, appID, tenantID string) error
- func (m *Store) GetConfig(_ context.Context, key, appID string) (*config.Entry, error)
- func (m *Store) GetConfigVersion(_ context.Context, key, appID string, version int64) (*config.Entry, error)
- func (m *Store) GetFlagDefinition(_ context.Context, key, appID string) (*flag.Definition, error)
- func (m *Store) GetFlagRules(_ context.Context, key, appID string) ([]*flag.Rule, error)
- func (m *Store) GetFlagTenantOverride(_ context.Context, key, appID, tenantID string) (any, error)
- func (m *Store) GetOverride(_ context.Context, key, appID, tenantID string) (*override.Override, error)
- func (m *Store) GetRotationPolicy(_ context.Context, key, appID string) (*rotation.Policy, error)
- func (m *Store) GetSecret(_ context.Context, key, appID, tenantID string) (*secret.Secret, error)
- func (m *Store) GetSecretVersion(_ context.Context, key, appID, tenantID string, version int64) (*secret.Secret, error)
- func (m *Store) ListAudit(_ context.Context, appID string, opts audit.ListOpts) ([]*audit.Entry, error)
- func (m *Store) ListAuditByKey(_ context.Context, key, appID string, opts audit.ListOpts) ([]*audit.Entry, error)
- func (m *Store) ListConfig(_ context.Context, appID string, opts config.ListOpts) ([]*config.Entry, error)
- func (m *Store) ListConfigVersions(_ context.Context, key, appID string) ([]*config.EntryVersion, error)
- func (m *Store) ListFlagDefinitions(_ context.Context, appID string, opts flag.ListOpts) ([]*flag.Definition, error)
- func (m *Store) ListFlagTenantOverrides(_ context.Context, key, appID string) ([]*flag.TenantOverride, error)
- func (m *Store) ListOverridesByKey(_ context.Context, key, appID string) ([]*override.Override, error)
- func (m *Store) ListOverridesByTenant(_ context.Context, appID, tenantID string) ([]*override.Override, error)
- func (m *Store) ListRotationPolicies(_ context.Context, appID string) ([]*rotation.Policy, error)
- func (m *Store) ListRotationRecords(_ context.Context, key, appID string, opts rotation.ListOpts) ([]*rotation.Record, error)
- func (m *Store) ListSecretVersions(_ context.Context, key, appID, tenantID string) ([]*secret.Version, error)
- func (m *Store) ListSecrets(_ context.Context, appID string, opts secret.ListOpts) ([]*secret.Meta, error)
- func (m *Store) ListUnrecordedVersions(_ context.Context, appID, after string, limit int) ([]*secret.Version, error)
- func (m *Store) Migrate(_ context.Context) error
- func (m *Store) Ping(_ context.Context) error
- func (m *Store) RecordAudit(_ context.Context, e *audit.Entry) error
- func (m *Store) RecordRotation(_ context.Context, r *rotation.Record) error
- func (m *Store) SaveRotationPolicy(_ context.Context, p *rotation.Policy) error
- func (m *Store) SetConfig(_ context.Context, e *config.Entry) error
- func (m *Store) SetFlagRules(_ context.Context, key, appID string, rules []*flag.Rule) error
- func (m *Store) SetFlagTenantOverride(_ context.Context, key, appID, tenantID string, value any) error
- func (m *Store) SetOverride(_ context.Context, o *override.Override) error
- func (m *Store) SetSecret(_ context.Context, s *secret.Secret) error
- func (m *Store) SetVersionEncryption(_ context.Context, versionID id.ID, alg string) error
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 a fully in-memory implementation of store.Store.
func (*Store) ClaimDueRotation ¶
func (m *Store) ClaimDueRotation(_ context.Context, key, appID string, now, until time.Time) (bool, error)
ClaimDueRotation claims a due policy for one rotation run. The check and the write happen under the store's write lock, so only one caller can see a given due time. A missing policy returns false and a nil error.
func (*Store) CountAudit ¶
CountAudit returns the number of audit entries belonging to appID.
func (*Store) CountAuditMatching ¶
func (m *Store) CountAuditMatching(_ context.Context, appID string, opts audit.ListOpts) (int64, error)
CountAuditMatching returns the number of audit entries belonging to appID that match opts. Limit and Offset are ignored.
func (*Store) CountConfig ¶
CountConfig returns the number of config entries belonging to appID.
func (*Store) CountConfigMatching ¶
func (m *Store) CountConfigMatching(_ context.Context, appID string, opts config.ListOpts) (int64, error)
CountConfigMatching returns the number of config entries belonging to appID whose key starts with opts.KeyPrefix. Limit and Offset are ignored.
func (*Store) CountFlagDefinitions ¶
CountFlagDefinitions returns the number of flag definitions belonging to appID.
func (*Store) CountFlagDefinitionsMatching ¶
func (m *Store) CountFlagDefinitionsMatching(_ context.Context, appID string, opts flag.ListOpts) (int64, error)
CountFlagDefinitionsMatching returns the number of flag definitions belonging to appID that match opts. Limit and Offset are ignored.
func (*Store) CountOverrides ¶
CountOverrides returns the number of tenant overrides belonging to appID, across every key and tenant.
func (*Store) CountRotationPolicies ¶
CountRotationPolicies returns the number of rotation policies belonging to appID.
func (*Store) CountSecrets ¶
CountSecrets returns the number of secrets belonging to appID, across every tenant.
func (*Store) CountSecretsMatching ¶
func (m *Store) CountSecretsMatching(_ context.Context, appID string, opts secret.ListOpts) (int64, error)
CountSecretsMatching returns the number of secrets belonging to appID, across every tenant, that pass the expiry bounds in opts. TenantID, Limit and Offset are ignored.
func (*Store) CountSecretsUnencrypted ¶
CountSecretsUnencrypted returns the number of secrets belonging to appID, across every tenant, that were stored without an encryption algorithm.
func (*Store) CountVersionEncryption ¶
func (m *Store) CountVersionEncryption(_ context.Context, appID string) (secret.VersionEncryptionCounts, error)
CountVersionEncryption tallies appID's version rows, across every tenant, by recorded algorithm, leaving out each secret's current version.
func (*Store) DefineFlag ¶
DefineFlag creates or updates a flag definition.
func (*Store) DeleteConfig ¶
DeleteConfig removes a config entry.
func (*Store) DeleteFlagDefinition ¶
DeleteFlagDefinition removes a flag definition and its rules.
func (*Store) DeleteFlagTenantOverride ¶
DeleteFlagTenantOverride removes a tenant override.
func (*Store) DeleteOverride ¶
DeleteOverride removes a tenant override.
func (*Store) DeleteRotationPolicy ¶
DeleteRotationPolicy removes a rotation policy.
func (*Store) DeleteSecret ¶
DeleteSecret removes a secret and all its versions.
func (*Store) GetConfigVersion ¶
func (m *Store) GetConfigVersion(_ context.Context, key, appID string, version int64) (*config.Entry, error)
GetConfigVersion retrieves a specific version of a config entry.
func (*Store) GetFlagDefinition ¶
GetFlagDefinition retrieves a flag definition by key and app ID.
func (*Store) GetFlagRules ¶
GetFlagRules returns targeting rules for a flag, ordered by priority.
func (*Store) GetFlagTenantOverride ¶
GetFlagTenantOverride retrieves a tenant override for a flag.
func (*Store) GetOverride ¶
func (m *Store) GetOverride(_ context.Context, key, appID, tenantID string) (*override.Override, error)
GetOverride retrieves a tenant override by key, app ID, and tenant ID.
func (*Store) GetRotationPolicy ¶
GetRotationPolicy retrieves a rotation policy by secret key and app ID.
func (*Store) GetSecret ¶
GetSecret retrieves the latest version of a secret by key, app ID and tenant ID.
func (*Store) GetSecretVersion ¶
func (m *Store) GetSecretVersion(_ context.Context, key, appID, tenantID string, version int64) (*secret.Secret, error)
GetSecretVersion retrieves a specific version of a secret.
func (*Store) ListAudit ¶
func (m *Store) ListAudit(_ context.Context, appID string, opts audit.ListOpts) ([]*audit.Entry, error)
ListAudit returns audit entries for an app.
func (*Store) ListAuditByKey ¶
func (m *Store) ListAuditByKey(_ context.Context, key, appID string, opts audit.ListOpts) ([]*audit.Entry, error)
ListAuditByKey returns audit entries for a specific key within an app.
func (*Store) ListConfig ¶
func (m *Store) ListConfig(_ context.Context, appID string, opts config.ListOpts) ([]*config.Entry, error)
ListConfig returns config entries for an app.
func (*Store) ListConfigVersions ¶
func (m *Store) ListConfigVersions(_ context.Context, key, appID string) ([]*config.EntryVersion, error)
ListConfigVersions returns all versions of a config entry.
func (*Store) ListFlagDefinitions ¶
func (m *Store) ListFlagDefinitions(_ context.Context, appID string, opts flag.ListOpts) ([]*flag.Definition, error)
ListFlagDefinitions returns the flag definitions for an app in key order, filtered by opts.Type before paging. An empty result is an empty slice.
func (*Store) ListFlagTenantOverrides ¶
func (m *Store) ListFlagTenantOverrides(_ context.Context, key, appID string) ([]*flag.TenantOverride, error)
ListFlagTenantOverrides returns all tenant overrides for a flag.
func (*Store) ListOverridesByKey ¶
func (m *Store) ListOverridesByKey(_ context.Context, key, appID string) ([]*override.Override, error)
ListOverridesByKey returns all tenant overrides for a specific config key.
func (*Store) ListOverridesByTenant ¶
func (m *Store) ListOverridesByTenant(_ context.Context, appID, tenantID string) ([]*override.Override, error)
ListOverridesByTenant returns all overrides for a specific tenant.
func (*Store) ListRotationPolicies ¶
ListRotationPolicies returns all rotation policies for an app.
func (*Store) ListRotationRecords ¶
func (m *Store) ListRotationRecords(_ context.Context, key, appID string, opts rotation.ListOpts) ([]*rotation.Record, error)
ListRotationRecords returns rotation history for a secret.
func (*Store) ListSecretVersions ¶
func (m *Store) ListSecretVersions(_ context.Context, key, appID, tenantID string) ([]*secret.Version, error)
ListSecretVersions returns all versions of a secret.
func (*Store) ListSecrets ¶
func (m *Store) ListSecrets(_ context.Context, appID string, opts secret.ListOpts) ([]*secret.Meta, error)
ListSecrets returns secret metadata for an app and the tenant in opts.TenantID, matched exactly.
func (*Store) ListUnrecordedVersions ¶
func (m *Store) ListUnrecordedVersions(_ context.Context, appID, after string, limit int) ([]*secret.Version, error)
ListUnrecordedVersions returns up to limit version rows of appID, across every tenant, whose encryption algorithm was never recorded, in ascending id order, after the id after.
func (*Store) RecordAudit ¶
RecordAudit persists an audit log entry.
func (*Store) RecordRotation ¶
RecordRotation records a completed rotation event.
func (*Store) SaveRotationPolicy ¶
SaveRotationPolicy creates or updates a rotation policy.
func (*Store) SetFlagRules ¶
SetFlagRules replaces all targeting rules for a flag.
func (*Store) SetFlagTenantOverride ¶
func (m *Store) SetFlagTenantOverride(_ context.Context, key, appID, tenantID string, value any) error
SetFlagTenantOverride sets a direct per-tenant override value.
func (*Store) SetOverride ¶
SetOverride creates or updates a tenant override.