Disk ARchive 2.7.16
Full featured and portable backup and archiving tool
database5.hpp
Go to the documentation of this file.
1/*********************************************************************/
2// dar - disk archive - a backup/restoration program
3// Copyright (C) 2002-2024 Denis Corbin
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18//
19// to contact the author, see the AUTHOR file
20/*********************************************************************/
21
25
26
27#ifndef DATABASE5_HPP
28#define DATABASE5_HPP
29
30#include "../my_config.h"
31
32#include <list>
33
34#include "archive.hpp"
35#include "generic_file.hpp"
36#include "data_tree.hpp"
37#include "storage.hpp"
38#include "database_options.hpp"
39#include "database.hpp"
40#include "user_interaction5.hpp"
41#include "data_tree.hpp"
42#include "path.hpp"
44#include "database_aux.hpp"
45#include "datetime.hpp"
47
48
49 // from path.hpp
50using libdar::path;
51
52 // from database_options.hpp
61
62 // from database_aux.hpp
65using libdar::db_etat;
66
67 // from datetime.hpp
69
70namespace libdar5
71{
72
75
77
82 {
83 public:
84 database(): libdar::database(std::shared_ptr<libdar::user_interaction>(new libdar::user_interaction_blind())) {};
85
87 const std::string & base,
88 const database_open_options & opt):
90 base,
91 opt)
92 {}
93
95 database(const database & ref) = delete;
96
98 database(database && ref) noexcept = delete;
99
101 database & operator = (const database & ref) = delete;
102
104 database & operator = (database && ref) noexcept = delete;
105
107 ~database() = default;
108
109
110 void dump(user_interaction & dialog, const std::string & filename, const database_dump_options & opt) const
111 {
112 libdar::database::dump(filename,
113 opt);
114 }
115
116
117
118 // "GETTINGS"
119
121
123 void show_contents(user_interaction & dialog) const; // displays all archive information
124
126
132 void show_files(user_interaction & dialog, archive_num num, const database_used_options & opt) const;
133
135
139 void show_version(user_interaction & dialog, path chemin) const;
140
142
146
147 void restore(user_interaction & dialog,
148 const std::vector<std::string> & filename,
149 const database_restore_options & opt)
150 {
152 opt);
153 }
154
155 bool check_order(user_interaction & dialog) const
156 {
158 }
159
160 private:
161
162 static void show_files_callback(void *tag,
163 const std::string & filename,
164 bool available_data,
165 bool available_ea);
166
167
168 static void get_version_callback(void *tag,
169 archive_num num,
170 db_etat data_presence,
171 bool has_data_date,
172 datetime data,
173 db_etat ea_presence,
174 bool has_ea_date,
175 datetime ea);
176
177 static void statistics_callback(void *tag,
178 U_I number,
179 const infinint & data_count,
180 const infinint & total_data,
181 const infinint & ea_count,
182 const infinint & total_ea);
183 };
184
185
187
188} // end of namespace
189
190#endif
the archive class is defined in this module
the database class defines the dar_manager database
Definition: database5.hpp:82
~database()=default
database destructor (no implicit file saving)
void show_files(user_interaction &dialog, archive_num num, const database_used_options &opt) const
list files which are present in a given archive
void show_contents(user_interaction &dialog) const
show the list of archive used to build the database
database(const database &ref)=delete
disabling copy constructor
database(database &&ref) noexcept=delete
disabling move constructor
database & operator=(const database &ref)=delete
disabling assignement operator
void show_most_recent_stats(user_interaction &dialog) const
compute some statistics about the location of most recent file versions
void show_version(user_interaction &dialog, path chemin) const
list the archive where a give file is present
This is a pure virtual class that is used by libdar when interaction with the user is required.
class archive_num stores the position of an archive inside a dar_manager database
Definition: archive_num.hpp:47
options to add an archive to base
options for changing a given archive's basename
options for changing a given archive's path
options to write a database to file
options to open a database
options to remove an archive from the base
options for restoration from database
options for file "used" in archive
the database class defines the dar_manager database
Definition: database.hpp:52
bool check_order() const
check that all files's Data and EA are more recent when archive number grows within the database,...
void dump(const std::string &filename, const database_dump_options &opt) const
write the database to a file (see database_header first)
void restore(const std::vector< std::string > &filename, const database_restore_options &opt)
restore files calling dar on the appropriated archive
stores time information
Definition: datetime.hpp:59
the class path is here to manipulate paths in the Unix notation: using'/'
Definition: path.hpp:51
full implementation class for user_interaction, which shows nothing and assumes answer "no" to any qu...
base classes used to store entree information in dar_manager databases
this file holds the database class definition
set of datastructures used to interact with a database object
definition of the user defined callback function used for database listing
this file holds the options for database operations
this file contains the definition of class datetime that stores unix times in a portable way
class generic_file is defined here as well as class fichier
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
db_lookup
the available status of a lookup
db_etat
the status for a founded entry
libdar5 namespace encapsulate all libdar symbols
Definition: archive5.hpp:37
bool ea() noexcept
returns whether EA support has been activated at compilation time
here is the definition of the path class
contains a class that permits arbitrary large data storage
API v5 backward compatible class user_interaction.
defines the interaction between libdar and a non communcant "blind" user