Disk ARchive 2.7.14
Full featured and portable backup and archiving tool
Loading...
Searching...
No Matches
dar64-2.7.14-win64/include/dar/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 "//include/dar/libdar_my_config.h"
31
32#include <list>
33
34#include "//include/dar/archive.hpp"
35#include "//include/dar/generic_file.hpp"
36#include "//include/dar/data_tree.hpp"
37#include "//include/dar/storage.hpp"
38#include "//include/dar/database_options.hpp"
39#include "//include/dar/database.hpp"
40#include "//include/dar/user_interaction5.hpp"
41#include "//include/dar/data_tree.hpp"
42#include "//include/dar/path.hpp"
43#include "//include/dar/database_listing_callback.hpp"
44#include "//include/dar/database_aux.hpp"
45#include "//include/dar/datetime.hpp"
46#include "//include/dar/user_interaction_blind.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 database class defines the dar_manager database
~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
the database class defines the dar_manager database
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
the class path is here to manipulate paths in the Unix notation: using'/'
full implementation class for user_interaction, which shows nothing and assumes answer "no" to any qu...
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