1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//! Backups over mgmt so K2 can make, list and ship bundles off the box
//! as user `k2` (bundle files are `sew 0600`).
//!
//! - `POST /mgmt/v1/backup` (body `{}`, `Idempotency-Key`) → `StartJobResponse`: job kind
//! [`BACKUP_JOB_KIND`], bundle kind `manual`, the backup engine in-process. One advisory lock
//! (`LOCK_BACKUP`) serializes it with the CLI and timer path (`sew backup now`,
//! `sew-backup@.service`): while another backup holds it the route answers `409 conflict`
//! `backup_running`; a job that loses the race fails with that reason. A second `POST` while
//! a backup job is queued or running answers the same job. The job's `result` is a
//! [`BackupJobResult`]. `503 unavailable` `backups_unavailable` when this server has no
//! backup engine (a test server, or `sew serve` without a backup config).
//! - `GET /mgmt/v1/backups` → [`MgmtBackupList`]: every complete bundle, newest first.
//! - `GET /mgmt/v1/backups/{id}/archive`: the stable tar of one bundle
//! (`manifest.json`, `db.dump`, `config/sew.toml`, `blobs.index`, then `blobs/…` sorted;
//! owner 0:0, mode 0600, mtime the bundle's time), streamed as `application/x-tar` with
//! `Content-Length` set; the same bundle is byte-equal every time. `id` may be `latest`.
//! `404 not_found` for an unknown id.
//!
//! `GET /mgmt/v1/status` fills `backup` and `drill` from the backup engine's `state.json` and
//! `drill-state.json`.
use JsonSchema;
use ;
use crateTimestamp;
/// The job kind of `POST /mgmt/v1/backup`.
pub const BACKUP_JOB_KIND: &str = "backup";
/// One bundle in `GET /mgmt/v1/backups` (as `sew backup list` shows it).
/// Response of `GET /mgmt/v1/backups`: newest first.
/// `JobStatus.result` of a succeeded `backup` job.