Documentation
¶
Overview ¶
Package workload is an app owner's backup (ADR-0222): the members a BackupSchedule's scope names, one full copy of them under <target>/<ns>/<backup>-<uid>/ (Decision 4) and the reads a Restore makes of it. Each member's file is ADR-0203's framed records in one Seal stream, put in 8 MiB parts IfNotExist; a catalog's objects go before its catalog.db, checked against it (Decision 5); the plain manifest.yaml goes last.
Index ¶
- Constants
- Variables
- func CatalogFiles(db []byte) ([]string, error)
- func DecodeObject(v []byte) (contentType string, md map[string]string, body []byte, err error)
- func EncodeObject(contentType string, md map[string]string, body []byte) []byte
- func Integrity(ctx context.Context, src blob.Bucket, path string, m Manifest) error
- func KVPrefix(ns v1.NamespaceName, name v1.ObjectName) string
- func Records(ctx context.Context, src blob.Bucket, path string, f backup.StoreFile, ...) func() (snapshot.Record, error)
- type Manifest
- type Member
- type MemberFile
- type Options
- type Sources
Constants ¶
const Format = 1
Format is the workload manifest's format; a changed meaning, framing or layout bumps it.
Variables ¶
var ( ErrCatalogUnstable = errors.New("the catalog changed under every copy") ErrTargetUnconditional = errors.New("the target refuses a create-if-absent put") )
The failures a run's record names by reason (Decisions 4, 5).
Functions ¶
func CatalogFiles ¶
CatalogFiles lists the objects a DuckLake checkpoint names (Decision 5): each ducklake_data_file and ducklake_delete_file path, resolved against its table's, its schema's and the data path, as a key relative to the data path, the catalog's prefix; sorted and distinct. It reads a read-only temporary copy of db. A path outside the data path is fault.Invalid: a restore into another prefix could not follow it.
func DecodeObject ¶
DecodeObject reverses EncodeObject; a torn or trailing frame is fault.Invalid.
func EncodeObject ¶
EncodeObject frames an object as uvarint-length fields (ADR-0203): its content type, its metadata's count and each key and value in key order, then its body.
func Integrity ¶
Integrity reads every part of every file m names and checks its bytes and sha256; a missing part or a mismatch is fault.Invalid.
func KVPrefix ¶
func KVPrefix(ns v1.NamespaceName, name v1.ObjectName) string
KVPrefix is a KVStore's key prefix in the KV substrate, <ns>/<store>/ (ADR-0072).
Types ¶
type Manifest ¶
type Manifest struct {
Format int `json:"format"`
Namespace string `json:"namespace"`
Backup string `json:"backup"`
Funcd string `json:"funcd"`
At v1.Timestamp `json:"at"`
Members []MemberFile `json:"members"`
Recipients []string `json:"recipients,omitempty"`
}
Manifest is a Backup's manifest.yaml, plain, written last: the copy exists once it does. Backup is the copy's directory, <backup>-<uid>.
func ReadManifest ¶
ReadManifest reads the manifest under path; a format above Format is fault.Invalid.
func Write ¶
func Write(ctx context.Context, ns v1.NamespaceName, ms []Member, src Sources, o Options) (Manifest, error)
Write copies ms under o.Path, then puts the manifest (Decisions 4, 5): a KVStore to kv/<store>/, a Bucket's objects to blob/<bucket>/, a catalog's objects but catalog.db to catalog/<name>/<attempt>/files/ and then its catalog.db to catalog/<name>/<attempt>/catalog.db/. A refused IfNotExist is ErrTargetUnconditional; a catalog whose checkpoint names an object no attempt copied is ErrCatalogUnstable.
type Member ¶
type Member struct {
Kind v1.Kind
Name v1.ObjectName
Catalog v1.CatalogRef
}
Member is one store of a scope. Catalog is a CatalogService member's spec.catalog, which Write copies.
func Resolve ¶
func Resolve(ctx context.Context, st store.Store, ns v1.NamespaceName, s v1.BackupScope) ([]Member, error)
Resolve lists the members s names in ns (Decision 2), KVStores, Buckets then CatalogServices: by name, the stores of the App's kv, buckets and catalogs entries, or the stores of the ResourceGroup. A named member or App that does not exist is fault.NotFound naming it.
type MemberFile ¶
type MemberFile struct {
Kind v1.Kind `json:"kind"`
Name v1.ObjectName `json:"name"`
Attempt int `json:"attempt,omitempty"`
Files []backup.StoreFile `json:"files"`
}
MemberFile is one member's files in the manifest: a store's one, a catalog's files then catalog.db, of Attempt.