Skip to content
API Documentation
BastionGuard™
Snapshot Class Reference
Inheritance diagram for Snapshot:

Public Member Functions

 Snapshot (string dir_path, bool btrfs_snapshot, SnapshotRepo _repo)
void add_tag (string tag)
void remove_tag (string tag)
bool has_tag (string tag)
void read_control_file ()
void read_exclude_list ()
void read_fstab_file ()
void read_crypttab_file ()
void update_control_file ()
void remove_control_file ()
bool has_subvolumes ()
bool remove (bool wait)
bool remove_rsync (bool wait)
bool remove_btrfs ()
void mark_for_deletion ()
void parse_log_file ()

Static Public Member Functions

static Snapshot write_control_file (string snapshot_path, DateTime dt_created, string root_uuid, string distro_full_name, string tag, string comments, int64 item_count, bool is_btrfs, bool is_live, SnapshotRepo repo, bool silent=false)

Public Attributes

string path = ""
string name = ""
DateTime date
string sys_uuid = ""
string sys_distro = ""
string app_version = ""
string description = ""
int64 file_count = 0
Gee.ArrayList< string > tags
Gee.ArrayList< string > exclude_list
Gee.HashMap< string, Subvolume > subvolumes
Gee.ArrayList< FsTabEntry > fstab_list
Gee.ArrayList< CryptTabEntry > cryttab_list
bool valid = true
bool live = false
bool marked_for_deletion = false
LinuxDistro distro
SnapshotRepo repo
bool btrfs_mode = false
Gee.HashMap< string, string > paths
string mount_path_root = ""
string mount_path_home = ""
DeleteFileTask delete_file_task

Properties

string date_formatted [get]
string rsync_log_file [get]
string rsync_changes_log_file [get]
string rsync_restore_log_file [get]
string rsync_restore_changes_log_file [get]
string exclude_file_for_backup [get]
string exclude_file_for_restore [get]
string taglist [get, set]
string taglist_short [get]
Gee.ArrayList< Subvolume > subvolumes_sorted [get]

Detailed Description

Definition at line 34 of file Snapshot.vala.

Constructor & Destructor Documentation

◆ Snapshot()

Snapshot.Snapshot ( string dir_path,
bool btrfs_snapshot,
SnapshotRepo _repo )
inline

Definition at line 63 of file Snapshot.vala.

63 {
64
65 try{
66 var f = File.new_for_path(dir_path);
67 var info = f.query_info("*", FileQueryInfoFlags.NONE);
68
69 path = dir_path;
70 name = info.get_name();
71 description = "";
72 btrfs_mode = btrfs_snapshot;
73 repo = _repo;
74
75 date = new DateTime.from_unix_utc(0);
76 tags = new Gee.ArrayList<string>();
77 exclude_list = new Gee.ArrayList<string>();
78 fstab_list = new Gee.ArrayList<FsTabEntry>();
80 subvolumes = new Gee.HashMap<string,Subvolume>();
81 paths = new Gee.HashMap<string,string>();
82
87 }
88 catch(Error e){
89 log_error (e.message);
90 }
91 }
DeleteFileTask delete_file_task
Definition Snapshot.vala:61
DateTime date
Definition Snapshot.vala:38
void read_exclude_list()
string name
Definition Snapshot.vala:37
string description
Definition Snapshot.vala:42
SnapshotRepo repo
Definition Snapshot.vala:53
Gee.HashMap< string, Subvolume > subvolumes
Definition Snapshot.vala:46
void read_control_file()
void read_fstab_file()
string path
Definition Snapshot.vala:36
void read_crypttab_file()
bool btrfs_mode
Definition Snapshot.vala:56
Gee.ArrayList< string > exclude_list
Definition Snapshot.vala:45
Gee.ArrayList< string > tags
Definition Snapshot.vala:44
Gee.HashMap< string, string > paths
Definition Snapshot.vala:57
Gee.ArrayList< FsTabEntry > fstab_list
Definition Snapshot.vala:47
void log_error(string message, bool highlight=false, bool is_warning=false)

