mirror of
https://github.com/warmbly/warmbly.git
synced 2026-08-19 08:01:16 +00:00
368c1f7886
One Store interface (Get/Put/Delete/Has/PresignedGetURL/Name) covers both the AWS S3 client (now exposes high-level methods alongside the legacy embedded *s3.Client) and a new FilesystemStore for self-hosters. FilesystemStore writes atomically via temp-file + rename, rejects '..' in keys before path normalization, returns ErrUnsupported from PresignedGetURL. The S3 impl works against AWS S3, MinIO, Cloudflare R2, Backblaze B2, and Hetzner Object Storage via standard AWS endpoint-URL config. Factory NewFromEnv selects via BLOB_PROVIDER (defaults to s3). 14 tests cover round-trip, ErrNotFound, atomic-write cleanup, traversal rejection, factory env-selection paths.
13 lines
383 B
Go
13 lines
383 B
Go
package storage
|
|
|
|
import "errors"
|
|
|
|
var (
|
|
// ErrNotFound is returned by Get when the key doesn't exist.
|
|
ErrNotFound = errors.New("storage: key not found")
|
|
|
|
// ErrUnsupported is returned when an implementation doesn't support an
|
|
// optional operation (e.g. PresignedGetURL on the filesystem store).
|
|
ErrUnsupported = errors.New("storage: operation not supported by this backend")
|
|
)
|