Documentation
¶
Overview ¶
Package storage abstracts where persisted stores live. A Blob is a minimal object store (put, get, delete, list of byte blobs by key) with two implementations: the local filesystem and any S3-compatible service (AWS S3, MinIO, Cloudflare R2, and similar). The S3 client is implemented on the standard library with hand-rolled SigV4 signing, so there is no heavy SDK dependency.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotExist = errors.New("storage: key does not exist")
ErrNotExist is returned by Get and Delete when a key is absent.
Functions ¶
This section is empty.
Types ¶
type Blob ¶
type Blob interface {
Put(ctx context.Context, key string, data []byte) error
Get(ctx context.Context, key string) ([]byte, error)
Delete(ctx context.Context, key string) error
List(ctx context.Context, prefix string) ([]string, error)
}
Blob is a small object store keyed by string. Implementations must be safe for concurrent use.
type Local ¶
type Local struct {
// contains filtered or unexported fields
}
Local is a Blob backed by a directory on the local filesystem. Keys map to file names; subdirectories are created as needed.
type S3 ¶
type S3 struct {
// contains filtered or unexported fields
}
S3 is a Blob backed by an S3-compatible service. It uses path-style addressing and SigV4 request signing, implemented on the standard library so no AWS SDK is required. It works with AWS S3, MinIO, Cloudflare R2, and similar services.
type S3Config ¶
type S3Config struct {
Endpoint string // e.g. https://s3.us-east-1.amazonaws.com or http://localhost:9000
Bucket string
Region string // e.g. us-east-1
AccessKey string
SecretKey string
// Prefix is an optional key prefix (a folder within the bucket).
Prefix string
}
S3Config configures an S3-compatible object store.