Documentation
¶
Overview ¶
Package catalog contains explicit credential catalog backends.
Index ¶
- Constants
- type Hooks
- type Local
- func (l *Local) Close() error
- func (l *Local) Create(ctx context.Context, record credentials.Record) error
- func (l *Local) Delete(ctx context.Context, ref credentials.Reference) error
- func (l *Local) Get(ctx context.Context, ref credentials.Reference) (credentials.Record, error)
- func (l *Local) List(ctx context.Context) ([]credentials.Record, error)
- func (l *Local) Path() string
- func (l *Local) Root() string
- func (l *Local) Update(ctx context.Context, expected, next credentials.Record) error
- type LocalCatalog
- type Options
Constants ¶
const ( // Filename is the only catalog data file in a local catalog root. Filename = "catalog.json" LockFilename = ".catalog.lock" SchemaV1 = credentials.RecordSchemaV1 CatalogSchemaV1 = SchemaV1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Hooks ¶
type Hooks struct {
BeforeRead func() error
BeforeReady func() error
BeforeClose func() error
// BeforeInitialize runs only for a newly O_EXCL-created catalog file,
// while the constructor holds the cross-process lock.
BeforeInitialize func() error
BeforeTempWrite func() error
BeforeRename func() error
AfterRename func() error
BeforeUnlink func() error
AfterUnlink func() error
SyncDir func() error
}
Hooks are failure-injection seams used by tests. Production callers should leave them nil. Mutation hooks execute while the cross-process lock is held; lifetime hooks run at the corresponding lock boundary.
type Local ¶
type Local struct {
// contains filtered or unexported fields
}
Local is a strict owner-only catalog backed by one bounded JSON file. The platform implementation retains an open root descriptor and lock handle so path replacement cannot redirect operations to a different directory.
func NewCatalog ¶
NewCatalog is a descriptive alias for New.
func NewLocalCatalog ¶
func NewWithOptions ¶
NewWithOptions opens a local catalog with test-only failure hooks.
func (*Local) Create ¶
Create publishes one record only when its reference is absent. The file rename is the mutation linearization point; after a successful rename a canceled context does not turn the committed mutation into a failure.
func (*Local) Delete ¶
Delete removes one catalog record. It is deliberately a catalog-only operation; state deletion is the caller's separate exact-version action.
func (*Local) Get ¶
func (l *Local) Get(ctx context.Context, ref credentials.Reference) (credentials.Record, error)
Get resolves exactly one safe record. The complete file is validated before the requested record is returned.
func (*Local) Path ¶
Path returns the path at which the data file is presented. It is for diagnostics and tests; callers must use Catalog methods for access.
type LocalCatalog ¶
type LocalCatalog = Local