References btrfs_mode, date, delete_file_task, DeleteFileTask.DeleteFileTask(), description, Error, exclude_list, fstab_list, TeeJee.Logging.log_error(), name, path, paths, read_control_file(), read_crypttab_file(), read_exclude_list(), read_fstab_file(), repo, subvolumes, and tags.

Referenced by SnapshotRepo.load_snapshots(), and write_control_file().

Member Function Documentation

◆ add_tag()

void Snapshot.add_tag ( string tag)
inline

Definition at line 167 of file Snapshot.vala.

167 {
168
169 if (!tags.contains(tag.strip())){
170 tags.add(tag.strip());
172 }
173 }
void update_control_file()

References tags, and update_control_file().

◆ has_subvolumes()

bool Snapshot.has_subvolumes ( )
inline

Definition at line 440 of file Snapshot.vala.

440 {
441 foreach(FsTabEntry en in fstab_list){
442 if (en.options.contains("subvol=@")){
443 return true;
444 }
445 }
446 return false;
447 }
string options

References fstab_list, and FsTabEntry.options.

Referenced by Main.mount_target_devices().

◆ has_tag()

bool Snapshot.has_tag ( string tag)
inline

Definition at line 183 of file Snapshot.vala.

183 {
184
185 return tags.contains(tag.strip());
186 }

References tags.

◆ mark_for_deletion()

void Snapshot.mark_for_deletion ( )
inline

Definition at line 563 of file Snapshot.vala.

563 {
564
565 string delete_trigger_file = path + "/delete";
566
567 if (!file_exists(delete_trigger_file)){
568 file_write(delete_trigger_file, "");
569 marked_for_deletion = true;
570 } else {
571 file_delete(delete_trigger_file);
572 marked_for_deletion = false;
573 }
574 }
bool marked_for_deletion
Definition Snapshot.vala:51
bool file_exists(string file_path)
bool file_write(string file_path, string contents)
bool file_delete(string file_path)

References TeeJee.FileSystem.file_delete(), TeeJee.FileSystem.file_exists(), TeeJee.FileSystem.file_write(), marked_for_deletion, and path.

◆ parse_log_file()

void Snapshot.parse_log_file ( )
inline

Definition at line 576 of file Snapshot.vala.

576 {
577 /* Parses and archives rsync-log file, creates rsync-log-changes */
578 var task = new RsyncTask();
579 task.parse_log(rsync_log_file);
580 }
string rsync_log_file

References rsync_log_file, and RsyncTask.RsyncTask().

◆ read_control_file()

void Snapshot.read_control_file ( )
inline

Definition at line 190 of file Snapshot.vala.

