Disk ARchive  2.7.15
Full featured and portable backup and archiving tool
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | Static Private Attributes | List of all members
libdar::cat_entree Class Referenceabstract

the root class from all other inherite for any entry in the catalogue More...

#include <cat_entree.hpp>

+ Inheritance diagram for libdar::cat_entree:
+ Collaboration diagram for libdar::cat_entree:

Public Member Functions

 cat_entree (saved_status val)
 setup an object when read from filesystem
 
 cat_entree (const smart_pointer< pile_descriptor > &pdesc, bool small, saved_status val)
 setup an object when read from an archive More...
 
 cat_entree (const cat_entree &ref)=default
 
 cat_entree (cat_entree &&ref) noexcept=default
 
cat_entreeoperator= (const cat_entree &ref)=default
 
cat_entreeoperator= (cat_entree &&ref)=default
 
virtual ~cat_entree () noexcept(false)
 destructor
 
virtual bool operator== (const cat_entree &ref) const =0
 returns true if the two object are the same
 
bool operator!= (const cat_entree &ref) const
 
bool same_as (const cat_entree &ref) const
 return true of the two objects would generate the same entry on filsystem More...
 
void dump (const pile_descriptor &pdesc, bool small) const
 write down the object information to a stack More...
 
void specific_dump (const pile_descriptor &pdesc, bool small) const
 this call gives an access to inherited_dump More...
 
virtual void post_constructor (const pile_descriptor &pdesc)
 let inherited classes build object's data after CRC has been read from file in small read mode More...
 
virtual unsigned char signature () const =0
 inherited class signature
 
virtual std::string get_description () const =0
 inherited class designation
 
virtual cat_entreeclone () const =0
 a way to copy the exact type of an object even if pointed to by a parent class pointer
 
virtual void change_location (const smart_pointer< pile_descriptor > &pdesc)
 
saved_status get_saved_status () const
 obtain the saved status of the object
 
void set_saved_status (saved_status x)
 modify the saved_status of the object
 
void set_list_entry (const slice_layout *sly, bool fetch_ea, list_entry &ent) const
 setup a list_entry object relative to the current cat_entree object More...
 

Static Public Member Functions

static cat_entreeread (const std::shared_ptr< user_interaction > &dialog, const smart_pointer< pile_descriptor > &f, const archive_version &reading_ver, entree_stats &stats, std::map< infinint, cat_etoile * > &corres, compression default_algo, bool lax, bool only_detruit, bool small)
 read and create an object of inherited class of class cat_entree More...
 

Protected Member Functions

virtual void inherited_dump (const pile_descriptor &pdesc, bool small) const
 inherited class may overload this method but shall first call the parent's inherited_dump() in the overloaded method
 
pileget_pile () const
 stack used to read object from (nullptr is returned for object created from filesystem)
 
proto_compressor * get_compressor_layer () const
 compressor generic_file relative methods More...
 
escape * get_escape_layer () const
 escape generic_file relative methods More...
 
generic_fileget_read_cat_layer (bool small) const
 return the adhoc layer in the stack to read from the catalogue objects (except the EA, FSA or Data part)
 

Private Attributes

saved_status xsaved
 inode data status, this field is stored with signature() in the cat_signature field -> must be managed by cat_entree
 
smart_pointer< pile_descriptor > pdesc
 

Static Private Attributes

static const U_I ENTREE_CRC_SIZE
 

Detailed Description

the root class from all other inherite for any entry in the catalogue

Definition at line 59 of file cat_entree.hpp.

Constructor & Destructor Documentation

◆ cat_entree()

libdar::cat_entree::cat_entree ( const smart_pointer< pile_descriptor > &  pdesc,
bool  small,
saved_status  val 
)

setup an object when read from an archive

Parameters
[in]pdescpoints to an existing stack that will be read from to setup fields of inherited classes, this pointed to pile object must survive the whole life of the cat_entree object
[in]smallwhether a small or a whole read is to be read, (inode has been dump() with small set to true)
[in]valsaved_status to assign the the new object

Member Function Documentation

◆ change_location()

virtual void libdar::cat_entree::change_location ( const smart_pointer< pile_descriptor > &  pdesc)
virtual

for archive merging, will let the object drop EA, FSA and Data to an alternate stack than the one it has been read from

Note
this is used when cloning an object from a catalogue to provide a merged archive. Such cloned object must point the stack of the archive under construction, so we use this call for that need,
this is also used when opening a catalogue if an isolated catalogue in place of the internal catalogue of an archive
this method is virtual in order for cat_directory to overwrite it and propagate the change to all entries of the directory tree as well for mirage to propagate the change to the hard linked inode

Reimplemented in libdar::cat_mirage, and libdar::cat_directory.

Referenced by libdar::cat_mirage::change_location().

◆ dump()

void libdar::cat_entree::dump ( const pile_descriptor &  pdesc,
bool  small 
) const

write down the object information to a stack

Parameters
[in,out]pdescis the stack where to write the data to
[in]smalldefines whether to do a small or normal dump

◆ get_compressor_layer()

proto_compressor* libdar::cat_entree::get_compressor_layer ( ) const
inlineprotected

compressor generic_file relative methods

Note
CAUTION: the pointer to object is member of the get_pile() stack and may be managed by another thread all precaution like get_pile()->flush_read_above(get_compressor_layer() shall be take to avoid concurrent access to the proto_compressor object by the current thread and the thread managing this object

Definition at line 193 of file cat_entree.hpp.

References libdar::smart_pointer< T >::is_null().

◆ get_escape_layer()

escape* libdar::cat_entree::get_escape_layer ( ) const
inlineprotected

escape generic_file relative methods

Note
CAUTION: the pointer to object is member of the get_pile() stack and may be managed by another thread all precaution like get_pile()->flush_read_above(get_escape_layer() shall be take to avoid concurrent access to the compressor object by the current thread and the thread managing this object

Definition at line 200 of file cat_entree.hpp.

References libdar::smart_pointer< T >::is_null().

◆ post_constructor()

virtual void libdar::cat_entree::post_constructor ( const pile_descriptor &  pdesc)
inlinevirtual

let inherited classes build object's data after CRC has been read from file in small read mode

Parameters
[in]pdescstack to read the data from
Note
used from cat_entree::read to complete small read
this method is called by cat_entree::read and mirage::post_constructor only when contructing an object with small set to true

Reimplemented in libdar::cat_mirage, and libdar::cat_file.

Definition at line 139 of file cat_entree.hpp.

◆ read()

static cat_entree* libdar::cat_entree::read ( const std::shared_ptr< user_interaction > &  dialog,
const smart_pointer< pile_descriptor > &  f,
const archive_version reading_ver,
entree_stats stats,
std::map< infinint, cat_etoile * > &  corres,
compression  default_algo,
bool  lax,
bool  only_detruit,
bool  small 
)
static

read and create an object of inherited class of class cat_entree

Parameters
[in]dialogfor user interaction
[in]fwhere from to read data in order to create the object
[in]reading_verarchive version format to use for reading
[in,out]statsupdated statistical fields
[in,out]corresused to setup hard links
[in]default_algodefault compression algorithm
[in]laxwhether to use relax mode
[in]only_detruitwhether to only consider detruit objects (in addition to the directory tree)
[in]smallwhether the dump() to read has been done with the small argument set

◆ same_as()

bool libdar::cat_entree::same_as ( const cat_entree ref) const
inline

return true of the two objects would generate the same entry on filsystem

for a and b two cat_entree, if a == b, then a.same_as(b) is true also. But the opposit may be wrong if for example "a" is a hardlink pointing to an inode while b is a normal inode, restoring both could lead to having the same entry in filsystem while a and b are different for libdar: here they are objects of two different classes.

Definition at line 120 of file cat_entree.hpp.

Referenced by libdar::cat_nomme::same_as().

◆ set_list_entry()

void libdar::cat_entree::set_list_entry ( const slice_layout *  sly,
bool  fetch_ea,
list_entry ent 
) const

setup a list_entry object relative to the current cat_entree object

Parameters
[in]slythe slice layout that shall be used for file location in slices
[in]fetch_eawhether to fetch EA and fill these values into the generated list_entry
[out]entthe list_entry that will be setup by the call
Note
if sly is set to nullptr, no slice location is performed, this brings some speed improvement when this information is not required

◆ specific_dump()

void libdar::cat_entree::specific_dump ( const pile_descriptor &  pdesc,
bool  small 
) const
inline

this call gives an access to inherited_dump

Parameters
[in,out]pdescis the stack where to write the data to
[in]smalldefines whether to do a small or normal dump

Definition at line 132 of file cat_entree.hpp.

References inherited_dump().


The documentation for this class was generated from the following file: