Documentation
¶
Overview ¶
Package local implements an owner-only, descriptor-relative local secret store. The root is always supplied explicitly by the caller.
Index ¶
- Variables
- type CommitVisibleDurabilityUnknownError
- func (e *CommitVisibleDurabilityUnknownError) Error() string
- func (e *CommitVisibleDurabilityUnknownError) Is(target error) bool
- func (e *CommitVisibleDurabilityUnknownError) Reference() secrets.Reference
- func (e *CommitVisibleDurabilityUnknownError) Unwrap() error
- func (e *CommitVisibleDurabilityUnknownError) Visible() bool
- type DurabilityUnknownError
- type Hooks
- type Options
- type PageTokenExpiredError
- type Store
- func (s *Store) Close() error
- func (s *Store) Delete(ctx context.Context, ref secrets.Reference, options secrets.DeleteOptions) (secrets.DeleteResult, error)
- func (s *Store) Filename(ref secrets.Reference) string
- func (s *Store) List(ctx context.Context, namespace secrets.Namespace, token secrets.PageToken, ...) (secrets.Page[secrets.Metadata], error)
- func (s *Store) Put(ctx context.Context, ref secrets.Reference, value secrets.Secret, ...) (secrets.Record, error)
- func (s *Store) Resolve(ctx context.Context, ref secrets.Reference) (secrets.Record, error)
- func (s *Store) Root() string
- func (s *Store) SupportsCompareAndSwap() bool
- func (s *Store) SupportsCreateOnly() bool
- type UnsupportedPlatformError
Constants ¶
This section is empty.
Variables ¶
var ErrCommitVisibleDurabilityUnknown = ErrDurabilityUnknown
ErrCommitVisibleDurabilityUnknown is a descriptive alias retained for callers that name the visible commit state explicitly.
var ErrDurabilityUnknown = errors.New("local: visible commit durability unknown")
ErrDurabilityUnknown identifies a mutation whose visible state changed but whose directory durability could not be confirmed.
var ErrListTooLarge = errors.New("local: listing exceeds bounded record limit")
ErrListTooLarge reports a directory whose bounded scan would exceed the local store's work and memory budget.
var ErrPageTokenExpired = errors.New("local: page token expired")
ErrPageTokenExpired identifies a continuation token that was evicted, consumed, or belongs to another store instance.
var ErrUnsupportedPlatform = errors.New("local: unsupported platform")
ErrUnsupportedPlatform identifies a platform where this package cannot prove the required handle-relative and owner-only invariants.
Functions ¶
This section is empty.
Types ¶
type CommitVisibleDurabilityUnknownError ¶
type CommitVisibleDurabilityUnknownError struct {
// contains filtered or unexported fields
}
CommitVisibleDurabilityUnknownError reports a successful rename/unlink followed by failed durability bookkeeping. Visible is always true; callers must reread/adopt state and must not assume the old value survived.
func (*CommitVisibleDurabilityUnknownError) Error ¶
func (e *CommitVisibleDurabilityUnknownError) Error() string
func (*CommitVisibleDurabilityUnknownError) Is ¶
func (e *CommitVisibleDurabilityUnknownError) Is(target error) bool
func (*CommitVisibleDurabilityUnknownError) Reference ¶
func (e *CommitVisibleDurabilityUnknownError) Reference() secrets.Reference
Reference returns the safe reference associated with the visible mutation.
func (*CommitVisibleDurabilityUnknownError) Unwrap ¶
func (e *CommitVisibleDurabilityUnknownError) Unwrap() error
func (*CommitVisibleDurabilityUnknownError) Visible ¶
func (e *CommitVisibleDurabilityUnknownError) Visible() bool
Visible reports that the rename or unlink already occurred.
type DurabilityUnknownError ¶
type DurabilityUnknownError = CommitVisibleDurabilityUnknownError
DurabilityUnknownError is an alias for the typed visible-commit failure.
type Hooks ¶
type Hooks struct {
BeforeRead func() error
BeforeExistingRead func() error
BeforeVersion func() error
BeforeTempWrite func() error
BeforeWrite func() error
BeforeRename func() error
AfterRename func() error
BeforeUnlink func() error
AfterUnlink func() error
SyncDir func() error
NewVersion func() (secrets.Version, error)
}
Hooks are optional test seams for exercising cancellation, mutation linearization, and durability rules. Production callers should leave all fields nil. Mutation hooks run while the store's cross-process lock is held; read hooks run immediately before their unresolved filesystem read.
type Options ¶
type Options struct {
Hooks Hooks
}
Options configures NewWithOptions. The zero value is the normal production configuration.
type PageTokenExpiredError ¶
type PageTokenExpiredError struct {
Reason string
}
PageTokenExpiredError reports stateful cursor expiry without exposing the token itself. A continuation token is one-time use and is never replayable.
func (*PageTokenExpiredError) Error ¶
func (e *PageTokenExpiredError) Error() string
func (*PageTokenExpiredError) Unwrap ¶
func (e *PageTokenExpiredError) Unwrap() error
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a concurrent-safe local secret store. A Store owns an open handle to its root directory for its entire lifetime.
func New ¶
New opens or creates an owner-only store rooted at root. root must be an absolute, clean path; no environment variable or process home is consulted.
func NewStore ¶
NewStore is an explicit alias for New for callers that prefer a noun-style constructor.
func NewWithOptions ¶
NewWithOptions opens a store with optional failure-injection hooks.
func (*Store) Delete ¶
func (s *Store) Delete(ctx context.Context, ref secrets.Reference, options secrets.DeleteOptions) (secrets.DeleteResult, error)
Delete removes exactly ref. Unlink is the deletion linearization point and absent references are idempotent.
func (*Store) Filename ¶
Filename returns the single path component used for ref. It is useful for diagnostics and tests; callers must not use it to bypass Store methods.
func (*Store) List ¶
func (s *Store) List(ctx context.Context, namespace secrets.Namespace, token secrets.PageToken, limit int) (secrets.Page[secrets.Metadata], error)
List returns metadata only, constrained to namespace and a bounded page. The first call captures a bounded in-memory snapshot; continuation tokens identify that snapshot and cannot cross stores or namespaces.
func (*Store) Put ¶
func (s *Store) Put(ctx context.Context, ref secrets.Reference, value secrets.Secret, options secrets.PutOptions) (secrets.Record, error)
Put stores value under ref according to options. Rename is the mutation linearization point; after it succeeds the old value is never reported as surviving.
func (*Store) SupportsCompareAndSwap ¶
SupportsCompareAndSwap reports affirmative CAS support.
func (*Store) SupportsCreateOnly ¶
SupportsCreateOnly reports affirmative create-only support.
type UnsupportedPlatformError ¶
type UnsupportedPlatformError struct{}
UnsupportedPlatformError is returned at construction time on platforms without the required filesystem primitives.
func (UnsupportedPlatformError) Error ¶
func (UnsupportedPlatformError) Error() string
func (UnsupportedPlatformError) Unwrap ¶
func (UnsupportedPlatformError) Unwrap() error