Documentation
¶
Index ¶
- Variables
- func AgentID(c *cli.Context) string
- func BlobCache(c *cli.Context, repo *goback.Repo) *blobcache.Cache
- func CloseRepo(repo *goback.Repo)
- func Context(c *cli.Context) context.Context
- func Env(c *cli.Context, repo *goback.Repo, caches goback.Caches) *job.Env
- func Fail(msg string)
- func FailError(err error)
- func Fatal(v ...any)
- func Fatalf(format string, v ...any)
- func Fatalln(v ...any)
- func GetRetention(index backup.Index) backup.Retention
- func Graceful(c *cli.Context, grace time.Duration) (context.Context, <-chan struct{})
- func JSON() bool
- func Metadata(c *cli.Context) map[string]string
- func OpenRepo(c *cli.Context) *goback.Repo
- func ParseRef(s string) *proto.Ref
- func Restorer(c *cli.Context, repo *goback.Repo) *backup.Restorer
- func Result(v any, text func())
- func SetOutput(json bool)
- func Settings(c *cli.Context) (goback.Settings, error)
- func StoreKey(c *cli.Context, repo *goback.Repo) *storekey.Key
- func SweepBlobCache(cache *blobcache.Cache)
- type Done
Constants ¶
This section is empty.
Variables ¶
var MetaFlag = cli.StringSliceFlag{
Name: "meta",
Usage: "key=value label recorded in the object; repeatable",
}
MetaFlag is the repeatable --meta key=value flag of the commands that write a commit or a pin.
var RechunkFlag = cli.BoolFlag{
Name: "rechunk",
Usage: "cut an existing destination with the backup's chunker, so parts that only moved are not downloaded",
}
RechunkFlag turns --rechunk on a restore command.
var SalvageFlag = cli.BoolFlag{
Name: "salvage",
Usage: "write what can be read when parts are missing, leaving holes, and report them",
}
SalvageFlag turns --salvage on a restore command.
var View = gen.MapperImpl{}
View turns what a command did into what its JSON output shows.
Functions ¶
func BlobCache ¶
BlobCache opens the repo's blob cache under --cache-dir, or exits. It returns nil when --cache-dir is unset.
func Context ¶
Context returns the command's context: cancelled by the first SIGINT or SIGTERM, with a second signal ending the process as usual, and carrying the agent as the principal.
func Env ¶
Env is the job environment of repo with the caches c names, or exits. The programs runs start write to stderr as they are. Close it before the repo.
func Fail ¶
func Fail(msg string)
Fail reports that a command failed: in JSON mode as an error object on stdout, otherwise as an error in the log.
func FailError ¶
func FailError(err error)
FailError reports that a command failed with err, as Fail does with its message; in JSON mode the error object also carries err's gRPC status code name as "code", if err carries one.
func Fatal ¶
func Fatal(v ...any)
Fatal fails the command with the values' message, as log.Fatal would, and exits 1. The first error among v gives the JSON error its code.
func Fatalf ¶
Fatalf fails the command with the formatted message and exits 1. The first error among v gives the JSON error its code.
func Fatalln ¶
func Fatalln(v ...any)
Fatalln fails the command as log.Fatalln would and exits 1. The first error among v gives the JSON error its code.
func GetRetention ¶
GetRetention returns the index's retention interface or exits.
func Graceful ¶
Graceful returns a context for a command that runs until SIGTERM: stop closes on the first SIGINT or SIGTERM, and ctx ends on the second or once grace has passed since the first. ctx carries the agent as the principal.
func Restorer ¶
Restorer is a restorer of repo set up from the restore flags shared by commit restore and file restore, or exits.
func Result ¶
func Result(v any, text func())
Result reports what a command produced: v as JSON on stdout in JSON mode, otherwise whatever text prints.
func SetOutput ¶
func SetOutput(json bool)
SetOutput sets up a command's output: logs as text on stderr, or with json set as JSON lines on stderr, with results and errors as JSON on stdout. Output of the log package goes through the same handler.
func StoreKey ¶
StoreKey is the store key the global flags name, or exits. It is nil for a store written in the clear.
func SweepBlobCache ¶
SweepBlobCache trims the cache to its size limit and logs the result.