Documentation
¶
Overview ¶
Package objectstore is the studio/CLI seam to a versioned object store (spec 0039): workspace MEDIA lives in a bucket, git keeps the authored state plus a media.lock manifest pinning each file's content hash and object version. The backend is pluggable behind the narrow Store interface and chosen from the TOP-LEVEL `storage:` config section (0039 D5 — deliberately not providers.*, storage is not a generation backend). An unset provider is a supported state: callers degrade to local-only behaviour (R-STO-5).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotConfigured: no storage.provider set — local-only mode, not a fault. ErrNotConfigured = errors.NewSentinel("keyrx.not_configured", "no object store configured (storage.provider unset)") // ErrUnknownProvider: storage.provider names an unregistered adapter. ErrUnknownProvider = errors.NewSentinel("keyrx.unknown_provider", "unknown storage provider") // ErrNotFound: the key (or the requested version of it) does not exist. ErrNotFound = errors.NewSentinel("keyrx.not_found", "object not found") )
Sentinel states callers branch on.
var Default = NewRegistry()
Default is the process-wide registry adapters register into from init().
Functions ¶
Types ¶
type Config ¶
Config is what a constructor receives: the active config reader, from which the adapter reads its own storage.<name>.* block (bucket, region, prefix, endpoint — never credentials, which resolve via the provider's own chain; R-STO-4).
type Constructor ¶
Constructor builds a Store from the active config.
type Info ¶
type Info struct {
Size int64
ETag string
VersionID string
// SHA256 is the content hash recorded at Put time (object metadata), ""
// when the object predates keryx or the backend can't echo it.
SHA256 string
}
Info describes a stored object.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry resolves the configured storage adapter. Mirrors the provider factory pattern (0001 §3.4) but keys off top-level `storage.provider`.
func NewRegistry ¶
func NewRegistry() *Registry
NewRegistry creates an empty registry (tests); package users share Default.
func (*Registry) Register ¶
func (r *Registry) Register(name string, c Constructor)
Register adds a named constructor. Adapters call this from an init() so that importing the adapter package wires it in.
type Store ¶
type Store interface {
// Put uploads r (size bytes, content sha256Hex) to key, returning the new
// object version.
Put(ctx context.Context, key string, r io.Reader, size int64, sha256Hex string) (PutResult, error)
// Get streams the object at key; versionID "" means latest.
Get(ctx context.Context, key, versionID string) (io.ReadCloser, error)
// Head describes the object at key without fetching it; versionID "" means
// latest.
Head(ctx context.Context, key, versionID string) (Info, error)
// Verify checks the backing store is reachable — the doctor check
// (R-STO-10). It never creates or configures anything.
Verify(ctx context.Context) error
// List returns every key under prefix (used by `media gc` to find blobs no
// manifest or ledger references).
List(ctx context.Context, prefix string) ([]string, error)
// Delete removes one object. keryx only ever calls this from the explicit,
// opt-in `media gc` prune — never from push/pull (R-STO-6).
Delete(ctx context.Context, key string) error
}
Store is the narrow object-store seam. Keys are full bucket keys (the caller composes them — see Key); implementations never interpret them. Puts overwrite in place — the bucket's own versioning is the history (R-STO-6: keryx never deletes objects or versions).
Directories
¶
| Path | Synopsis |
|---|---|
|
Package cdk is the multi-backend object-store adapter (spec 0040): one implementation over gocloud.dev/blob, which speaks S3, Google Cloud Storage, Azure Blob, the local filesystem and memory through a single portable API.
|
Package cdk is the multi-backend object-store adapter (spec 0040): one implementation over gocloud.dev/blob, which speaks S3, Google Cloud Storage, Azure Blob, the local filesystem and memory through a single portable API. |
|
Package s3 is the S3 object-store adapter (spec 0039 §3.4): keryx's default storage backend, registered as storage.provider "s3".
|
Package s3 is the S3 object-store adapter (spec 0039 §3.4): keryx's default storage backend, registered as storage.provider "s3". |