blob

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package blob is fabriq's byte-plane capability port. It is pure fabriq vocabulary: no storage-engine types cross this boundary, so core never depends on any object-store library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CAS

type CAS interface {
	// Store writes content-addressed bytes, returning the content hash and size.
	// Identical content is stored once (the underlying ref-count is incremented).
	Store(ctx context.Context, r io.Reader) (hash string, size int64, err error)
	// Retrieve returns the bytes for a content hash.
	Retrieve(ctx context.Context, hash string) (io.ReadCloser, error)
}

CAS is the content-addressable storage capability the write path uses: store bytes under their content hash (deduped), and retrieve by hash. Implemented by adapters/trove.CASStore. Fabriq vocabulary only — no storage-engine types here.

type Caps

type Caps struct {
	Presign   bool `json:"presign"`
	Multipart bool `json:"multipart"`
	Range     bool `json:"range"`
}

Caps reports optional capabilities a Store supports (reflecting the underlying driver). Absent capabilities are reported, never faked.

type Multipart

type Multipart interface {
	InitiateMultipart(ctx context.Context, key string, o PutOpts) (uploadID string, err error)
	UploadPart(ctx context.Context, key, uploadID string, part int, r io.Reader) (PartInfo, error)
	CompleteMultipart(ctx context.Context, key, uploadID string, parts []PartInfo) (ObjectInfo, error)
	AbortMultipart(ctx context.Context, key, uploadID string) error
}

Multipart supports resumable multipart uploads. Supported iff Caps.Multipart.

type ObjectInfo

type ObjectInfo struct {
	Key         string    `json:"key"`
	Size        int64     `json:"size"`
	Checksum    string    `json:"checksum"`
	ContentType string    `json:"contentType"`
	ModifiedAt  time.Time `json:"modifiedAt"`
}

ObjectInfo is the stored-object metadata returned by the port.

type PartInfo

type PartInfo struct {
	Part int    `json:"part"`
	ETag string `json:"etag"`
}

PartInfo identifies an uploaded multipart part.

type Presigner

type Presigner interface {
	PresignGet(ctx context.Context, key string, ttl time.Duration) (string, error)
	PresignPut(ctx context.Context, key string, ttl time.Duration) (string, error)
}

Presigner issues client-direct URLs. A Store supports it iff Caps.Presign.

type PutOpts

type PutOpts struct {
	ContentType string `json:"contentType"`
	Size        int64  `json:"size"`
}

PutOpts carries optional metadata for a write. Size is -1 when unknown.

type Ranger

type Ranger interface {
	GetRange(ctx context.Context, key string, offset, length int64) (io.ReadCloser, error)
}

Ranger supports byte-range reads. Supported iff Caps.Range.

type Store

type Store interface {
	Put(ctx context.Context, key string, r io.Reader, o PutOpts) (ObjectInfo, error)
	Get(ctx context.Context, key string) (io.ReadCloser, ObjectInfo, error)
	Head(ctx context.Context, key string) (ObjectInfo, error)
	Delete(ctx context.Context, key string) error
	List(ctx context.Context, prefix string) ([]ObjectInfo, error)
	Copy(ctx context.Context, srcKey, dstKey string) (ObjectInfo, error)
	// Capabilities reports which optional sub-interfaces this Store satisfies.
	Capabilities() Caps
}

Store is the byte-plane port. Implementations stamp tenant/scope into keys structurally; callers pass already-derived keys. Not-found reads return fabriqerr.ErrNotFound.

Jump to

Keyboard shortcuts

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