database.hpp

Go to the documentation of this file.
00001 /*********************************************************************/
00002 // dar - disk archive - a backup/restoration program
00003 // Copyright (C) 2002-2052 Denis Corbin
00004 //
00005 // This program is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU General Public License
00007 // as published by the Free Software Foundation; either version 2
00008 // of the License, or (at your option) any later version.
00009 //
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018 //
00019 // to contact the author : dar.linux@free.fr
00020 /*********************************************************************/
00021 // $Id: database.hpp,v 1.5 2005/09/25 19:05:42 edrusb Rel $
00022 //
00023 /*********************************************************************/
00024 
00027 
00028 
00029 #ifndef DATABASE_HPP
00030 #define DATABASE_HPP
00031 
00032 #include "../my_config.h"
00033 
00034 #include <list>
00035 
00036 #include "archive.hpp"
00037 #include "generic_file.hpp"
00038 #include "data_tree.hpp"
00039 #include "storage.hpp"
00040 
00041 namespace libdar
00042 {
00044 
00049     class database
00050     {
00051     public:
00053         database();
00054 
00056 
00061         database(user_interaction & dialog, const std::string & base, bool partial);
00062 
00064         ~database();
00065 
00067 
00071         void dump(user_interaction & dialog, const std::string & filename, bool overwrite) const;
00072 
00073             // SETTINGS
00074 
00076 
00081         void add_archive(const archive & arch, const std::string & chemin, const std::string & basename);
00082 
00084 
00090         void remove_archive(archive_num min, archive_num max);
00091 
00093 
00097         void set_permutation(archive_num src, archive_num dst);
00098 
00100 
00103         void change_name(archive_num num, const std::string & basename);
00104 
00106 
00109         void set_path(archive_num num, const std::string & chemin);
00110 
00112 
00117         void set_options(const std::vector<std::string> &opt) { options_to_dar = opt; };
00118 
00120 
00123         void set_dar_path(const std::string & chemin) { dar_path = chemin; };
00124 
00125 
00126             // "GETTINGS"
00127 
00129 
00132         void show_contents(user_interaction & dialog) const; // displays all archive information
00133 
00135         std::vector<std::string> get_options() const { return options_to_dar; }; // show option passed to dar
00136 
00138 
00141         std::string get_dar_path() const { return dar_path; }; // show path to dar command
00142 
00144 
00149         void show_files(user_interaction & dialog, archive_num num) const;
00150 
00152 
00156         void show_version(user_interaction & dialog, path chemin) const;
00157 
00159 
00162         void show_most_recent_stats(user_interaction & dialog) const;
00163 
00164             // "ACTIONS" (not available with partially extracted databases)
00165 
00167 
00178         void restore(user_interaction & dialog,
00179                      const std::vector<std::string> & filename,
00180                      bool early_release,
00181                      const std::vector<std::string> & extra_options_for_dar,
00182                      const infinint & date = 0);
00183 
00184     private:
00185 
00187         struct archive_data
00188         {
00189             std::string chemin;      //< path to the archive
00190             std::string basename;    //< basename of the archive
00191         };
00192 
00193         std::vector<struct archive_data> coordinate; //< list of archive used to build the database
00194         std::vector<std::string> options_to_dar;     //< options to use when calling dar for restoration
00195         std::string dar_path;                        //< path to dar
00196         data_dir *files;                             //< structure containing files and they status in the set of archive used for that database
00197         storage *data_files;                         //< when reading archive in partial mode, this is where is located the "not readed" part of the archive
00198 
00199         void build(generic_file & f, bool partial);  //< used by constructors
00200     };
00201 
00202 } // end of namespace
00203 
00204 #endif

Generated on Fri Jun 20 23:43:43 2008 for Disk ARchive by  doxygen 1.5.6