190 {
191
192 //log_debug("read_control_file()");
193
194 string ctl_file = path + "/info.json";
195
196 var f = File.new_for_path(ctl_file);
197
198 if (f.query_exists()) {
199
200 var parser = new Json.Parser();
201
202 try{
203 parser.load_from_file(ctl_file);
204 } catch (Error e) {
205 log_error (e.message);
206 }
207
208 var node = parser.get_root();
209 var config = node.get_object();
210
211 if ((node == null)||(config == null)){
212 valid = false;
213 return;
214 }
215
216 string val = json_get_string(config,"created","");
217 if (val.length > 0) {
218 DateTime date_utc = new DateTime.from_unix_utc(int64.parse(val));
219 date = date_utc.to_local();
220 }
221
222 sys_uuid = json_get_string(config,"sys-uuid","");
223 sys_distro = json_get_string(config,"sys-distro","");
224 taglist = json_get_string(config,"tags","");
225 description = json_get_string(config,"comments","");
226 app_version = json_get_string(config,"app-version","");
227 file_count = (int64) json_get_uint64(config,"file_count",file_count);
228 live = json_get_bool(config,"live",false);
229 string type = config.get_string_member_with_default("type", "rsync");
230
231 string extension = (type == "btrfs") ? "@" : "localhost";
232 distro = LinuxDistro.get_dist_info(path_combine(path, extension));
233
234 //log_debug("repo.mount_path: %s".printf(repo.mount_path));
235
236 if (config.has_member("subvolumes")){
237
238 var subvols = (Json.Object) config.get_object_member("subvolumes");
239
240 foreach(string subvol_name in subvols.get_members()){
241
242 if ((subvol_name != "@")&&(subvol_name != "@home")){ continue; }
243
244 paths[subvol_name] = path.replace(repo.mount_path, repo.mount_paths[subvol_name]);
245
246 var subvol_path = path_combine(paths[subvol_name], subvol_name);
247
248 if (!dir_exists(subvol_path)){ continue; }
249
250 //log_debug("subvol_path: %s".printf(subvol_path));
251
252 var subvolume = new Subvolume(subvol_name, subvol_path, "", repo); //subvolumes.get(subvol_name);
253 subvolumes.set(subvol_name, subvolume);
254
255 int index = -1;
256
257 foreach(Json.Node jnode in subvols.get_array_member(subvol_name).get_elements()) {
258
259 string item = jnode.get_string();
260 switch (++index){
261 case 0:
262 subvolume.name = item;
263 break;
264 case 1:
265 subvolume.id = long.parse(item);
266 break;
267 case 2:
268 subvolume.total_bytes = int64.parse(item);
269 break;
270 case 3:
271 subvolume.unshared_bytes = int64.parse(item);
272 break;
273 case 4:
274 subvolume.device_uuid = item.strip();
275 break;
276 }
277 }
278 }
279 }
280
281 string delete_trigger_file = path + "/delete";
282 if (file_exists(delete_trigger_file)){
283 marked_for_deletion = true;
284 }
285 }
286 else{
287 valid = false;
288 }
289
290 //log_debug("read_control_file(): exit");
291 }
static LinuxDistro get_dist_info(string root_path)
Gee.HashMap< string, string > mount_paths
LinuxDistro distro
Definition Snapshot.vala:52
string sys_distro
Definition Snapshot.vala:40
bool live
Definition Snapshot.vala:50
bool valid
Definition Snapshot.vala:49
string app_version
Definition Snapshot.vala:41
string taglist
string sys_uuid
Definition Snapshot.vala:39
int64 file_count
Definition Snapshot.vala:43
Subvolume(string name, string path, string parent_dev_uuid, SnapshotRepo? parent_repo)
string path_combine(string path1, string path2)
bool dir_exists(string dir_path)
uint64 json_get_uint64(Json.Object jobj, string member, uint64 def_value)
string json_get_string(Json.Object jobj, string member, string def_value)
bool json_get_bool(Json.Object jobj, string member, bool def_value)

References app_version, date, description, TeeJee.FileSystem.dir_exists(), distro, Error, file_count, TeeJee.FileSystem.file_exists(), LinuxDistro.get_dist_info(), TeeJee.JsonHelper.json_get_bool(), TeeJee.JsonHelper.json_get_string(), TeeJee.JsonHelper.json_get_uint64(), live, TeeJee.Logging.log_error(), marked_for_deletion, SnapshotRepo.mount_path, SnapshotRepo.mount_paths, path, TeeJee.FileSystem.path_combine(), paths, repo, Subvolume.Subvolume(), subvolumes, sys_distro, sys_uuid, taglist, and valid.

Referenced by Snapshot().

◆ read_crypttab_file()

void Snapshot.read_crypttab_file ( )
inline

Definition at line 330 of file Snapshot.vala.

330 {
331
332 string crypttab_path = path_combine(path, "/localhost/etc/crypttab");
333
334 if (btrfs_mode){
335 crypttab_path = path_combine(path, "/@/etc/crypttab");
336 }
337
338 cryttab_list = CryptTabEntry.read_file(crypttab_path);
339 }
Gee.ArrayList< CryptTabEntry > cryttab_list
Definition Snapshot.vala:48

References btrfs_mode, cryttab_list, path, and TeeJee.FileSystem.path_combine().

Referenced by Snapshot().

◆ read_exclude_list()

void Snapshot.read_exclude_list ( )
inline

Definition at line 293 of file Snapshot.vala.

