Documentation
¶
Index ¶
- Variables
- func ArchiveBackupID(key string) (string, string, bool)
- func ArchiveKey(backupID, replicasetUUID string) string
- func CleanKey(key string) (string, error)
- func CleanPrefix(prefix string) (string, error)
- func DataPrefix() string
- func GetBytes(ctx context.Context, s Storage, key string) ([]byte, error)
- func ManifestBackupID(key string) (string, bool)
- func ManifestKey(backupID string) string
- func ManifestsPrefix() string
- func PrefixWithSlash(prefix string) string
- func PutBytes(ctx context.Context, s Storage, key string, b []byte) error
- type ObjectInfo
- type Storage
Constants ¶
This section is empty.
Variables ¶
var ( // ErrKeyNotFound is returned when a requested object does not exist. ErrKeyNotFound = errors.New("storage: key not found") // ErrInvalidKey is returned when a key is not a canonical storage key. ErrInvalidKey = errors.New("storage: invalid key") // ErrStorageMissing is returned when the storage itself is not there. A // reader treats that as an error -- a mistyped path must not read as an // empty storage -- while a writer creating the first backup of a new // storage treats it as "nothing stored yet". ErrStorageMissing = errors.New("storage: does not exist") )
Functions ¶
func ArchiveBackupID ¶
ArchiveBackupID splits an archive key into the backup id and the replicaset UUID it was produced for. It is the inverse of ArchiveKey: a backup id may itself contain dashes, so the key is parsed from the right, where the UUID has a fixed shape. False means the key does not name an archive of this layout.
func ArchiveKey ¶
ArchiveKey returns a relative key for a replicaset backup archive object.
func CleanPrefix ¶
CleanPrefix returns a canonical storage list prefix.
func DataPrefix ¶
func DataPrefix() string
DataPrefix returns the relative key prefix for backup archives.
func ManifestBackupID ¶
ManifestBackupID returns the backup id a manifest key belongs to. It is the inverse of ManifestKey, used to name an object whose content could not be read; false means the key is not a manifest key.
func ManifestKey ¶
ManifestKey returns a relative key for a cluster manifest object.
func ManifestsPrefix ¶
func ManifestsPrefix() string
ManifestsPrefix returns the relative key prefix for backup manifests.
func PrefixWithSlash ¶
PrefixWithSlash ensures the prefix ends with a trailing slash, unless it is empty.
Types ¶
type ObjectInfo ¶
ObjectInfo describes one stored object.
type Storage ¶
type Storage interface {
// List returns objects whose key starts with prefix, sorted by key.
List(ctx context.Context, prefix string) ([]ObjectInfo, error)
// Get opens the object for reading, returning ErrKeyNotFound if it is absent.
Get(ctx context.Context, key string) (io.ReadCloser, error)
// Put stores the bytes read from r under key. size must be the exact,
// non-negative number of bytes r yields; implementations reject a negative
// size or a byte-count mismatch. Streaming with an unknown length is not
// supported.
Put(ctx context.Context, key string, r io.Reader, size int64) error
// Delete removes the object; a missing object is not an error.
Delete(ctx context.Context, key string) error
}
Storage describes a backup object storage backend.
Keys are canonical slash-separated paths (see CleanKey). Implementations must behave uniformly: Get reports a missing object via ErrKeyNotFound, List reports it via an empty (non-nil) result, Delete is idempotent (a missing key is not an error), List results are sorted by key, and every method honors ctx cancellation.