File: backrest_struct.go

package info (click to toggle)
prometheus-pgbackrest-exporter 0.19.0%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 480 kB
  • sloc: sh: 141; makefile: 136
file content (192 lines) | stat: -rw-r--r-- 4,193 bytes parent folder | download
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
package backrest

//	[{
//	  "archive": [{}],
//	  "cipher": "string",
//	  "backup": [{}],
//	  "db": [{}],
//	  "name": "string",
//	  "repo": [{}],
//	  "status": {}
//	}]
type stanza struct {
	Archive []archive `json:"archive"`
	Backup  []backup  `json:"backup"`
	Cipher  string    `json:"cipher"`
	DB      []db      `json:"db"`
	Name    string    `json:"name"`
	Repo    *[]repo   `json:"repo"`
	Status  status    `json:"status"`
}

//	"archive": [{
//	  "database": {},
//	  "id": "string",
//	  "max": "string",
//	  "min": "string"
//	}]
type archive struct {
	Database  databaseID `json:"database"`
	PGVersion string     `json:"id"`
	WALMax    string     `json:"max"`
	WALMin    string     `json:"min"`
}

//	"database": {
//	  "id": number,
//	  "repo-key": number
//	}
type databaseID struct {
	ID      int `json:"id"`
	RepoKey int `json:"repo-key"`
}

//	"backup": [{
//	  "annotation": {},
//	  "archive": {
//	      "start": "string",
//	      "stop": "string"
//	  },
//	  "backrest": {
//	      "format": number,
//	      "version": "string"
//	  },
//	  "database": {},
//	  "error": bool,
//	  "info": {},
//	  "label": "string",
//	  "lsn": {
//	      "start": "string,
//	      "stop": "string"
//	  },
//	  "prior": "string",
//	  "reference": "string",
//	  "timestamp": {
//	      "start": number,
//	      "stop": number
//	  },
//	  "type": "string"
//	}]
type backup struct {
	Annotation *annotation `json:"annotation"`
	Archive    struct {
		StartWAL string `json:"start"`
		StopWAL  string `json:"stop"`
	} `json:"archive"`
	BackrestInfo struct {
		Format  int    `json:"format"`
		Version string `json:"version"`
	} `json:"backrest"`
	Database    databaseID     `json:"database"`
	DatabaseRef *[]databaseRef `json:"database-ref"`
	Error       *bool          `json:"error"`
	Info        backupInfo     `json:"info"`
	Label       string         `json:"label"`
	Link        *[]struct {
		Destination string `json:"destination"`
		Name        string `json:"name"`
	} `json:"link"`
	Lsn struct {
		StartLSN string `json:"start"`
		StopLSN  string `json:"stop"`
	} `json:"lsn"`
	Prior      string   `json:"prior"`
	Reference  []string `json:"reference"`
	Tablespace *[]struct {
		Destination string `json:"destination"`
		Name        string `json:"name"`
		OID         int    `json:"oid"`
	} `json:"tablespace"`
	Timestamp struct {
		Start int64 `json:"start"`
		Stop  int64 `json:"stop"`
	} `json:"timestamp"`
	Type string `json:"type"`
}

//	"annotation": {
//		"string": "string",
//		"string": "string"
//	}
type annotation map[string]string

//	"database-ref": [{
//	  "name": "string",
//	  "oid": number
//	}]
type databaseRef struct {
	Name string `json:"name"`
	OID  int    `json:"oid"`
}

//	"info": {
//	  "delta": number,
//	  "repository": {
//	      "delta": number,
//	      "delta-map": number,
//	      "size": number,
//	      "size-map": number
//	  },
//	  "size": number
//	}
type backupInfo struct {
	Delta      int64 `json:"delta"`
	Repository struct {
		Delta    int64  `json:"delta"`
		DeltaMap *int64 `json:"delta-map"`
		Size     *int64 `json:"size"`
		SizeMap  *int64 `json:"size-map"`
	} `json:"repository"`
	Size int64 `json:"size"`
}

//	"db": [{
//	  "id": number,
//	  "repo-key": number,
//	  "system-id": number,
//	  "version": "string"
//	}]
type db struct {
	ID       int    `json:"id"`
	RepoKey  int    `json:"repo-key"`
	SystemID int64  `json:"system-id"`
	Version  string `json:"version"`
}

//	"repo": [{
//	  "cipher": "string",
//	  "key": number,
//	  "status": {
//	      "code": number,
//	      "message": "string"
//	  }
//	}]
type repo struct {
	Cipher string `json:"cipher"`
	Key    int    `json:"key"`
	Status struct {
		Code    int    `json:"code"`
		Message string `json:"message"`
	} `json:"status"`
}

//	"status": {
//	  "code": number,
//	  "lock": {
//	      "backup": {
//	          "held": bool
//	      }
//	  },
//	  "message": "string"
//	}
type status struct {
	Code int `json:"code"`
	Lock struct {
		Backup struct {
			Held         bool   `json:"held"`
			SizeTotal    *int64 `json:"size"`
			SizeComplete *int64 `json:"size-cplt"`
		} `json:"backup"`
	} `json:"lock"`
	Message string `json:"message"`
}