v2.31.0-dev21 b59533b

backup.go RawHistoryFolder

1package domain
2
3import "time"
4
5// DBType identifies the database engine.
6type DBType string
7
8const (
9	DBTypePostgreSQL DBType = "postgresql"
10	DBTypeUnknown    DBType = "unknown"
11)
12
13// BackupSchedule defines when backups run.
14type BackupSchedule string
15
16const (
17	ScheduleHourly  BackupSchedule = "hourly"
18	ScheduleDaily   BackupSchedule = "daily"
19	ScheduleWeekly  BackupSchedule = "weekly"
20	ScheduleMonthly BackupSchedule = "monthly"
21)
22
23// BackupType distinguishes backup methods.
24type BackupType string
25
26const (
27	BackupTypeLogical BackupType = "logical"
28)
29
30// BackupJobStatus tracks backup job lifecycle state.
31type BackupJobStatus string
32
33const (
34	BackupStatusPending   BackupJobStatus = "pending"
35	BackupStatusRunning   BackupJobStatus = "running"
36	BackupStatusCompleted BackupJobStatus = "completed"
37	BackupStatusFailed    BackupJobStatus = "failed"
38)
39
40// DBInfo holds detected database information from an attachment container.
41type DBInfo struct {
42	Type        DBType
43	Version     string
44	Domain      string
45	Name        string
46	Host        string
47	Port        int
48	ContainerID string
49	ImageName   string
50	// Credentials contains sensitive values (passwords/tokens).
51	// Never log or expose this map in API responses.
52	Credentials map[string]string `json:"-"`
53}
54
55// ClearCredentials clears sensitive credential values from DBInfo.
56func (d *DBInfo) ClearCredentials() {
57	if d == nil || d.Credentials == nil {
58		return
59	}
60	for k := range d.Credentials {
61		d.Credentials[k] = ""
62		delete(d.Credentials, k)
63	}
64	d.Credentials = nil
65}
66
67// BackupJob represents a scheduled or manual backup operation.
68type BackupJob struct {
69	ID          string
70	Domain      string
71	DBName      string
72	Schedule    BackupSchedule
73	Type        BackupType
74	Status      BackupJobStatus
75	StartedAt   time.Time
76	CompletedAt time.Time
77	SizeBytes   int64
78	FilePath    string
79	Error       string
80	Metadata    map[string]string
81}
82
83// BackupResult is returned after a backup operation completes.
84type BackupResult struct {
85	Job      BackupJob
86	Duration time.Duration
87}
88
89// RetentionPolicy defines how many backups to keep per schedule tier.
90type RetentionPolicy struct {
91	Hourly  int
92	Daily   int
93	Weekly  int
94	Monthly int
95}
96
97// BackupOverride allows per-domain backup configuration.
98type BackupOverride struct {
99	Schedules []BackupSchedule
100	Retention *RetentionPolicy
101}
102
103// BackupConfig is the top-level backup configuration.
104type BackupConfig struct {
105	Enabled    bool
106	StorageDir string
107	Retention  RetentionPolicy
108	Overrides  map[string]BackupOverride
109}
110
111// Backup labels for container metadata.
112const (
113	LabelBackupEnabled  = "gordon.backup"
114	LabelBackupType     = "gordon.backup.type"
115	LabelBackupVersion  = "gordon.backup.version"
116	LabelBackupSchedule = "gordon.backup.schedule"
117	LabelBackupSidecar  = "gordon.backup.sidecar"
118)

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 7

Tags 106

↑↓ moveenter openesc close