Documentation
¶
Overview ¶
Package blob is the storage-layer port (ADR-0007): opaque byte objects behind the blob.Bucket port. It is the bytes substrate, sibling to the store (records) — deliberately named "blob", not "storage", to stay distinct from "store".
This package imports no driver library; the gocloud.dev/blob adapter (memory / file / S3, all pure-Go) lives in internal/blob/gocloud.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attributes ¶
type Attributes struct {
Key string
Size int64
ModTime time.Time
// MD5 is the MD5 of the content; empty when the driver has no digest for the object (ADR-0159).
MD5 []byte
ContentType string
Metadata map[string]string // user metadata, lowercase keys
}
Attributes describes one object. List fills Key, Size, ModTime and MD5; Bucket.Attributes fills all.
type Bucket ¶
type Bucket interface {
Get(ctx context.Context, key string) ([]byte, error)
Put(ctx context.Context, key string, data []byte, opts PutOptions) error
Delete(ctx context.Context, key string) error
Exists(ctx context.Context, key string) (bool, error)
List(ctx context.Context, prefix string) ([]Attributes, error)
// ListAfter returns at most limit objects under prefix whose key sorts strictly after `after`, sorted by key,
// with the fields List fills; more is true exactly when a further key under prefix exists. limit < 1 is
// fault.Invalid (ADR-0184).
ListAfter(ctx context.Context, prefix, after string, limit int) (items []Attributes, more bool, err error)
// Attributes reads one object's attributes without its content; fault.NotFound if absent.
Attributes(ctx context.Context, key string) (Attributes, error)
SignedURL(ctx context.Context, key string, opts SignOptions) (string, error)
Close() error
}
Bucket is the storage-layer port: opaque byte objects keyed by a path string. Errors are api/fault kinds; every method is ctx-first.
func Capped ¶ added in v0.2.1
Capped returns a view of inner whose Put refuses an object larger than maxBytes with fault.PayloadTooLarge: the Bucket.spec.maxObjectBytes per-object policy (ADR-0080, ADR-0148). It also refuses to sign a PUT URL with fault.Forbidden, since the upload then bypasses Put and SignOptions carries no size limit to bind it. maxBytes <= 0 returns inner unchanged. It forwards the optional RangeReader capability when inner implements it.
func NoSign ¶ added in v0.11.0
NoSign returns a view of inner whose SignedURL is fault.Unavailable for every method (ADR-0208 Decision 1): a remote store's driver would sign with the store credential, which deletes. It forwards the optional RangeReader capability when inner implements it, as Capped does.
func Prefixed ¶
Prefixed returns a Bucket view of inner whose keys are all transparently prefixed with keyPrefix (ADR-0080): it scopes a single shared substrate bucket into many logical buckets (e.g. one per (namespace, Bucket) S3 domain) without a separate backend per bucket. A trailing "/" on keyPrefix is recommended for a clean boundary. It forwards the optional RangeReader capability when inner implements it.
type PutOptions ¶ added in v0.4.0
type PutOptions struct {
ContentType string
Metadata map[string]string
// IfNotExist creates the object only when its key is absent; a present key is fault.Conflict and the object
// stays unchanged (ADR-0203).
IfNotExist bool
}
PutOptions configures a Put. The zero value stores no metadata and lets the driver pick the content type.
type RangeReader ¶
type RangeReader interface {
// GetRange returns bytes [offset, offset+length) of the object at key.
// A negative length means "to end". offset must be >= 0. fault.NotFound if the
// key is absent; fault.Invalid for a negative offset.
GetRange(ctx context.Context, key string, offset, length int64) ([]byte, error)
}
RangeReader is an OPTIONAL capability a blob.Bucket driver MAY implement: a byte-range read of an object (ADR-0080). The s3gateway type-asserts a Bucket to RangeReader to serve DuckDB's ranged Parquet reads efficiently and FALLS BACK to a full Get+slice when the driver does not implement it. Keeping it a separate, optional interface keeps the blob.Bucket port minimal and the contract tests additive.
type RestoreReport ¶ added in v0.11.0
RestoreReport counts a RestoreAt's keys: copied from an older version, deleted (a new delete marker) and left as they were; NoVersion lists the deleted keys that had no version at the time.
type SignMethod ¶
type SignMethod string
SignMethod is the typed HTTP method a SignedURL grants (ADR-0002: typed over magic strings).
const ( SignGet SignMethod = "GET" SignPut SignMethod = "PUT" SignDelete SignMethod = "DELETE" )
type SignOptions ¶
type SignOptions struct {
Method SignMethod
Expiry time.Duration
}
SignOptions configures a SignedURL request. A zero Method means SignGet; a zero Expiry means the driver's default (15m).
type Versioned ¶ added in v0.11.0
type Versioned interface {
// Versioning reads the bucket's versioning status and Object Lock configuration (ADR-0208 Decision 2).
Versioning(ctx context.Context) (Versioning, error)
// RestoreAt makes every key under the store's prefix hold its version at at (Decision 6): keep is
// blob.versionRetention, and 0 or an at older than keep is fault.Invalid. No version is removed.
RestoreAt(ctx context.Context, at time.Time, keep time.Duration) (RestoreReport, error)
}
Versioned is an OPTIONAL capability, found by type assertion as RangeReader is: a store whose bucket keeps every version of an object (ADR-0208). A Bucket without it cannot be protected or restored to a time; the caller answers fault.Invalid.
type Versioning ¶ added in v0.11.0
type Versioning struct{ Enabled, ObjectLock bool }
Versioning is a bucket's protection: versioning Enabled and Object Lock enabled.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package blobcontract is the shared conformance suite for the blob.Bucket port (ADR-0007).
|
Package blobcontract is the shared conformance suite for the blob.Bucket port (ADR-0007). |
|
Package gocloud is the gocloud.dev/blob driver for the blob.Bucket port (ADR-0007): memory / file / S3 by URL, all pure-Go (no cgo).
|
Package gocloud is the gocloud.dev/blob driver for the blob.Bucket port (ADR-0007): memory / file / S3 by URL, all pure-Go (no cgo). |
|
Package s3gateway is the funcd S3-protocol frontend over the blob.Bucket substrate (ADR-0080), with in-platform identity via funcd-managed per-principal SigV4 keypairs resolved by an in-process versitygw auth.IAMService (ADR-0085).
|
Package s3gateway is the funcd S3-protocol frontend over the blob.Bucket substrate (ADR-0080), with in-platform identity via funcd-managed per-principal SigV4 keypairs resolved by an in-process versitygw auth.IAMService (ADR-0085). |