Documentation
¶
Overview ¶
Package blobs3 implements blob.Store on S3-compatible object storage -- AWS S3, Cloudflare R2, MinIO -- using conditional writes (If-Match / If-None-Match on PutObject) for the optimistic concurrency the grain-store contract requires, and presigned GETs for the Signer capability. The caller constructs and owns the *s3.Client, so credentials, region, and custom endpoints (path-style for MinIO) stay a deployment concern.
GCS's XML interop layer does not honor If-Match on writes; a native GCS store (generation preconditions) can implement blob.Store separately, and the publisher's advisory lease is the fallback correctness mode.
Index ¶
- type Store
- func (s *Store) Delete(ctx context.Context, path string) error
- func (s *Store) Get(ctx context.Context, path string) ([]byte, string, error)
- func (s *Store) GetRange(ctx context.Context, path string, offset, length int64) ([]byte, error)
- func (s *Store) List(ctx context.Context, prefix string) iter.Seq2[blob.Entry, error]
- func (s *Store) Put(ctx context.Context, path string, data []byte, opts blob.PutOptions) (string, error)
- func (s *Store) PutStream(ctx context.Context, path string, r io.Reader, opts blob.PutOptions) (string, error)
- func (s *Store) SignedGetURL(ctx context.Context, path string, ttl time.Duration) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store implements blob.Store and blob.Signer over one bucket.
func (*Store) Delete ¶
Delete removes the object, or returns blob.ErrNotFound. S3 deletes are idempotent-silent, so existence is checked first (racy but conformant -- the contract's ErrNotFound is a debugging courtesy, not a lock).
func (*Store) GetRange ¶ added in v0.27.0
GetRange implements the blob.RangeReader capability with an HTTP Range GET. S3 clamps a range that runs past the object's end and returns 416 for one that starts past it; both normalize to short/empty reads so the blob.ReaderAt adapter sees io.ReaderAt semantics.
func (*Store) List ¶
List yields entries under prefix in lexicographic path order (S3's native ListObjectsV2 order), paginating internally.
func (*Store) Put ¶
func (s *Store) Put(ctx context.Context, path string, data []byte, opts blob.PutOptions) (string, error)
Put writes the object subject to opts' preconditions.
func (*Store) PutStream ¶
func (s *Store) PutStream(ctx context.Context, path string, r io.Reader, opts blob.PutOptions) (string, error)
PutStream implements blob.StreamPutter by spooling the payload to a local temp file for a seekable, length-known upload body -- RAM stays at the copy buffer while the object rides through disk. Preconditions carry through to the PutObject exactly as in Put.