Disk ARchive  2.6.8
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-2020 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 : http://dar.linux.free.fr/email.html
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
50 using libdar::path;
51 
52  // from database_options.hpp
61 
62  // from database_aux.hpp
64 using libdar::db_lookup;
65 using libdar::db_etat;
66 
67  // from datetime.hpp
68 using libdar::datetime;
69 
70 namespace libdar5
71 {
72 
75 
77 
81  class database: public libdar::database
82  {
83  public:
84  database(): libdar::database(std::shared_ptr<libdar::user_interaction>(new libdar::user_interaction_blind())) {};
85 
86  database(user_interaction & dialog,
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 
145  void show_most_recent_stats(user_interaction & dialog) const;
146 
147  void restore(user_interaction & dialog,
148  const std::vector<std::string> & filename,
149  const database_restore_options & opt)
150  {
151  libdar::database::restore(filename,
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
archive.hpp
the archive class is defined in this module
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:46
libdar::database_restore_options
options for restoration from database
Definition: database_options.hpp:210
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
database.hpp
this file holds the database class definition
libdar5::database::operator=
database & operator=(const database &ref)=delete
disabling assignement operator
libdar::database_change_path_options
options for changing a given archive's path
Definition: database_options.hpp:186
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::infinint
the arbitrary large positive integer class
Definition: real_infinint.hpp:61
libdar::database
the database class defines the dar_manager database
Definition: database.hpp:51
datetime.hpp
this file contains the definition of class datetime that stores unix times in a portable way
libdar5::database::show_contents
void show_contents(user_interaction &dialog) const
show the list of archive used to build the database
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
database_options.hpp
this file holds the options for database operations
libdar::database_open_options
options to open a database
Definition: database_options.hpp:43
generic_file.hpp
class generic_file is defined here as well as class fichier
libdar::path
the class path is here to manipulate paths in the Unix notation: using'/'
Definition: path.hpp:50
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:87
database_aux.hpp
set of datastructures used to interact with a database object
libdar5
libdar5 namespace encapsulate all libdar symbols
Definition: archive5.hpp:36
libdar::datetime
stores time information
Definition: datetime.hpp:58
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::db_etat
db_etat
the status for a founded entry
Definition: database_aux.hpp:54
libdar5::database
the database class defines the dar_manager database
Definition: database5.hpp:81
libdar::db_lookup
db_lookup
the available status of a lookup
Definition: database_aux.hpp:40
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
data_tree.hpp
base classes used to store entree information in dar_manager databases
libdar::database_dump_options
options to write a database to file
Definition: database_options.hpp:92
libdar::archive_num
class archive_num stores the position of an archive inside a dar_manager database
Definition: archive_num.hpp:46
libdar::database_add_options
options to add an archive to base
Definition: database_options.hpp:122
libdar::database_used_options
options for file "used" in archive
Definition: database_options.hpp:280
user_interaction5.hpp
API v5 backward compatible class user_interaction.
storage.hpp
contains a class that permits arbitrary large data storage
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_remove_options
options to remove an archive from the base
Definition: database_options.hpp:137
user_interaction_blind.hpp
defines the interaction between libdar and a non communcant "blind" user
libdar5::database::~database
~database()=default
database destructor (no implicit file saving)
libdar5::database::show_version
void show_version(user_interaction &dialog, path chemin) const
list the archive where a give file is present
path.hpp
here is the definition of the path class
database_listing_callback.hpp
definition of the user defined callback function used for database listing
libdar::database_change_basename_options
options for changing a given archive's basename
Definition: database_options.hpp:161
libdar::compile_time::ea
bool ea() noexcept
returns whether EA support has been activated at compilation time