Loading...
Searching...
No Matches
database5.hpp
Go to the documentation of this file.
/*********************************************************************/
// dar - disk archive - a backup/restoration program
// Copyright (C) 2002-2025 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 DATABASE5_HPP
#define DATABASE5_HPP
#include "../my_config.h"
#include <list>
#include "archive.hpp"
#include "generic_file.hpp"
#include "data_tree.hpp"
#include "storage.hpp"
#include "database_options.hpp"
#include "database.hpp"
#include "user_interaction5.hpp"
#include "data_tree.hpp"
#include "path.hpp"
#include "database_listing_callback.hpp"
#include "database_aux.hpp"
#include "datetime.hpp"
#include "user_interaction_blind.hpp"
// from path.hpp
using libdar::path;
// from database_options.hpp
using libdar::database_open_options;
using libdar::database_dump_options;
using libdar::database_add_options;
using libdar::database_remove_options;
using libdar::database_change_basename_options;
using libdar::database_change_path_options;
using libdar::database_restore_options;
using libdar::database_used_options;
// from database_aux.hpp
using libdar::archive_num;
using libdar::db_lookup;
using libdar::db_etat;
// from datetime.hpp
using libdar::datetime;
namespace libdar5
{
class database: public libdar::database
{
public:
database(): libdar::database(std::shared_ptr<libdar::user_interaction>(new libdar::user_interaction_blind())) {};
database(user_interaction & dialog,
const std::string & base,
const database_open_options & opt):
libdar::database(user_interaction5_clone_to_shared_ptr(dialog),
base,
opt)
{}
database(const database & ref) = delete;
database(database && ref) noexcept = delete;
database & operator = (const database & ref) = delete;
database & operator = (database && ref) noexcept = delete;
~database() = default;
void dump(user_interaction & dialog, const std::string & filename, const database_dump_options & opt) const
{
libdar::database::dump(filename,
opt);
}
// "GETTINGS"
void show_contents(user_interaction & dialog) const; // displays all archive information
void show_files(user_interaction & dialog, archive_num num, const database_used_options & opt) const;
void show_version(user_interaction & dialog, path chemin) const;
void show_most_recent_stats(user_interaction & dialog) const;
void restore(user_interaction & dialog,
const std::vector<std::string> & filename,
const database_restore_options & opt)
{
libdar::database::restore(filename,
opt);
}
bool check_order(user_interaction & dialog) const
{
return libdar::database::check_order();
}
private:
static void show_files_callback(void *tag,
const std::string & filename,
bool available_data,
bool available_ea);
static void get_version_callback(void *tag,
archive_num num,
db_etat data_presence,
bool has_data_date,
datetime data,
db_etat ea_presence,
bool has_ea_date,
datetime ea);
static void statistics_callback(void *tag,
U_I number,
const infinint & data_count,
const infinint & total_data,
const infinint & ea_count,
const infinint & total_ea);
};
} // end of namespace
#endif
archive.hpp
the archive class is defined in this module
libdar5::database
the database class defines the dar_manager database
Definition database5.hpp:82
libdar5::database::~database
~database()=default
database destructor (no implicit file saving)
libdar5::database::show_files
void show_files(user_interaction &dialog, archive_num num, const database_used_options &opt) const
list files which are present in a given archive
libdar5::database::show_contents
void show_contents(user_interaction &dialog) const
show the list of archive used to build the database
libdar5::database::database
database(const database &ref)=delete
disabling copy constructor
libdar5::database::database
database(database &&ref) noexcept=delete
disabling move constructor
libdar5::database::operator=
database & operator=(const database &ref)=delete
disabling assignement operator
libdar5::database::show_most_recent_stats
void show_most_recent_stats(user_interaction &dialog) const
compute some statistics about the location of most recent file versions
libdar5::database::show_version
void show_version(user_interaction &dialog, path chemin) const
list the archive where a give file is present
libdar5::user_interaction
This is a pure virtual class that is used by libdar when interaction with the user is required.
Definition user_interaction5.hpp:88
libdar::archive_num
class archive_num stores the position of an archive inside a dar_manager database
Definition archive_num.hpp:47
libdar::database_add_options
options to add an archive to base
Definition database_options.hpp:133
libdar::database_change_basename_options
options for changing a given archive's basename
Definition database_options.hpp:172
libdar::database_change_path_options
options for changing a given archive's path
Definition database_options.hpp:197
libdar::database_dump_options
options to write a database to file
Definition database_options.hpp:103
libdar::database_open_options
options to open a database
Definition database_options.hpp:54
libdar::database_remove_options
options to remove an archive from the base
Definition database_options.hpp:148
libdar::database_restore_options
options for restoration from database
Definition database_options.hpp:221
libdar::database_used_options
options for file "used" in archive
Definition database_options.hpp:291
libdar::database
the database class defines the dar_manager database
Definition database.hpp:52
libdar::database::check_order
bool check_order() const
check that all files's Data and EA are more recent when archive number grows within the database,...
libdar::database::dump
void dump(const std::string &filename, const database_dump_options &opt) const
write the database to a file (see database_header first)
libdar::database::restore
void restore(const std::vector< std::string > &filename, const database_restore_options &opt)
restore files calling dar on the appropriated archive
libdar::datetime
stores time information
Definition datetime.hpp:59
libdar::path
the class path is here to manipulate paths in the Unix notation: using'/'
Definition path.hpp:51
libdar::user_interaction_blind
full implementation class for user_interaction, which shows nothing and assumes answer "no" to any qu...
Definition user_interaction_blind.hpp:47
data_tree.hpp
base classes used to store entree information in dar_manager databases
database.hpp
this file holds the database class definition
database_aux.hpp
set of datastructures used to interact with a database object
database_listing_callback.hpp
definition of the user defined callback function used for database listing
database_options.hpp
this file holds the options for database operations
datetime.hpp
this file contains the definition of class datetime that stores unix times in a portable way
generic_file.hpp
class generic_file is defined here as well as class fichier
libdar5::user_interaction5_clone_to_shared_ptr
std::shared_ptr< user_interaction > user_interaction5_clone_to_shared_ptr(user_interaction &dialog)
convert a user_interaction to a shared_pointer on a clone of that user_interaction
libdar::db_lookup
db_lookup
the available status of a lookup
Definition database_aux.hpp:41
libdar::db_etat
db_etat
the status for a founded entry
Definition database_aux.hpp:55
my_config.h
include macro defined by the configure script and some specific additional ones
libdar5
libdar5 namespace encapsulate all libdar symbols
Definition archive5.hpp:37
path.hpp
here is the definition of the path class
storage.hpp
contains a class that permits arbitrary large data storage
user_interaction5.hpp
API v5 backward compatible class user_interaction.
user_interaction_blind.hpp
defines the interaction between libdar and a non communcant "blind" user