Disk ARchive: data_dir.hpp Source File

| Disk ARchive 2.8.1 Full featured and portable backup and archiving tool

Loading...
Searching...
No Matches
data_dir.hpp
Go to the documentation of this file.
1/*********************************************************************/
2// dar - disk archive - a backup/restoration program
3// Copyright (C) 2002-2025 Denis Corbin
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18//
19// to contact the author, see the AUTHOR file
20/*********************************************************************/
21
25
26
27#ifndef DATA_DIR_HPP
28#define DATA_DIR_HPP
29
30#include "../my_config.h"
31
32#include <string>
33#include <deque>
34#include <vector>
35#include "infinint.hpp"
36#include "generic_file.hpp"
37#include "user_interaction.hpp"
38#include "path.hpp"
39#include "cat_directory.hpp"
40#include "cat_inode.hpp"
41#include "cat_detruit.hpp"
42#include "data_tree.hpp"
43
44namespace libdar
45{
46
49
51
52 class data_dir : public data_tree
53 {
54 public:
55 data_dir(const std::string &name);
56 data_dir(generic_file &f, unsigned char db_version);
57 data_dir(const data_tree & ref);
58 data_dir(const data_dir & ref);
59 data_dir(data_dir && ref) = default;
60 data_dir & operator = (const data_dir & ref) { rejetons.clear(); return *this; };
61 data_dir & operator = (data_dir && ref) noexcept = default;
62 ~data_dir();
63
64 virtual void dump(generic_file & f) const override;
65
66 void add(const cat_inode *entry, const archive_num & archive);
67 void add(const cat_detruit *entry, const archive_num & archive);
68 const data_tree *read_child(const std::string & name) const;
69 void read_all_children(std::vector<std::string> & fils) const;
70 void finalize_except_self(const archive_num & archive,
71 const datetime & deleted_date,
72 const archive_num & ignore_archives_greater_or_equal);
73
74 // inherited methods
75 virtual bool check_order(user_interaction & dialog, const path & current_path, bool & initial_warn) const override;
76 virtual void finalize(const archive_num & archive, const datetime & deleted_date, const archive_num & ignore_archives_greater_or_equal) override;
77 virtual bool remove_all_from(const archive_num & archive_to_remove, const archive_num & last_archive) override;
78
80 void show(database_listing_show_files_callback callback,
81 void *tag,
82 archive_num num,
83 std::string marge = "") const;
84 virtual void apply_permutation(archive_num src, archive_num dst) override;
85 virtual void skip_out(archive_num num) override;
86 virtual void compute_most_recent_stats(std::deque<infinint> & data,
87 std::deque<infinint> & ea,
88 std::deque<infinint> & total_data,
89 std::deque<infinint> & total_ea,
90 const datetime & ingore_older_than_that) const override;
91
92 virtual void compute_restoration_needed_archives(std::deque<infinint> & data,
93 std::deque<infinint> & ea,
94 std::deque<infinint> & total_data,
95 std::deque<infinint> & total_ea,
96 const datetime & ignore_older_than_that) const override;
97
98 virtual char obj_signature() const override { return signature(); };
99 static char signature() { return 'd'; };
100
101 virtual bool fix_corruption() override; // inherited from data_tree
102
104
108 bool data_tree_find(path chemin, const data_tree *& ptr) const;
109
111 void data_tree_update_with(const cat_directory *dir, archive_num archive);
112
113
115
119 static data_dir *data_tree_read(generic_file & f, unsigned char db_version);
120
121 private:
122 std::deque<data_tree *> rejetons;
123
124 void add_child(data_tree *fils);
125 void remove_child(const std::string & name);
126 data_tree *find_or_addition(const std::string & name, bool is_dir, const archive_num & archive);
127
129 static data_tree *read_next_in_list_from_file(generic_file & f, unsigned char db_version);
130 };
131
132
133
134
136
137} // end of namespace
138
139#endif
cat_detruit.hpp
used to record information in a catalogue about a deleted file (differential backup context)
cat_directory.hpp
class used to organize objects in tree in catalogue as like directories in a filesystem
cat_inode.hpp
base object for all inode types, managed EA and FSA, dates, permissions, ownership,...
libdar::archive_num
class archive_num stores the position of an archive inside a dar_manager database
Definition archive_num.hpp:47
libdar::archive
the archive class realizes the most general operations on archives
Definition archive.hpp:68
libdar::cat_detruit
the deleted file entry
Definition cat_detruit.hpp:49
libdar::cat_directory
the cat_directory inode class
Definition cat_directory.hpp:52
libdar::cat_inode
the root class for all cat_inode
Definition cat_inode.hpp:53
libdar::data_dir
the data_dir class inherits from data_tree and holds the directory tree's parent relationship
Definition data_dir.hpp:53
libdar::data_dir::data_tree_update_with
void data_tree_update_with(const cat_directory *dir, archive_num archive)
add a directory to the dat_dir
libdar::data_dir::compute_restoration_needed_archives
virtual void compute_restoration_needed_archives(std::deque< infinint > &data, std::deque< infinint > &ea, std::deque< infinint > &total_data, std::deque< infinint > &total_ea, const datetime &ignore_older_than_that) const override
provide a summary of the archives that will be required to restore the data in the latest state
libdar::data_dir::check_order
virtual bool check_order(user_interaction &dialog, const path &current_path, bool &initial_warn) const override
check date order between archives withing the database ; throw Erange if problem found with date orde...
libdar::data_dir::compute_most_recent_stats
virtual void compute_most_recent_stats(std::deque< infinint > &data, std::deque< infinint > &ea, std::deque< infinint > &total_data, std::deque< infinint > &total_ea, const datetime &ingore_older_than_that) const override
provide a summary of the latest version of file and ea per archive number of the database
libdar::data_dir::skip_out
virtual void skip_out(archive_num num) override
decrement archive numbers above num
libdar::data_dir::rejetons
std::deque< data_tree * > rejetons
subdir and subfiles of the current dir
Definition data_dir.hpp:122
libdar::data_dir::remove_all_from
virtual bool remove_all_from(const archive_num &archive_to_remove, const archive_num &last_archive) override
return true if the corresponding file is no more located in any archive (thus, the object is no more ...
libdar::data_dir::dump
virtual void dump(generic_file &f) const override
write signature followed by data constructor will read
libdar::data_dir::finalize
virtual void finalize(const archive_num &archive, const datetime &deleted_date, const archive_num &ignore_archives_greater_or_equal) override
add deleted entry if no object of the current archive exist and the entry of the previous archive is ...
libdar::data_dir::add_child
void add_child(data_tree *fils)
"this" is now responsible of "fils" disalocation
libdar::data_dir::read_next_in_list_from_file
static data_tree * read_next_in_list_from_file(generic_file &f, unsigned char db_version)
read signature and depening on it run data_tree or data_dir constructor
libdar::data_dir::data_dir
data_dir(generic_file &f, unsigned char db_version)
does not read signature
libdar::data_dir::data_tree_find
bool data_tree_find(path chemin, const data_tree *&ptr) const
lookup routine to find a pointer to the dat_tree object corresponding to the given path
libdar::data_dir::data_tree_read
static data_dir * data_tree_read(generic_file &f, unsigned char db_version)
read a signature and then run the data_dir constructor but aborts if not a data_dir
libdar::data_dir::show
void show(database_listing_show_files_callback callback, void *tag, archive_num num, std::string marge="") const
list the most recent files owned by that archive (or by any archive if num == 0)
libdar::datetime
stores time information
Definition datetime.hpp:59
libdar::generic_file
this is the interface class from which all other data transfer classes inherit
Definition generic_file.hpp:77
libdar::path
the class path is here to manipulate paths in the Unix notation: using'/'
Definition path.hpp:51
libdar::user_interaction
This is a pure virtual class that is used by libdar when interaction with the user is required.
Definition user_interaction.hpp:58
data_tree.hpp
base classes used to store entree information in dar_manager databases
generic_file.hpp
class generic_file is defined here as well as class fichier
libdar::database_listing_show_files_callback
void(*)(void *context, const std::string &filename, bool available_data, bool available_ea) database_listing_show_files_callback
called by the database::get_files() routine
Definition database_listing_callback.hpp:48
infinint.hpp
switch module to limitint (32 ou 64 bits integers) or infinint
my_config.h
include macro defined by the configure script and some specific additional ones
libdar
libdar namespace encapsulate all libdar symbols
Definition archive.hpp:47
path.hpp
here is the definition of the path class
user_interaction.hpp
defines the interaction interface between libdar and users.