293 {
294
295 string list_file = path + "/exclude.list";
296
297 exclude_list.clear();
298
299 var f = File.new_for_path(list_file);
300
301 if (f.query_exists()) {
302
303 foreach(string path in file_read(list_file).split("\n")){
304
305 path = path.strip();
306
307 if (!exclude_list.contains(path) && path.length > 0){
308 exclude_list.add(path);
309 }
310 }
311 }
312 else{
313 if (!btrfs_mode){
314 valid = false;
315 }
316 }
317 }
string? file_read(string file_path)

References btrfs_mode, exclude_list, TeeJee.FileSystem.file_read(), path, and valid.

Referenced by Snapshot().

◆ read_fstab_file()

void Snapshot.read_fstab_file ( )
inline

Definition at line 319 of file Snapshot.vala.

319 {
320
321 string fstab_path = path_combine(path, "/localhost/etc/fstab");
322
323 if (btrfs_mode){
324 fstab_path = path_combine(path, "/@/etc/fstab");
325 }
326
327 fstab_list = FsTabEntry.read_file(fstab_path);
328 }

References btrfs_mode, fstab_list, path, and TeeJee.FileSystem.path_combine().

Referenced by Snapshot().

◆ remove()

bool Snapshot.remove ( bool wait)
inline

Definition at line 464 of file Snapshot.vala.

464 {
465
466 if (!dir_exists(path)){
467 return true;
468 }
469
470 bool status = true;
471
472 if (btrfs_mode){
473 status = remove_btrfs();
474 }
475 else{
476 status = remove_rsync(wait);
477 }
478
479 return status;
480 }
bool remove_btrfs()
bool remove_rsync(bool wait)

References btrfs_mode, TeeJee.FileSystem.dir_exists(), path, remove_btrfs(), and remove_rsync().

Referenced by AppConsole.delete_snapshot().

◆ remove_btrfs()

bool Snapshot.remove_btrfs ( )
inline

Definition at line 519 of file Snapshot.vala.

519 {
520
521 log_msg(string.nfill(78, '-'));
522
523 var message = _("Removing snapshot") + ": %s".printf(name);
524 log_msg(message);
525
526 // delete subvolumes
527
528 foreach(var subvol in subvolumes.values){
529
530 bool ok = subvol.remove();
531 if (!ok) {
532 log_error(_("Failed to remove snapshot") + ": %s".printf(name));
533 log_msg(string.nfill(78, '-'));
534 return false;
535 }
536 }
537
538 // delete directories after **all** subvolumes have been deleted
539
540 foreach(var subvol in subvolumes.values){
541
542 bool ok = dir_delete(paths[subvol.name], true);
543 if (!ok) {
544 log_error(_("Failed to remove snapshot") + ": %s".printf(name));
545 log_msg(string.nfill(78, '-'));
546 return false;
547 }
548 }
549
550 if (!dir_delete(path, true)){
551
552 log_error(_("Failed to remove snapshot") + ": %s".printf(name));
553 log_msg(string.nfill(78, '-'));
554 return false;
555 }
556
557 log_msg(_("Removed snapshot") + ": %s".printf(name));
558 log_msg(string.nfill(78, '-'));
559
560 return true;
561 }
#define _(s)
void log_msg(string message, bool highlight=false)

References _, TeeJee.Logging.log_error(), TeeJee.Logging.log_msg(), name, path, paths, and subvolumes.

Referenced by remove().

◆ remove_control_file()

void Snapshot.remove_control_file ( )
inline

Definition at line 390 of file Snapshot.vala.

390 {
391
392 string ctl_file = path + "/info.json";
393 file_delete(ctl_file);
394 }

References TeeJee.FileSystem.file_delete(), and path.

◆ remove_rsync()

bool Snapshot.remove_rsync ( bool wait)
inline

Definition at line 482 of file Snapshot.vala.

482 {
483
484 log_msg(string.nfill(78, '-'));
485
486 var message = _("Removing") + " '%s'...".printf(name);
487 log_msg(message);
488
489 delete_file_task.dest_path = "%s/".printf(path);
490 delete_file_task.status_message = message;
491 delete_file_task.prg_count_total = Main.first_snapshot_count;
493
494 if (wait){
495
496 while (delete_file_task.status == AppStatus.RUNNING){
497
498 sleep(1000);
499 gtk_do_events ();
500
501 stdout.printf("%6.2f%% %s (%s %s)\r".printf(
502 delete_file_task.progress * 100.0, _("complete"),
503 delete_file_task.stat_time_remaining, _("remaining")));
504
505 stdout.flush();
506 }
507
508 stdout.printf(string.nfill(80, ' ') + "\r");
509 stdout.flush();
510
511 message = "%s '%s'".printf(_("Removed"), name);
512 log_msg(message);
513 log_msg(string.nfill(78, '-'));
514 }
515
516 return true;
517 }
AppStatus
string??? stat_time_remaining
virtual void execute()
AppStatus status
double progress
void sleep(int milliseconds)

References _, delete_file_task, AsyncTask.execute(), Main.first_snapshot_count, TeeJee.GtkHelper.gtk_do_events(), TeeJee.Logging.log_msg(), name, path, AsyncTask.progress, TeeJee.System.sleep(), AsyncTask.stat_time_remaining, and AsyncTask.status.

Referenced by remove().

◆ remove_tag()

void Snapshot.remove_tag ( string tag)
inline

Definition at line 175 of file Snapshot.vala.

175 {
176
177 if (tags.contains(tag.strip())){
178 tags.remove(tag.strip());
180 }
181 }

References tags, and update_control_file().

◆ update_control_file()

void Snapshot.update_control_file ( )
inline

Definition at line 341 of file Snapshot.vala.

341 {
342 /* Updates tag and comments */
343
344 try{
345 string ctl_file = path + "/info.json";
346 var f = File.new_for_path(ctl_file);
347
348 if (f.query_exists()) {
349
350 var parser = new Json.Parser();
351 try{
352 parser.load_from_file(ctl_file);
353 } catch (Error e) {
354 log_error (e.message);
355 }
356 var node = parser.get_root();
357 var config = node.get_object();
358
359 config.set_string_member("tags", taglist);
360 config.set_string_member("comments", description);
361 config.set_string_member("live", live.to_string());
362
363 if (btrfs_mode){
364 var subvols = new Json.Object();
365 config.set_object_member("subvolumes",subvols);
366 foreach(var subvol in subvolumes.values){
367 Json.Array arr = new Json.Array();
368 arr.add_string_element(subvol.name);
369 arr.add_string_element(subvol.id.to_string());
370 arr.add_string_element(subvol.total_bytes.to_string());
371 arr.add_string_element(subvol.unshared_bytes.to_string());
372 arr.add_string_element(subvol.device_uuid);
373 subvols.set_array_member(subvol.name,arr);
374 }
375 }
376
377 var json = new Json.Generator();
378 json.pretty = true;
379 json.indent = 2;
380 node.set_object(config);
381 json.set_root(node);
382 f.delete();
383 json.to_file(ctl_file);
384 }
385 } catch (Error e) {
386 log_error (e.message);
387 }
388 }
nlohmann::json json
Definition Backend.cpp:2908

References btrfs_mode, description, Error, live, TeeJee.Logging.log_error(), path, subvolumes, and taglist.

Referenced by add_tag(), SnapshotRow.build_ui(), Main.create_pre_restore_snapshot_btrfs(), Main.create_snapshot_with_btrfs(), and remove_tag().

◆ write_control_file()

Snapshot Snapshot.write_control_file ( string snapshot_path,
DateTime dt_created,
string root_uuid,
string distro_full_name,
string tag,
string comments,
int64 item_count,
bool is_btrfs,
bool is_live,
SnapshotRepo repo,
bool silent = false )
inlinestatic

Definition at line 396 of file Snapshot.vala.

398 {
399
400 var ctl_path = snapshot_path + "/info.json";
401 var config = new Json.Object();
402
403 config.set_string_member("created", dt_created.to_utc().to_unix().to_string());
404 config.set_string_member("sys-uuid", root_uuid);
405 config.set_string_member("sys-distro", distro_full_name);
406 config.set_string_member("app-version", AppVersion);
407 config.set_string_member("file_count", item_count.to_string());
408 config.set_string_member("tags", tag);
409 config.set_string_member("comments", comments);
410 config.set_string_member("live", is_live.to_string());
411 config.set_string_member("type", (is_btrfs ? "btrfs" : "rsync"));
412
413 var json = new Json.Generator();
414 json.pretty = true;
415 json.indent = 2;
416 var node = new Json.Node(NodeType.OBJECT);
417 node.set_object(config);
418 json.set_root(node);
419
420 try{
421 var f = File.new_for_path(ctl_path);
422 if (f.query_exists()){
423 f.delete();
424 }
425
426 json.to_file(ctl_path);
427 } catch (Error e) {
428 log_error (e.message);
429 }
430
431 if (!silent){
432 log_msg(_("Created control file") + ": %s".printf(ctl_path));
433 }
434
435 return (new Snapshot(snapshot_path, is_btrfs, repo));
436 }
Snapshot(string dir_path, bool btrfs_snapshot, SnapshotRepo _repo)
Definition Snapshot.vala:63

References _, Error, TeeJee.Logging.log_error(), TeeJee.Logging.log_msg(), repo, and Snapshot().

Referenced by Main.create_pre_restore_snapshot_btrfs(), Main.create_snapshot_with_btrfs(), and Main.create_snapshot_with_rsync().

Member Data Documentation

◆ app_version

string Snapshot.app_version = ""

Definition at line 41 of file Snapshot.vala.

Referenced by read_control_file().

◆ btrfs_mode

bool Snapshot.btrfs_mode = false

◆ cryttab_list

Gee.ArrayList<CryptTabEntry> Snapshot.cryttab_list

Definition at line 48 of file Snapshot.vala.

Referenced by Main.init_mount_list(), and read_crypttab_file().

◆ date

◆ delete_file_task

DeleteFileTask Snapshot.delete_file_task

Definition at line 61 of file Snapshot.vala.

Referenced by remove_rsync(), and Snapshot().

◆ description

string Snapshot.description = ""

◆ distro

LinuxDistro Snapshot.distro

◆ exclude_list

Gee.ArrayList<string> Snapshot.exclude_list

Definition at line 45 of file Snapshot.vala.

Referenced by read_exclude_list(), and Snapshot().

◆ file_count

int64 Snapshot.file_count = 0

Definition at line 43 of file Snapshot.vala.

Referenced by read_control_file(), and Main.restore_other_gui().

◆ fstab_list

Gee.ArrayList<FsTabEntry> Snapshot.fstab_list

Definition at line 47 of file Snapshot.vala.

Referenced by has_subvolumes(), Main.init_mount_list(), read_fstab_file(), and Snapshot().

◆ live

bool Snapshot.live = false

Definition at line 50 of file Snapshot.vala.

Referenced by SnapshotRow.build_ui(), read_control_file(), and update_control_file().

◆ marked_for_deletion

bool Snapshot.marked_for_deletion = false

◆ mount_path_home

string Snapshot.mount_path_home = ""

Definition at line 59 of file Snapshot.vala.

◆ mount_path_root

string Snapshot.mount_path_root = ""

Definition at line 58 of file Snapshot.vala.

◆ name

◆ path

◆ paths

Gee.HashMap<string,string> Snapshot.paths

Definition at line 57 of file Snapshot.vala.

Referenced by read_control_file(), remove_btrfs(), and Snapshot().

◆ repo

SnapshotRepo Snapshot.repo

Definition at line 53 of file Snapshot.vala.

Referenced by read_control_file(), Snapshot(), and write_control_file().

◆ subvolumes

◆ sys_distro

string Snapshot.sys_distro = ""

Definition at line 40 of file Snapshot.vala.

Referenced by SnapshotRow.build_meta_text(), and read_control_file().

◆ sys_uuid

