object

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package object provides a small interface for object storage operations used by Strata (WAL archive, checkpoints, manifest).

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("object: not found")

ErrNotFound is returned by Get when the object does not exist.

Functions

This section is empty.

Types

type Mem

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

Mem is an in-memory Store implementation for tests.

func NewMem

func NewMem() *Mem

NewMem returns an empty in-memory Store.

func (*Mem) Delete

func (m *Mem) Delete(_ context.Context, key string) error

func (*Mem) Get

func (m *Mem) Get(_ context.Context, key string) (io.ReadCloser, error)

func (*Mem) List

func (m *Mem) List(_ context.Context, prefix string) ([]string, error)

func (*Mem) Put

func (m *Mem) Put(_ context.Context, key string, r io.Reader) error

type S3Store

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

S3Store implements Store backed by an AWS S3 bucket.

func NewS3Store

func NewS3Store(client *s3.Client, bucket, prefix string) *S3Store

NewS3Store creates a Store backed by the given S3 bucket. prefix is prepended to every key (may be empty).

func (*S3Store) Delete

func (s *S3Store) Delete(ctx context.Context, key string) error

func (*S3Store) Get

func (s *S3Store) Get(ctx context.Context, key string) (io.ReadCloser, error)

func (*S3Store) GetVersioned

func (s *S3Store) GetVersioned(ctx context.Context, key, versionID string) (io.ReadCloser, error)

GetVersioned retrieves a specific stored version of key. Requires S3 versioning to be enabled on the bucket.

func (*S3Store) List

func (s *S3Store) List(ctx context.Context, prefix string) ([]string, error)

func (*S3Store) Put

func (s *S3Store) Put(ctx context.Context, key string, r io.Reader) error

type Store

type Store interface {
	// Put writes data to key. The operation is atomic from the reader's
	// perspective (last-writer-wins semantics are sufficient).
	Put(ctx context.Context, key string, r io.Reader) error

	// Get returns a reader for the object at key.
	// Returns ErrNotFound if the object does not exist.
	Get(ctx context.Context, key string) (io.ReadCloser, error)

	// Delete removes the object at key. Not an error if it doesn't exist.
	Delete(ctx context.Context, key string) error

	// List returns keys that share the given prefix, in lexicographic order.
	List(ctx context.Context, prefix string) ([]string, error)
}

Store is a minimal object storage interface.

type VersionedStore

type VersionedStore interface {
	Store
	// GetVersioned returns a reader for a specific stored version of key.
	// Returns ErrNotFound if the version does not exist.
	GetVersioned(ctx context.Context, key, versionID string) (io.ReadCloser, error)
}

VersionedStore extends Store with version-pinned reads. Implementations backed by S3 (or any store with object versioning) can satisfy this interface. It is used for point-in-time restore via RestorePoint.

Jump to

Keyboard shortcuts

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