blobs3

package
v0.229.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 13 Imported by: 0

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

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 New

func New(client *s3.Client, bucket string) *Store

New returns a Store over the bucket.

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, path string) error

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) Get

func (s *Store) Get(ctx context.Context, path string) ([]byte, string, error)

Get returns the object's content and ETag, or blob.ErrNotFound.

func (*Store) GetRange added in v0.27.0

func (s *Store) GetRange(ctx context.Context, path string, offset, length int64) ([]byte, error)

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

func (s *Store) List(ctx context.Context, prefix string) iter.Seq2[blob.Entry, error]

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.

func (*Store) SignedGetURL

func (s *Store) SignedGetURL(ctx context.Context, path string, ttl time.Duration) (string, error)

SignedGetURL implements blob.Signer with a presigned GET.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL