Loading...
Searching...
No Matches
archive.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 ARCHIVE_HPP
#define ARCHIVE_HPP
#include "../my_config.h"
#include <vector>
#include <string>
#include <memory>
#include "erreurs.hpp"
#include "path.hpp"
#include "statistics.hpp"
#include "archive_options.hpp"
#include "list_entry.hpp"
#include "crypto.hpp"
#include "archive_summary.hpp"
#include "archive_listing_callback.hpp"
#include "user_interaction.hpp"
namespace libdar
{
// need to declare class database friend of class archive.
// class database need to access the archive table of content
// though exposing it by mean of a public method of class
// archive would let it visibile to the API, thing we do not
// want
class database;
constexpr const char* dar_extension = "dar";
class archive
{
public:
archive(const std::shared_ptr<user_interaction> & dialog,
const path & chem,
const std::string & basename,
const std::string & extension,
const archive_options_read & options);
archive(const std::shared_ptr<user_interaction> & dialog,
const path & fs_root,
const path & sauv_path,
const std::string & filename,
const std::string & extension,
const archive_options_create & options,
statistics * progressive_report);
archive(const std::shared_ptr<user_interaction> & dialog,
const path & sauv_path,
std::shared_ptr<archive> ref_arch1,
const std::string & filename,
const std::string & extension,
const archive_options_merge & options,
statistics* progressive_report);
archive(const std::shared_ptr<user_interaction> & dialog,
const path & chem_src,
const std::string & basename_src,
const std::string & extension_src,
const archive_options_read & options_read,
const path & chem_dst,
const std::string & basename_dst,
const std::string & extension_dst,
const archive_options_repair & options_repair,
statistics* progressive_report = nullptr);
archive(const archive & ref) = delete;
archive(archive && ref) = delete;
archive & operator = (const archive & ref) = delete;
archive & operator = (archive && ref) = delete;
~archive();
statistics op_extract(const path &fs_root,
const archive_options_extract & options,
statistics *progressive_report);
void summary();
archive_summary summary_data();
void op_listing(archive_listing_callback callback,
void *context,
const archive_options_listing & options) const;
statistics op_diff(const path & fs_root,
const archive_options_diff & options,
statistics * progressive_report);
statistics op_test(const archive_options_test & options,
statistics * progressive_report);
void op_isolate(const path &sauv_path,
const std::string & filename,
const std::string & extension,
const archive_options_isolate & options);
bool get_children_of(archive_listing_callback callback,
void *context,
const std::string & dir,
bool fetch_ea = false);
const std::vector<list_entry> get_children_in_table(const std::string & dir, bool fetch_ea = false) const;
bool has_subdirectory(const std::string & dir) const;
const entree_stats get_stats() const;
const std::list<signator> & get_signatories() const;
void init_catalogue() const;
void drop_all_filedescriptors(bool repairing = false);
void set_to_unsaved_data_and_FSA();
U_64 get_first_slice_header_size() const;
U_64 get_non_first_slice_header_size() const;
private:
class i_archive;
std::shared_ptr<i_archive> pimpl;
// see the comment near the forward declaration
// of class database above for explanations
friend class database;
};
} // end of namespace
#endif
archive_listing_callback.hpp
definition of the user defined callback function used for archive listing
archive_options.hpp
this file contains a set of classes used to transmit options to archive operation
archive_summary.hpp
datastructure returned by archive::summary_data
libdar::archive::i_archive
the archive::i_archive class implements the most general operations on archives
Definition i_archive.hpp:59
libdar::archive_options_create
class holding optional parameters used to create an archive
Definition archive_options.hpp:305
libdar::archive_options_extract
class holding optional parameters used to extract files from an existing archive
Definition archive_options.hpp:1351
libdar::archive_options_isolate
class holding optional parameters used to isolate an existing archive
Definition archive_options.hpp:781
libdar::archive_options_listing
class holding optional parameters used to list the contents of an existing archive
Definition archive_options.hpp:1514
libdar::archive_options_merge
class holding optional parameters used to proceed to the merge operation
Definition archive_options.hpp:1024
libdar::archive_options_read
class holding optional parameters used to read an existing archive
Definition archive_options.hpp:70
libdar::archive_options_repair
class holding optional parameters used to create an archive
Definition archive_options.hpp:1821
libdar::archive_options_test
class holding optional parameters used to test the structure coherence of an existing archive
Definition archive_options.hpp:1738
libdar::archive_summary
the archive_summary class provides information about a given archive
Definition archive_summary.hpp:45
libdar::database
the database class defines the dar_manager database
Definition database.hpp:52
libdar::path
the class path is here to manipulate paths in the Unix notation: using'/'
Definition path.hpp:51
libdar::statistics
class used by libdar::archive class to give a summary of treated file during and after an operation
Definition statistics.hpp:70
crypto.hpp
the crypto algoritm definition
erreurs.hpp
contains all the excetion class thrown by libdar
libdar::archive::archive
archive(const archive &ref)=delete
copy constructor (not implemented, throw an exception if called explicitely or implicitely)
libdar::archive::drop_all_filedescriptors
void drop_all_filedescriptors(bool repairing=false)
closes all filedescriptors and associated even when in sequential read mode
libdar::archive::op_test
statistics op_test(const archive_options_test &options, statistics *progressive_report)
test the archive integrity
libdar::archive::op_diff
statistics op_diff(const path &fs_root, const archive_options_diff &options, statistics *progressive_report)
archive comparison with filesystem
libdar::archive::archive
archive(const std::shared_ptr< user_interaction > &dialog, const path &chem_src, const std::string &basename_src, const std::string &extension_src, const archive_options_read &options_read, const path &chem_dst, const std::string &basename_dst, const std::string &extension_dst, const archive_options_repair &options_repair, statistics *progressive_report=nullptr)
this constructor create a new archive from a damaged one [this is the "repair" constructor]
libdar::archive::get_signatories
const std::list< signator > & get_signatories() const
retrieving signature information about the archive
libdar::archive::summary_data
archive_summary summary_data()
same information as summary() but as broken out data
libdar::archive::get_stats
const entree_stats get_stats() const
retrieving statistics about archive contents
libdar::archive::init_catalogue
void init_catalogue() const
libdar::archive::get_children_in_table
const std::vector< list_entry > get_children_in_table(const std::string &dir, bool fetch_ea=false) const
getting information about the given directory (alternative to get_children_of)
libdar::archive::summary
void summary()
display a summary of the archive
libdar::archive::get_children_of
bool get_children_of(archive_listing_callback callback, void *context, const std::string &dir, bool fetch_ea=false)
getting information about a given directory
libdar::archive::archive
archive(const std::shared_ptr< user_interaction > &dialog, const path &sauv_path, std::shared_ptr< archive > ref_arch1, const std::string &filename, const std::string &extension, const archive_options_merge &options, statistics *progressive_report)
this constructor builds an archive from two given archive [this is the "merge" constructor]
libdar::archive::has_subdirectory
bool has_subdirectory(const std::string &dir) const
returns true if the pointed directory has one or more subdirectories
libdar::dar_extension
constexpr const char * dar_extension
the default extension for dar archive
Definition archive.hpp:59
libdar::archive::get_non_first_slice_header_size
U_64 get_non_first_slice_header_size() const
get the non first slice header
libdar::archive::get_first_slice_header_size
U_64 get_first_slice_header_size() const
get the first slice header
libdar::archive::op_isolate
void op_isolate(const path &sauv_path, const std::string &filename, const std::string &extension, const archive_options_isolate &options)
this methodes isolates the catalogue of a the current archive into a separated archive
libdar::archive::archive
archive(const std::shared_ptr< user_interaction > &dialog, const path &chem, const std::string &basename, const std::string &extension, const archive_options_read &options)
this constructor opens an already existing archive (for reading) [this is the "read" constructor]
libdar::archive::op_listing
void op_listing(archive_listing_callback callback, void *context, const archive_options_listing &options) const
listing of the archive contents
libdar::archive_listing_callback
void(*)(const std::string &the_path, const list_entry &entry, void *context) archive_listing_callback
callback function type expected for archive::op_listing and archive::get_children_of()
Definition archive_listing_callback.hpp:40
libdar::archive::archive
archive(const std::shared_ptr< user_interaction > &dialog, const path &fs_root, const path &sauv_path, const std::string &filename, const std::string &extension, const archive_options_create &options, statistics *progressive_report)
this constuctor create an archive (full or differential) [this is the "create" constructor]
libdar::archive::op_extract
statistics op_extract(const path &fs_root, const archive_options_extract &options, statistics *progressive_report)
extraction of data from an archive
libdar::archive::set_to_unsaved_data_and_FSA
void set_to_unsaved_data_and_FSA()
change all inode as unsaved (equal to differential backup with no change met)
libdar::archive::~archive
~archive()
the destructor
list_entry.hpp
class of objects describing an entry in the archive, used by archive::get_children_in_table
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
statistics.hpp
class handling access to the data summary of treated files after and during each operation
libdar::entree_stats
holds the statistics contents of a catalogue
Definition entree_stats.hpp:49
user_interaction.hpp
defines the interaction interface between libdar and users.