string Snapshot.sys_uuid = ""

Definition at line 39 of file Snapshot.vala.

Referenced by read_control_file().

◆ tags

Gee.ArrayList<string> Snapshot.tags

Definition at line 44 of file Snapshot.vala.

Referenced by add_tag(), has_tag(), remove_tag(), and Snapshot().

◆ valid

bool Snapshot.valid = true

Definition at line 49 of file Snapshot.vala.

Referenced by SnapshotRepo.load_snapshots(), read_control_file(), and read_exclude_list().

Property Documentation

◆ date_formatted

string Snapshot.date_formatted
get

Definition at line 95 of file Snapshot.vala.

95 {
96 owned get{
97 return date.format(App.date_format);//.format("%Y-%m-%d %H:%M:%S");
98 }
99 }
Main App
string date_format
Definition Main.vala:130

Referenced by SnapshotRow.build_ui(), and Main.create_pre_restore_snapshot_btrfs().

◆ exclude_file_for_backup

string Snapshot.exclude_file_for_backup
get

Definition at line 125 of file Snapshot.vala.

125 {
126 owned get {
127 return path_combine(path, "exclude.list");
128 }
129 }

◆ exclude_file_for_restore

string Snapshot.exclude_file_for_restore
get

Definition at line 131 of file Snapshot.vala.

131 {
132 owned get {
133 return path_combine(path, "exclude-restore.list");
134 }
135 }

◆ rsync_changes_log_file

string Snapshot.rsync_changes_log_file
get

Definition at line 107 of file Snapshot.vala.

107 {
108 owned get {
109 return path_combine(path, "rsync-log-changes");
110 }
111 }

◆ rsync_log_file

string Snapshot.rsync_log_file
get

Definition at line 101 of file Snapshot.vala.

101 {
102 owned get {
103 return path_combine(path, "rsync-log");
104 }
105 }

Referenced by parse_log_file().

◆ rsync_restore_changes_log_file

string Snapshot.rsync_restore_changes_log_file
get

Definition at line 119 of file Snapshot.vala.

119 {
120 owned get {
121 return path_combine(path, "rsync-log-restore-changes");
122 }
123 }

◆ rsync_restore_log_file

string Snapshot.rsync_restore_log_file
get

Definition at line 113 of file Snapshot.vala.

113 {
114 owned get {
115 return path_combine(path, "rsync-log-restore");
116 }
117 }

Referenced by RestoreWindow.initialize_tab().

◆ subvolumes_sorted

Gee.ArrayList<Subvolume> Snapshot.subvolumes_sorted
get

Definition at line 449 of file Snapshot.vala.

449 {
450 owned get {
451 var list = new Gee.ArrayList<Subvolume>();
452 foreach(var subvol in subvolumes.values){
453 list.add(subvol);
454 }
455 list.sort((a,b)=>{
456 return strcmp(a.name, b.name);
457 });
458 return list;
459 }
460 }

◆ taglist

string Snapshot.taglist
getset

Definition at line 139 of file Snapshot.vala.

139 {
140 owned get{
141 string str = "";
142 foreach(string tag in tags){
143 str += " " + tag;
144 }
145 return str.strip();
146 }
147 set{
148 tags.clear();
149 foreach(string tag in value.split(" ")){
150 if (!tags.contains(tag.strip())){
151 tags.add(tag.strip());
152 }
153 }
154 }
155 }

Referenced by read_control_file(), and update_control_file().

◆ taglist_short

string Snapshot.taglist_short
get

Definition at line 157 of file Snapshot.vala.

157 {
158 owned get{
159 string str = "";
160 foreach(string tag in tags){
161 str += " " + tag.replace("ondemand","O").replace("boot","B").replace("hourly","H").replace("daily","D").replace("weekly","W").replace("monthly","M");
162 }
163 return str.strip();
164 }
165 }

Referenced by SnapshotRow.build_meta_text(), and AppConsole.list_snapshots().


The documentation for this class was generated from the following file:
  • BastionGuard/thirdparty/bastionguard-backup/src/Core/Snapshot.vala