Disk ARchive  2.6.8
Full featured and portable backup and archiving tool
escape_catalogue.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 
33 
34 #ifndef ESCAPE_CATALOGUE_HPP
35 #define ESCAPE_CATALOGUE_HPP
36 
37 #include "../my_config.h"
38 
39 #include "catalogue.hpp"
40 #include "escape.hpp"
41 #include "pile_descriptor.hpp"
42 #include "smart_pointer.hpp"
43 #include "header_version.hpp"
44 
45 namespace libdar
46 {
47 
50 
51  class escape_catalogue : public catalogue
52  {
53  public:
54 
56  escape_catalogue(const std::shared_ptr<user_interaction> & dialog,
57  const pile_descriptor & x_pdesc,
58  const datetime & root_last_modif,
59  const label & data_name);
60 
62  escape_catalogue(const std::shared_ptr<user_interaction> & dialog,
63  const pile_descriptor & x_pdesc,
64  const header_version & ver,
65  const std::list<signator> & known_signatories,
66  bool lax = false);
67  escape_catalogue(const escape_catalogue & ref) : catalogue(ref) { copy_from(ref); };
68  escape_catalogue(escape_catalogue && ref) = delete;
69  escape_catalogue & operator = (const escape_catalogue &ref);
70  escape_catalogue & operator = (escape_catalogue && ref) = delete;
71  ~escape_catalogue() { destroy(); };
72 
73  // inherited from catalogue
74  virtual void pre_add(const cat_entree *ref, const pile_descriptor* dest) const override;
75  virtual void pre_add_ea(const cat_entree *ref, const pile_descriptor* dest) const override;
76  virtual void pre_add_crc(const cat_entree *ref, const pile_descriptor* dest) const override;
77  virtual void pre_add_dirty(const pile_descriptor* dest) const override;
78  virtual void pre_add_ea_crc(const cat_entree *ref, const pile_descriptor* dest) const override;
79  virtual void pre_add_waste_mark(const pile_descriptor* dest) const override;
80  virtual void pre_add_failed_mark(const pile_descriptor* dest) const override;
81  virtual void pre_add_fsa(const cat_entree *ref, const pile_descriptor* dest) const override;
82  virtual void pre_add_fsa_crc(const cat_entree *ref, const pile_descriptor* dest) const override;
83  virtual void pre_add_delta_sig(const pile_descriptor* dest) const override;
84  virtual escape *get_escape_layer() const override { return pdesc.is_null() ? nullptr : pdesc->esc; };
85  virtual void drop_escape_layer() override { pdesc.assign(nullptr); };
86 
87  virtual void reset_read() const override;
88  virtual void end_read() const override;
89  virtual void skip_read_to_parent_dir() const override;
90  virtual bool read(const cat_entree * & ref) const override;
91  virtual bool read_if_present(std::string *name, const cat_nomme * & ref) const override;
92  virtual void tail_catalogue_to_current_read() override;
93  virtual bool read_second_time_dir() const override { return status == ec_detruits; };
94 
95  private:
96  enum state
97  {
98  ec_init,
99  ec_marks,
100  ec_eod,
101  ec_signature,
102  ec_detruits,
103  ec_completed
104  };
105 
106  smart_pointer<pile_descriptor> pdesc;
107  header_version x_ver;
108  std::list<signator> known_sig;
109  bool x_lax;
110  std::map <infinint, cat_etoile *> corres;
111  state status;
112  catalogue *cat_det;
113  infinint min_read_offset;
114  infinint depth;
115  infinint wait_parent_depth;
116 
117  void set_esc_and_stack(const pile_descriptor & x_pdesc);
118  void copy_from(const escape_catalogue & ref);
119  void destroy();
120  void merge_cat_det();
121  void reset_reading_process();
122  };
123 
125 
126 } // end of namespace
127 
128 #endif
header_version.hpp
archive global header/trailer structure is defined here
smart_pointer.hpp
template class implementing memory efficient smart pointer
escape.hpp
class escape definition, used for sequential reading of archives
catalogue.hpp
here is defined the classe used to manage catalogue of archives
pile_descriptor.hpp
optimization structure to quickly access some commonly used layers of a stack of generic_file
libdar
libdar namespace encapsulate all libdar symbols
Definition: archive.hpp:46