Documentation
¶
Overview ¶
Package backend defines the interfaces for object storage backends used by glassdb.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotFound is returned when an object does not exist in the backend. ErrNotFound = errors.New("object not found") // ErrPrecondition is returned when a conditional operation's precondition fails. ErrPrecondition = errors.New("precondition failed") // ErrEOF is returned when there are no more items to iterate over. ErrEOF = errors.New("end of file") )
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend interface {
ReadIfModified(ctx context.Context, path string, version int64) (ReadReply, error)
Read(ctx context.Context, path string) (ReadReply, error)
GetMetadata(ctx context.Context, path string) (Metadata, error)
SetTagsIf(ctx context.Context, path string, expected Version, t Tags) (Metadata, error)
Write(ctx context.Context, path string, value []byte, t Tags) (Metadata, error)
WriteIf(ctx context.Context, path string, value []byte, expected Version, t Tags) (Metadata, error)
WriteIfNotExists(ctx context.Context, path string, value []byte, t Tags) (Metadata, error)
Delete(ctx context.Context, path string) error
DeleteIf(ctx context.Context, path string, expected Version) error
// List returns an iterator over the objects in the bucket within the given
// directory (path separator is '/'). Objects will be iterated over
// lexicographically by name.
//
// Note: The returned iterator is not safe for concurrent operations without
// explicit synchronization.
List(ctx context.Context, dirPath string) (ListIter, error)
}
Backend defines the interface for object storage operations with conditional reads, writes, and listing capabilities.
type ReadReply ¶
type ReadReply struct {
Contents []byte
// TODO: Consider only exposing contents version.
Version Version
}
ReadReply holds the contents and version of a read object.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package gcs implements the backend interface using Google Cloud Storage.
|
Package gcs implements the backend interface using Google Cloud Storage. |
|
Package memory implements an in-memory backend for testing and development.
|
Package memory implements an in-memory backend for testing and development. |
|
Package middleware provides decorators for backend implementations, including logging and latency simulation.
|
Package middleware provides decorators for backend implementations, including logging and latency simulation. |
Click to show internal directories.
Click to hide internal directories.