blob

package
v0.9.2 Latest Latest
Warning

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

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

Documentation

Overview

Package blob is object storage as one small interface: whole-object Put/Get/List/ Delete. The Local backend backs self-host and dev; an S3/R2/Tigris backend (same interface) backs cloud cold storage. This single seam is the entire object-storage story — the segment store never knows which backend it's talking to.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blob

type Blob interface {
	Put(key string, data []byte) error
	Get(key string) ([]byte, error) // returns os.ErrNotExist semantics when absent
	List(prefix string) ([]string, error)
	Delete(key string) error
}

type Local

type Local struct {
	// contains filtered or unexported fields
}

Local stores objects as files under a directory. Keys map to relative paths; any "../" traversal is rejected so a key can't escape the root.

func NewLocal

func NewLocal(dir string) (*Local, error)

func (*Local) Delete

func (l *Local) Delete(key string) error

func (*Local) Get

func (l *Local) Get(key string) ([]byte, error)

func (*Local) List

func (l *Local) List(prefix string) ([]string, error)

func (*Local) Put

func (l *Local) Put(key string, data []byte) error

type S3

type S3 struct {
	// contains filtered or unexported fields
}

S3 is an S3-compatible object-storage backend implemented with stdlib only — no AWS SDK, so the binary stays single and static. It speaks plain HTTP with SigV4 signing, which works against AWS S3, Cloudflare R2, Tigris, Backblaze B2, and MinIO. This is the cold tier for the cloud: per-tenant prefixes, infinite history at pennies/GB.

func NewS3

func NewS3(endpoint, region, bucket, accessKey, secretKey, prefix string) (*S3, error)

NewS3 builds an S3 backend. region may be "auto" for R2. prefix (optional) namespaces every key — pass a per-tenant value in the cloud so one bucket holds many tenants.

func (*S3) Delete

func (s *S3) Delete(key string) error

func (*S3) Get

func (s *S3) Get(key string) ([]byte, error)

func (*S3) List

func (s *S3) List(prefix string) ([]string, error)

List returns keys under prefix (with the per-tenant prefix stripped back off), paging through ListObjectsV2 until the bucket is exhausted.

func (*S3) Put

func (s *S3) Put(key string, data []byte) error

Jump to

Keyboard shortcuts

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