Disk ARchive 2.8.0
Full featured and portable backup and archiving tool
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
libdar::data_dir Class Reference

the data_dir class inherits from data_tree and holds the directory tree's parent relationship More...

#include <data_dir.hpp>

+ Inheritance diagram for libdar::data_dir:
+ Collaboration diagram for libdar::data_dir:

Public Member Functions

 data_dir (const std::string &name)
 
 data_dir (generic_file &f, unsigned char db_version)
 does not read signature
 
 data_dir (const data_tree &ref)
 
 data_dir (const data_dir &ref)
 
 data_dir (data_dir &&ref)=default
 
data_diroperator= (const data_dir &ref)
 
data_diroperator= (data_dir &&ref) noexcept=default
 
virtual void dump (generic_file &f) const override
 write signature followed by data constructor will read More...
 
void add (const cat_inode *entry, const archive_num &archive)
 
void add (const cat_detruit *entry, const archive_num &archive)
 
const data_treeread_child (const std::string &name) const
 
void read_all_children (std::vector< std::string > &fils) const
 
void finalize_except_self (const archive_num &archive, const datetime &deleted_date, const archive_num &ignore_archives_greater_or_equal)
 
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 order More...
 
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 already present. More...
 
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 usefull in the base) More...
 
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)
 
virtual void apply_permutation (archive_num src, archive_num dst) override
 
virtual void skip_out (archive_num num) override
 decrement archive numbers above num More...
 
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 More...
 
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 More...
 
virtual char obj_signature () const override
 
virtual bool fix_corruption () override
 
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 More...
 
void data_tree_update_with (const cat_directory *dir, archive_num archive)
 add a directory to the dat_dir
 
- Public Member Functions inherited from libdar::data_tree
 data_tree (const std::string &name)
 
 data_tree (generic_file &f, unsigned char db_version)
 constructor does not read signature
 
 data_tree (const data_tree &ref)=default
 
 data_tree (data_tree &&ref) noexcept=default
 
data_treeoperator= (const data_tree &ref)=default
 
data_treeoperator= (data_tree &&ref) noexcept=default
 
virtual void dump (generic_file &f) const
 dump signature followed by data constructor will read More...
 
std::string get_name () const
 
void set_name (const std::string &name)
 
db_lookup get_data (std::set< archive_num > &archive, const datetime &date, bool even_when_removed) const
 
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 date.
 
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 been saved or deleted
 
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
 
void set_data (const archive_num &archive, const datetime &date, db_etat present)
 
void set_data (const archive_num &archive, const datetime &date, db_etat present, const crc *base, const crc *result)
 
void set_EA (const archive_num &archive, const datetime &date, db_etat present)
 
virtual bool check_order (user_interaction &dialog, const path &current_path, bool &initial_warn) const
 check date order between archives withing the database ; throw Erange if problem found with date order More...
 
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 already present. More...
 
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 usefull in the base) More...
 
void listing (database_listing_get_version_callback callback, void *tag) const
 list where is saved this file
 
virtual void apply_permutation (archive_num src, archive_num dst)
 
virtual void skip_out (archive_num num)
 decrement archive numbers above num More...
 
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 More...
 
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 More...
 
virtual char obj_signature () const
 
virtual bool fix_corruption ()
 

Static Public Member Functions

static char signature ()
 
static data_dirdata_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 More...
 
- Static Public Member Functions inherited from libdar::data_tree
static char signature ()
 

Private Member Functions

void add_child (data_tree *fils)
 "this" is now responsible of "fils" disalocation
 
void remove_child (const std::string &name)
 
data_treefind_or_addition (const std::string &name, bool is_dir, const archive_num &archive)
 

Static Private Member Functions

static data_treeread_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
 

Private Attributes

std::deque< data_tree * > rejetons
 subdir and subfiles of the current dir More...
 

Detailed Description

the data_dir class inherits from data_tree and holds the directory tree's parent relationship

Definition at line 52 of file data_dir.hpp.

Member Function Documentation

◆ apply_permutation()

virtual void libdar::data_dir::apply_permutation ( archive_num  src,
archive_num  dst 
)
overridevirtual

Reimplemented from libdar::data_tree.

◆ check_order()

virtual bool libdar::data_dir::check_order ( user_interaction dialog,
const path current_path,
bool &  initial_warn 
) const
overridevirtual

check date order between archives withing the database ; throw Erange if problem found with date order

Reimplemented from libdar::data_tree.

◆ compute_most_recent_stats()

virtual void libdar::data_dir::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
overridevirtual

provide a summary of the latest version of file and ea per archive number of the database

Parameters
[out]datais a table indexed by archive num providing the number latest data version per archive
[out]eais a table indexed by archive num providing the number latest EA version per archive
[out]total_datais a table indexed by archive providing the total number of entries with data, archive per archive (most recent and older)
[out]total_eais a table indexed by archive num providing the total number of entries with EA, archive per archive (most recent and older)
[in]ignore_older_than_thatif not null date, ignore data et EA versions strictly more recent than this date
Note
the provided four fields that will receive table of counters per archive should be initialized by the caller as this is a recursive call with data_dir that increment the counter recursively.

Reimplemented from libdar::data_tree.

◆ compute_restoration_needed_archives()

virtual void libdar::data_dir::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
overridevirtual

provide a summary of the archives that will be required to restore the data in the latest state

Note
if ignore_older_than_that is set, the result concerns the latest state for the provided date and ignores data from a more recent state.

Reimplemented from libdar::data_tree.

◆ data_tree_find()

bool libdar::data_dir::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

Parameters
[in]cheminis the path to look for
[out]ptris a pointer to the looked node, if found
Returns
true if a node could be found in the database

◆ data_tree_read()

static data_dir * libdar::data_dir::data_tree_read ( generic_file f,
unsigned char  db_version 
)
static

read a signature and then run the data_dir constructor but aborts if not a data_dir

Note
the constructors of data_tree and data_dir do not read the signature because its purpose it to know whether the following is a data_dir or data_tree dump() result.

◆ dump()

virtual void libdar::data_dir::dump ( generic_file f) const
overridevirtual

write signature followed by data constructor will read

Reimplemented from libdar::data_tree.

◆ finalize()

virtual void libdar::data_dir::finalize ( const archive_num archive,
const datetime deleted_date,
const archive_num ignore_archive_greater_or_equal 
)
overridevirtual

add deleted entry if no object of the current archive exist and the entry of the previous archive is already present.

Parameters
[in]archiveis the number of the archive to finalize
[in]deleted_datedate of deletion to use for inode removal when no information can be grabbed from the archive (this date is taken from the parent dir last modification date)
[in]ignore_archive_greater_or_equalignore archives which number is greater or equal than "ignore_archive_greater_or_equal" as if they were not present in the database. If set to zero, no archive is ignored.

Reimplemented from libdar::data_tree.

◆ fix_corruption()

virtual bool libdar::data_dir::fix_corruption ( )
overridevirtual

Reimplemented from libdar::data_tree.

◆ obj_signature()

virtual char libdar::data_dir::obj_signature ( ) const
inlineoverridevirtual

Reimplemented from libdar::data_tree.

Definition at line 98 of file data_dir.hpp.

◆ operator=()

data_dir & libdar::data_dir::operator= ( const data_dir ref)
inline

Definition at line 60 of file data_dir.hpp.

◆ remove_all_from()

virtual bool libdar::data_dir::remove_all_from ( const archive_num archive_to_remove,
const archive_num last_archive 
)
overridevirtual

return true if the corresponding file is no more located in any archive (thus, the object is no more usefull in the base)

Reimplemented from libdar::data_tree.

◆ signature()

static char libdar::data_dir::signature ( )
inlinestatic

Definition at line 99 of file data_dir.hpp.

◆ skip_out()

virtual void libdar::data_dir::skip_out ( archive_num  num)
overridevirtual

decrement archive numbers above num

Reimplemented from libdar::data_tree.

Member Data Documentation

◆ rejetons

std::deque<data_tree *> libdar::data_dir::rejetons
private

subdir and subfiles of the current dir

Definition at line 122 of file data_dir.hpp.


The documentation for this class was generated from the following file: