Documentation
¶
Overview ¶
Package object provides a small interface for object storage operations used by Strata (WAL archive, checkpoints, manifest).
Index ¶
- Variables
- type Mem
- type S3Store
- func (s *S3Store) Delete(ctx context.Context, key string) error
- func (s *S3Store) Get(ctx context.Context, key string) (io.ReadCloser, error)
- func (s *S3Store) GetVersioned(ctx context.Context, key, versionID string) (io.ReadCloser, error)
- func (s *S3Store) List(ctx context.Context, prefix string) ([]string, error)
- func (s *S3Store) Put(ctx context.Context, key string, r io.Reader) error
- type Store
- type VersionedStore
Constants ¶
This section is empty.
Variables ¶
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.
type S3Store ¶
type S3Store struct {
// contains filtered or unexported fields
}
S3Store implements Store backed by an AWS S3 bucket.
func NewS3Store ¶
NewS3Store creates a Store backed by the given S3 bucket. prefix is prepended to every key (may be empty).
func (*S3Store) GetVersioned ¶
GetVersioned retrieves a specific stored version of key. Requires S3 versioning to be enabled on the bucket.
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.