30#include "../my_config.h"
65 std::string get_name()
const {
return filename; };
66 void set_name(
const std::string & name) { filename = name; };
89 db_etat present) { set_data(
archive, date, present,
nullptr,
nullptr); };
95 const crc *result) {
last_mod[
archive] = status_plus(date, present, base, result); (void) check_delta_validity(); };
97 void set_EA(
const archive_num & archive,
const datetime & date,
db_etat present) { status sta(date, present);
last_change[archive] = sta; };
100 virtual bool check_order(
user_interaction & dialog,
const path & current_path,
bool & initial_warn)
const {
return check_map_order(dialog,
last_mod, current_path,
"data", initial_warn) && check_map_order(dialog,
last_change, current_path,
"EA", initial_warn); };
113 const archive_num & ignore_archive_greater_or_equal);
136 std::deque<infinint> &
ea,
137 std::deque<infinint> & total_data,
138 std::deque<infinint> & total_ea,
139 const datetime & ignore_older_than_that)
const;
147 std::deque<infinint> &
ea,
148 std::deque<infinint> & total_data,
149 std::deque<infinint> & total_ea,
150 const datetime & ignore_older_than_that)
const;
152 virtual char obj_signature()
const {
return signature(); };
153 static char signature() {
return 't'; };
156 virtual bool fix_corruption();
160 static constexpr const char *
const ETAT_SAVED =
"S";
161 static constexpr const char *
const ETAT_PATCH =
"O";
162 static constexpr const char *
const ETAT_PATCH_UNUSABLE =
"U";
163 static constexpr const char *
const ETAT_PRESENT =
"P";
164 static constexpr const char *
const ETAT_REMOVED =
"R";
165 static constexpr const char *
const ETAT_ABSENT =
"A";
166 static constexpr const char *
const ETAT_INODE =
"I";
168 static constexpr unsigned char STATUS_PLUS_FLAG_ME = 0x01;
169 static constexpr unsigned char STATUS_PLUS_FLAG_REF = 0x02;
175 status(
const datetime & d,
db_etat p) { date = d; present = p; };
176 status(
const status & ref) =
default;
177 status(status && ref)
noexcept =
default;
178 status & operator = (
const status & ref) =
default;
179 status & operator = (status && ref)
noexcept =
default;
180 virtual ~status() =
default;
185 virtual void dump(generic_file & f)
const;
186 virtual void read(generic_file &f,
187 unsigned char db_version);
191 class status_plus :
public status
194 status_plus() { base = result =
nullptr; };
195 status_plus(
const datetime & d,
db_etat p,
const crc *xbase,
const crc *xresult);
196 status_plus(
const status_plus & ref): status(ref) { copy_from(ref); };
197 status_plus(status_plus && ref)
noexcept: status(std::move(ref)) { nullifyptr(); move_from(std::move(ref)); };
198 status_plus & operator = (
const status_plus & ref) { detruit(); copy_from(ref);
return *
this; };
199 status_plus & operator = (status_plus && ref)
noexcept { status::operator = (std::move(ref)); move_from(std::move(ref));
return *
this; };
200 ~status_plus() { detruit(); };
205 void dump(generic_file & f)
const;
206 void read(generic_file &f,
207 unsigned char db_version);
210 void nullifyptr() noexcept { base = result =
nullptr; };
211 void copy_from(
const status_plus & ref);
212 void move_from(status_plus && ref)
noexcept;
217 std::string filename;
226 const std::map<archive_num, T> the_map,
227 const path & current_path,
228 const std::string & field_nature,
229 bool & initial_warn)
const;
231 bool check_delta_validity();
244 std::deque<infinint> &
ea,
245 std::deque<infinint> & total_data,
246 std::deque<infinint> & total_ea,
247 const datetime & ignore_older_than_that,
248 const std::set<db_etat> & flag_set,
249 bool even_when_removed)
const;
class archive_num stores the position of an archive inside a dar_manager database
the archive class realizes the most general operations on archives
pure virtual class defining interface of a CRC object
the data_tree class stores presence of a given file in a set of archives
virtual void finalize(const archive_num &archive, const datetime &deleted_date, const archive_num &ignore_archive_greater_or_equal)
add deleted entry if no object of the current archive exist and the entry of the previous archive is ...
std::map< archive_num, status_plus > last_mod
key is archive number ; value is last_mod time
virtual bool remove_all_from(const archive_num &archive_to_remove, const archive_num &last_archive)
return true if the corresponding file is no more located in any archive (thus, the object is no more ...
static archive_num data_tree_permutation(archive_num src, archive_num dst, archive_num x)
gives new archive number when an database has its archive reordered
void compute_for_flag_set(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 std::set< db_etat > &flag_set, bool even_when_removed) const
give number of entry's last state (for data and ea) per archive number, followed by the total number ...
virtual void skip_out(archive_num num)
decrement archive numbers above num
virtual bool check_order(user_interaction &dialog, const path ¤t_path, bool &initial_warn) const
check date order between archives withing the database ; throw Erange if problem found with date orde...
bool read_EA(archive_num num, datetime &val, db_etat &present) const
return the date of last inode change and whether the EA has been saved or deleted
db_lookup get_EA(archive_num &archive, const datetime &date, bool even_when_removed) const
if EA has been saved alone later, returns in which version for the state of the file at the given dat...
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
provide a summary of the archives that will be required to restore the data in the latest state
virtual void dump(generic_file &f) const
dump signature followed by data constructor will read
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 &ignore_older_than_that) const
provide a summary of the latest version of file and ea per archive number of the database
std::map< archive_num, status > last_change
key is archive number ; value is last_change time
data_tree(generic_file &f, unsigned char db_version)
constructor does not read signature
void listing(database_listing_get_version_callback callback, void *tag) const
list where is saved this file
db_lookup get_data(std::set< archive_num > &archive, const datetime &date, bool even_when_removed) const
static void display_line(database_listing_get_version_callback callback, void *tag, archive_num num, const datetime *data, db_etat data_presence, const datetime *ea, db_etat ea_presence)
helper method to provide information to a database_listing_get_version_callback
bool read_data(archive_num num, datetime &val, db_etat &present) const
return the date of file's last modification date within the give archive and whether the file has bee...
this is the interface class from which all other data transfer classes inherit
the class path is here to manipulate paths in the Unix notation: using'/'
This is a pure virtual class that is used by libdar when interaction with the user is required.
set of datastructures used to interact with a database object
definition of the user defined callback function used for database listing
class generic_file is defined here as well as class fichier
db_lookup
the available status of a lookup
void(*)(void *context, archive_num num, db_etat data_presence, bool has_data_date, datetime data, db_etat ea_presence, bool has_ea_date, datetime ea) database_listing_get_version_callback
called with the information of presence for an entry in archive number num
db_etat
the status for a founded entry
@ et_absent
file not even mentionned in the archive, This entry is equivalent to et_removed, but is required to b...
switch module to limitint (32 ou 64 bits integers) or infinint
bool ea() noexcept
returns whether EA support has been activated at compilation time
libdar namespace encapsulate all libdar symbols
here is the definition of the path class
defines the interaction interface between libdar and users.