Loading...
Searching...
No Matches
data_dir.hpp
Go to the documentation of this file.
/*********************************************************************/
// dar - disk archive - a backup/restoration program
// Copyright (C) 2002-2026 Denis Corbin
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
// to contact the author, see the AUTHOR file
/*********************************************************************/
#ifndef DATA_DIR_HPP
#define DATA_DIR_HPP
#include "../my_config.h"
#include <string>
#include <deque>
#include <vector>
#include "infinint.hpp"
#include "generic_file.hpp"
#include "user_interaction.hpp"
#include "path.hpp"
#include "cat_directory.hpp"
#include "cat_inode.hpp"
#include "cat_detruit.hpp"
#include "data_tree.hpp"
namespace libdar
{
class data_dir : public data_tree
{
public:
data_dir(const std::string &name);
data_dir(generic_file &f, unsigned char db_version);
data_dir(const data_tree & ref);
data_dir(const data_dir & ref);
data_dir(data_dir && ref) = default;
data_dir & operator = (const data_dir & ref) { rejetons.clear(); return *this; };
data_dir & operator = (data_dir && ref) noexcept = default;
~data_dir();
virtual void dump(generic_file & f) const override;
void add(const cat_inode *entry, const archive_num & archive);
void add(const cat_detruit *entry, const archive_num & archive);
const data_tree *read_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);
// inherited methods
virtual bool check_order(user_interaction & dialog, const path & current_path, bool & initial_warn) const override;
virtual void finalize(const archive_num & archive, const datetime & deleted_date, const archive_num & ignore_archives_greater_or_equal) override;
virtual bool remove_all_from(const archive_num & archive_to_remove, const archive_num & last_archive) override;
void show(database_listing_show_files_callback callback,
void *tag,
archive_num num,
std::string marge = "") const;
virtual void apply_permutation(archive_num src, archive_num dst) override;
virtual void skip_out(archive_num num) override;
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;
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;
virtual char obj_signature() const override { return signature(); };
static char signature() { return 'd'; };
virtual bool fix_corruption() override; // inherited from data_tree
bool data_tree_find(path chemin, const data_tree *& ptr) const;
void data_tree_update_with(const cat_directory *dir, archive_num archive);
static data_dir *data_tree_read(generic_file & f, unsigned char db_version);
private:
std::deque<data_tree *> rejetons;
void add_child(data_tree *fils);
void remove_child(const std::string & name);
data_tree *find_or_addition(const std::string & name, bool is_dir, const archive_num & archive);
static data_tree *read_next_in_list_from_file(generic_file & f, unsigned char db_version);
};
} // end of namespace
#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.