Loading...
Searching...
No Matches
libdar::cat_file Class Reference
Private

the plain file class More...

`#include <cat_file.hpp>`

Inherits libdar::cat_inode.

Inherited by libdar::cat_door.

## Public Types

enum | get_data_mode { keep_compressed , keep_hole , normal , plain }
| how to get data from archive More...

## Public Member Functions

| cat_file (const infinint &xuid, const infinint &xgid, U_16 xperm, const datetime &last_access, const datetime &last_modif, const datetime &last_change, const std::string &src, const path &che, const infinint &taille, const infinint &fs_device, bool x_furtive_read_mode)
| cat_file (const std::shared_ptr< user_interaction > &dialog, const smart_pointer< pile_descriptor > &pdesc, const archive_version &reading_ver, saved_status saved, compression default_algo, bool small)
| cat_file (const cat_file &ref)
| cat_file (cat_file &&ref)=delete
cat_file & | operator= (const cat_file &ref)=delete
cat_file & | operator= (cat_file &&ref)=delete
virtual bool | has_changed_since (const cat_inode &ref, const infinint &hourshift, comparison_fields what_to_check) const override
infinint | get_size () const
void | change_size (const infinint &s) const
infinint | get_storage_size () const
void | set_storage_size (const infinint &s)
bool | can_get_data () const
| check whether the object will be able to provide a object using get_data() method
virtual generic_file * | get_data (get_data_mode mode, std::shared_ptr< memory_file > delta_sig_mem, U_I signature_block_size, std::shared_ptr< memory_file > delta_ref, const crc **checksum=nullptr) const
| returns a newly allocated object in read_only mode
void | clean_data ()
void | set_offset (const infinint &r)
const infinint & | get_offset () const
virtual unsigned char | signature () const override
| inherited class signature
virtual std::string | get_description () const override
| inherited class designation
void | set_crc (const crc &c)
bool | get_crc (const crc *&c) const
| the argument is set the an allocated crc object the owned by the "cat_file" object, its stay valid while this "cat_file" object exists and MUST NOT be deleted by the caller in any case
bool | has_crc () const
bool | get_crc_size (infinint &val) const
| returns true if crc is know and puts its width in argument
void | drop_crc ()
void | set_sparse_file_detection_read (bool val)
void | set_sparse_file_detection_write (bool val)
bool | get_sparse_file_detection_read () const
bool | get_sparse_file_detection_write () const
virtual cat_entree * | clone () const override
| a way to copy the exact type of an object even if pointed to by a parent class pointer
compression | get_compression_algo_read () const
compression | get_compression_algo_write () const
void | change_compression_algo_write (compression x)
bool | is_dirty () const
void | set_dirty (bool value)
bool | has_delta_signature_structure () const
| return whether the object has an associated delta signature structure
bool | has_delta_signature_available () const
| return whether the object has an associated delta signature structure including a delta signature data (not just CRC)
bool | has_patch_base_crc () const
| returns whether the object has a base patch CRC (s_delta status objects)
bool | get_patch_base_crc (const crc *&c) const
| returns the CRC of the file to base the patch on, for s_delta objects
void | set_patch_base_crc (const crc &c)
| set the reference CRC of the file to base the patch on, for s_detla objects
bool | has_patch_result_crc () const
| returns whether the object has a CRC corresponding to data (for s_saved, s_delta, and when delta signature is present)
bool | get_patch_result_crc (const crc *&c) const
| returns the CRC the file will have once restored or patched (for s_saved, s_delta, and when delta signature is present)
void | set_patch_result_crc (const crc &c)
| set the CRC the file will have once restored or patched (for s_saved, s_delta, and when delta signature is present)
void | will_have_delta_signature_structure ()
| prepare the object to receive a delta signature structure
void | will_have_delta_signature_available ()
| prepare the object to receive a delta signature structure including delta signature
void | dump_delta_signature (std::shared_ptr< memory_file > &sig, U_I sign_block_size, generic_file &where, bool small) const
| write down to archive the given delta signature
void | dump_delta_signature (generic_file &where, bool small) const
| variant of dump_delta_signature when just CRC have to be dumped
void | read_delta_signature_metadata () const
| load metadata (and delta signature when in sequential mode) into memory
void | read_delta_signature (std::shared_ptr< memory_file > &delta_sig, U_I &block_len) const
| fetch the delta signature from the archive
void | drop_delta_signature_data () const
| drop the delta signature from memory (will not more be posible to be read, using read_delta_signature)
bool | has_same_delta_signature (const cat_file &ref) const
| return true if ref and "this" have both equal delta signatures
void | clear_delta_signature_only ()
| remove information about delta signature also associated CRCs if status is not s_delta
void | clear_delta_signature_structure ()
| remove any information about delta signature
virtual bool | operator== (const cat_entree &ref) const override
| not used
bool | same_data_as (const cat_file &other, bool check_data, const infinint &hourshift)
| compare just data not inode information EA nor FSA
const archive_version & | get_archive_version () const
| expose the archive format the object of the backup this object comes from
Public Member Functions inherited from libdar::cat_inode
| cat_inode (const infinint &xuid, const infinint &xgid, U_16 xperm, const datetime &last_access, const datetime &last_modif, const datetime &last_change, const std::string &xname, const infinint &device)
| flag used to only consider certain fields when comparing/restoring inodes
| cat_inode (const std::shared_ptr< user_interaction > &dialog, const smart_pointer< pile_descriptor > &pdesc, const archive_version &reading_ver, saved_status saved, bool small)
| cat_inode (const cat_inode &ref)
| cat_inode (cat_inode &&ref) noexcept
cat_inode & | operator= (const cat_inode &ref)
cat_inode & | operator= (cat_inode &&ref)
const infinint & | get_uid () const
const infinint & | get_gid () const
U_16 | get_perm () const
datetime | get_last_access () const
datetime | get_last_modif () const
void | set_last_access (const datetime &x_time)
void | set_last_modif (const datetime &x_time)
infinint | get_device () const
bool | same_as (const cat_inode &ref) const
bool | is_more_recent_than (const cat_inode &ref, const infinint &hourshift) const
void | compare (const cat_inode &other, const mask &ea_mask, comparison_fields what_to_check, const infinint &hourshift, bool symlink_date, const fsa_scope &scope, bool isolated_mode) const
| do not try to compare pointed to data, EA of FSA (suitable for isolated catalogue)
void | ea_set_saved_status (ea_saved_status status)
ea_saved_status | ea_get_saved_status () const
void | ea_attach (ea_attributs *ref)
const ea_attributs * | get_ea () const
| the returned value is the address of an existing file of the cat_inode object and shall not be deleted by the caller
void | ea_detach () const
infinint | ea_get_size () const
void | ea_set_offset (const infinint &pos)
bool | ea_get_offset (infinint &pos) const
void | ea_set_crc (const crc &val)
void | ea_get_crc (const crc *&ptr) const
| the argument is set to point to an allocated crc object owned by this "cat_inode" object, this reference stays valid while the "cat_inode" object exists and MUST NOT be deleted by the caller in any case
bool | ea_get_crc_size (infinint &val) const
| returns true if crc is know and puts its width in argument
datetime | get_last_change () const
void | set_last_change (const datetime &x_time)
bool | has_last_change () const
void | fsa_set_saved_status (fsa_saved_status status)
fsa_saved_status | fsa_get_saved_status () const
fsa_scope | fsa_get_families () const
| gives the set of FSA family recorded for that inode
void | fsa_attach (filesystem_specific_attribute_list *ref)
void | fsa_partial_attach (const fsa_scope &val)
const filesystem_specific_attribute_list * | get_fsa () const
void | fsa_detach () const
infinint | fsa_get_size () const
void | fsa_set_offset (const infinint &pos)
bool | fsa_get_offset (infinint &pos) const
void | fsa_set_crc (const crc &val)
void | fsa_get_crc (const crc *&ptr) const
bool | fsa_get_crc_size (infinint &val) const
Public Member Functions inherited from libdar::cat_nomme
| cat_nomme (const std::string &name, saved_status arg)
| cat_nomme (const smart_pointer< pile_descriptor > &pdesc, bool small, saved_status val)
| cat_nomme (const cat_nomme &ref)=default
| cat_nomme (cat_nomme &&ref) noexcept=default
cat_nomme & | operator= (const cat_nomme &ref)=default
cat_nomme & | operator= (cat_nomme &&ref)=default
virtual bool | operator< (const cat_nomme &ref) const
const std::string & | get_name () const
void | change_name (const std::string &x)
bool | same_as (const cat_nomme &ref) const
Public Member Functions inherited from libdar::cat_entree
| 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
| cat_entree (const cat_entree &ref)=default
| cat_entree (cat_entree &&ref) noexcept=default
cat_entree & | operator= (const cat_entree &ref)=default
cat_entree & | operator= (cat_entree &&ref)=default
virtual | ~cat_entree () noexcept(false)
| destructor
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
void | dump (const pile_descriptor &pdesc, bool small) const
| write down the object information to a stack
void | specific_dump (const pile_descriptor &pdesc, bool small) const
| this call gives an access to inherited_dump
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

## Static Public Attributes

static constexpr U_8 | FILE_DATA_WITH_HOLE = 0x01
| file's data contains hole datastructure
static constexpr U_8 | FILE_DATA_IS_DIRTY = 0x02
| data modified while being saved
static constexpr U_8 | FILE_DATA_HAS_DELTA_SIG = 0x04
| delta signature is present

## Protected Types

enum | { empty , from_path , from_cat }

## Protected Member Functions

virtual void | sub_compare (const cat_inode &other, bool isolated_mode) const override
virtual void | inherited_dump (const pile_descriptor &pdesc, bool small) const override
| true if object has been created by sequential reading of an archive
virtual void | post_constructor (const pile_descriptor &pdesc) override
| let inherited classes build object's data after CRC has been read from file in small read mode
Protected Member Functions inherited from libdar::cat_inode
bool | get_small_read () const
Protected Member Functions inherited from libdar::cat_entree
pile * | get_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
escape * | get_escape_layer () const
| escape generic_file relative methods
generic_file * | get_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)

## Protected Attributes

enum libdar::cat_file:: { ... } | status

## Private Member Functions

void | sub_compare_internal (const cat_inode &other, bool can_read_my_data, bool can_read_other_data, const infinint &hourshift) const
void | clean_patch_base_crc ()
void | detruit ()

## Private Attributes

std::string | chemin
| path to the data (when read from filesystem)
infinint * | offset
| start location of the data in 'loc'
infinint * | size
| size of the data (uncompressed)
infinint * | storage_size
| how much data used in archive (after compression)
crc * | check
| crc computed on the data
bool | dirty
| true when a file has been modified at the time it was saved
compression | algo_read
| which compression algorithm to use to read the file's data
compression | algo_write
| which compression algorithm to use to write down (merging) the file's data
bool | furtive_read_mode
| used only when status equals "from_path"
char | file_data_status_read
| defines the datastructure to use when reading the data
char | file_data_status_write
| defines the datastructure to apply when writing down the data
crc * | patch_base_check
| when data contains a delta patch, moved from delta_sig since format 10.2
cat_delta_signature * | delta_sig
| delta signature and associated CRC
bool | delta_sig_read
| whether delta sig has been read/initialized from filesystem
archive_version | read_ver
| archive format used/to use

## Additional Inherited Members

Static Public Member Functions inherited from libdar::cat_entree
static 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)
| read and create an object of inherited class of class cat_entree

## Detailed Description

the plain file class

Definition at line 48 of file cat_file.hpp.

## Member Enumeration Documentation

## anonymous enum

anonymous enum

protected

Definition at line 247 of file cat_file.hpp.

## get_data_mode

enum libdar::cat_file::get_data_mode

how to get data from archive

Enumerator
keep_compressed | provide access to compressed data
keep_hole | provide access to uncompressed data but sparse_file datastructure
normal | provide access to full data (uncompressed, uses skip() to restore holes)
plain | provide access to plain data, no skip to restore holes, provide instead zeroed bytes

Definition at line 53 of file cat_file.hpp.

## Constructor & Destructor Documentation

## ~cat_file()

libdar::cat_file::~cat_file | ( |  | ) |

inline

Definition at line 86 of file cat_file.hpp.

## Member Function Documentation

## can_get_data()

bool libdar::cat_file::can_get_data | ( |  | ) | const

inline

check whether the object will be able to provide a object using get_data() method

Definition at line 97 of file cat_file.hpp.

References libdar::delta, libdar::cat_entree::get_saved_status(), and libdar::saved.

## change_compression_algo_write()

void libdar::cat_file::change_compression_algo_write | ( | compression | x | ) |

inline

Definition at line 146 of file cat_file.hpp.

## change_size()

void libdar::cat_file::change_size | ( | const infinint & | s | ) | const

inline

Definition at line 92 of file cat_file.hpp.

## clone()

virtual cat_entree * libdar::cat_file::clone | ( |  | ) | const

inlineoverridevirtual

a way to copy the exact type of an object even if pointed to by a parent class pointer

Implements libdar::cat_entree.

Definition at line 139 of file cat_file.hpp.

## drop_crc()

void libdar::cat_file::drop_crc | ( |  | ) |

inline

Definition at line 128 of file cat_file.hpp.

## dump_delta_signature()

void libdar::cat_file::dump_delta_signature | ( | std::shared_ptr< memory_file > & | sig,
|  | U_I | sign_block_size,
|  | generic_file & | where,
|  | bool | small ) const

write down to archive the given delta signature

Parameters

  [in] | sig | is the signature to dump
  [in] | sign_block_size | block size to used to build the delta signature
  [in] | where | is the location where to write down the signature
  [in] | small | if set to true drop down additional information to allow sequential reading mode

## get_archive_version()

const archive_version & libdar::cat_file::get_archive_version | ( |  | ) | const

inline

expose the archive format the object of the backup this object comes from

Definition at line 240 of file cat_file.hpp.

References read_ver.

## get_compression_algo_read()

compression libdar::cat_file::get_compression_algo_read | ( |  | ) | const

inline

Definition at line 141 of file cat_file.hpp.

## get_compression_algo_write()

compression libdar::cat_file::get_compression_algo_write | ( |  | ) | const

inline

Definition at line 143 of file cat_file.hpp.

## get_data()

virtual generic_file * libdar::cat_file::get_data | ( | get_data_mode | mode,
|  | std::shared_ptr< memory_file > | delta_sig_mem,
|  | U_I | signature_block_size,
|  | std::shared_ptr< memory_file > | delta_ref,
|  | const crc ** | checksum = nullptr ) const

virtual

returns a newly allocated object in read_only mode

Parameters

  [in] | mode | whether to return compressed, with hole or plain file
  [in,out] | delta_sig_mem | if not nullptr, write to that file the delta signature of the file
  [in] | signature_block_size | is the block size to use to build the signature (passed to librsync as is)
  [in] | delta_ref | if not nullptr, use the provided signature to generate a delta binary
  [in] | checksum | if not null will set checsum to the address of a newly allocated crc object that the caller has the duty to release when no more needed but *not before the returned generic_file object has been destroyed first. The computed crc is against the real data found on disk not the one of the delta diff that could be generated from get_data()

Note
  the object pointed to by delta_sig must exist during the whole life of the returned object, as well as the object pointed to by delta_ref if provided.
  when both delta_sig and delta_ref are provided, the delta signature is computed on the file data, then the delta binary is computed.

Reimplemented in libdar::cat_door.

## get_description()

virtual std::string libdar::cat_file::get_description | ( |  | ) | const

inlineoverridevirtual

inherited class designation

Implements libdar::cat_entree.

Reimplemented in libdar::cat_door.

Definition at line 122 of file cat_file.hpp.

## get_size()

infinint libdar::cat_file::get_size | ( |  | ) | const

inline

Definition at line 91 of file cat_file.hpp.

## get_sparse_file_detection_read()

bool libdar::cat_file::get_sparse_file_detection_read | ( |  | ) | const

inline

Definition at line 136 of file cat_file.hpp.

## get_sparse_file_detection_write()

bool libdar::cat_file::get_sparse_file_detection_write | ( |  | ) | const

inline

Definition at line 137 of file cat_file.hpp.

## get_storage_size()

infinint libdar::cat_file::get_storage_size | ( |  | ) | const

inline

Definition at line 93 of file cat_file.hpp.

## has_changed_since()

virtual bool libdar::cat_file::has_changed_since | ( | const cat_inode & | ref,
|  | const infinint & | hourshift,
|  | comparison_fields | what_to_check ) const

overridevirtual

Reimplemented from libdar::cat_inode.

## has_crc()

bool libdar::cat_file::has_crc | ( |  | ) | const

inline

Definition at line 126 of file cat_file.hpp.

## has_delta_signature_available()

bool libdar::cat_file::has_delta_signature_available | ( |  | ) | const

inline

return whether the object has an associated delta signature structure including a delta signature data (not just CRC)

Note
  when reading file from archive/generic_file if the metadata is not loaded to memory calling either read_delta_signature_metadata() or read_delta_signature() and if sequential read mode is used this call will always report false, even if delta signature can be available from filesystem/archive

Definition at line 162 of file cat_file.hpp.

References libdar::cat_delta_signature::can_obtain_sig(), and delta_sig.

## has_delta_signature_structure()

bool libdar::cat_file::has_delta_signature_structure | ( |  | ) | const

inline

return whether the object has an associated delta signature structure

Definition at line 155 of file cat_file.hpp.

References delta_sig.

## inherited_dump()

virtual void libdar::cat_file::inherited_dump | ( | const pile_descriptor & | pdesc,
|  | bool | small ) const

overrideprotectedvirtual

true if object has been created by sequential reading of an archive

Reimplemented from libdar::cat_inode.

## is_dirty()

bool libdar::cat_file::is_dirty | ( |  | ) | const

inline

Definition at line 150 of file cat_file.hpp.

## operator==()

virtual bool libdar::cat_file::operator== | ( | const cat_entree & | ref | ) | const

inlineoverridevirtual

not used

Reimplemented from libdar::cat_nomme.

Reimplemented in libdar::cat_door.

Definition at line 234 of file cat_file.hpp.

## post_constructor()

virtual void libdar::cat_file::post_constructor | ( | const pile_descriptor & | pdesc | ) |

overrideprotectedvirtual

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

Parameters

  [in] | pdesc | stack 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 from libdar::cat_entree.

## read_delta_signature()

void libdar::cat_file::read_delta_signature | ( | std::shared_ptr< memory_file > & | delta_sig,
|  | U_I & | block_len ) const

fetch the delta signature from the archive

Parameters

  [out] | delta_sig | is either nullptr or points to a shared memory_file containing the delta signature.
  [out] | block_len | is the block size that has been used to build the signature

Note
  nullptr is returned if the delta_signature only contains CRCs

## read_delta_signature_metadata()

void libdar::cat_file::read_delta_signature_metadata | ( |  | ) | const

load metadata (and delta signature when in sequential mode) into memory

Note
  call drop_delta_signature_data() subsequently if only the metada is needed (when un sequential read mode or not, it does not hurt)

## set_dirty()

void libdar::cat_file::set_dirty | ( | bool | value | ) |

inline

Definition at line 151 of file cat_file.hpp.

## set_sparse_file_detection_read()

void libdar::cat_file::set_sparse_file_detection_read | ( | bool | val | ) |

inline

Definition at line 131 of file cat_file.hpp.

## set_sparse_file_detection_write()

void libdar::cat_file::set_sparse_file_detection_write | ( | bool | val | ) |

inline

Definition at line 133 of file cat_file.hpp.

## set_storage_size()

void libdar::cat_file::set_storage_size | ( | const infinint & | s | ) |

inline

Definition at line 94 of file cat_file.hpp.

## signature()

virtual unsigned char libdar::cat_file::signature | ( |  | ) | const

inlineoverridevirtual

inherited class signature

Implements libdar::cat_entree.

Reimplemented in libdar::cat_door.

Definition at line 121 of file cat_file.hpp.

## sub_compare()

virtual void libdar::cat_file::sub_compare | ( | const cat_inode & | other,
|  | bool | isolated_mode ) const

overrideprotectedvirtual

Reimplemented from libdar::cat_inode.

## will_have_delta_signature_available()

void libdar::cat_file::will_have_delta_signature_available | ( |  | ) |

prepare the object to receive a delta signature structure including delta signature

this calls will lead an to error if the delta_signature is written to archive or used while only CRC info has been set (= metadata of delta signature) but no delta signature data has read from the archive or has been provided (by mean of a memory_file when calling dump_delta_signature() method)

## Member Data Documentation

## algo_read

compression libdar::cat_file::algo_read

private

which compression algorithm to use to read the file's data

Definition at line 256 of file cat_file.hpp.

## algo_write

compression libdar::cat_file::algo_write

private

which compression algorithm to use to write down (merging) the file's data

Definition at line 257 of file cat_file.hpp.

## check

crc* libdar::cat_file::check

private

crc computed on the data

Definition at line 254 of file cat_file.hpp.

## chemin

std::string libdar::cat_file::chemin

private

path to the data (when read from filesystem)

Definition at line 250 of file cat_file.hpp.

## delta_sig

cat_delta_signature* libdar::cat_file::delta_sig

private

delta signature and associated CRC

Definition at line 262 of file cat_file.hpp.

Referenced by has_delta_signature_available(), and has_delta_signature_structure().

## delta_sig_read

bool libdar::cat_file::delta_sig_read

mutableprivate

whether delta sig has been read/initialized from filesystem

Definition at line 263 of file cat_file.hpp.

## dirty

bool libdar::cat_file::dirty

private

true when a file has been modified at the time it was saved

Definition at line 255 of file cat_file.hpp.

## FILE_DATA_HAS_DELTA_SIG

U_8 libdar::cat_file::FILE_DATA_HAS_DELTA_SIG = 0x04

staticconstexpr

delta signature is present

Definition at line 63 of file cat_file.hpp.

## FILE_DATA_IS_DIRTY

U_8 libdar::cat_file::FILE_DATA_IS_DIRTY = 0x02

staticconstexpr

data modified while being saved

Definition at line 62 of file cat_file.hpp.

## file_data_status_read

char libdar::cat_file::file_data_status_read

private

defines the datastructure to use when reading the data

Definition at line 259 of file cat_file.hpp.

## file_data_status_write

char libdar::cat_file::file_data_status_write

private

defines the datastructure to apply when writing down the data

Definition at line 260 of file cat_file.hpp.

## FILE_DATA_WITH_HOLE

U_8 libdar::cat_file::FILE_DATA_WITH_HOLE = 0x01

staticconstexpr

file's data contains hole datastructure

Definition at line 61 of file cat_file.hpp.

## furtive_read_mode

bool libdar::cat_file::furtive_read_mode

private

used only when status equals "from_path"

Definition at line 258 of file cat_file.hpp.

## offset

infinint* libdar::cat_file::offset

private

start location of the data in 'loc'

Definition at line 251 of file cat_file.hpp.

## patch_base_check

crc* libdar::cat_file::patch_base_check

private

when data contains a delta patch, moved from delta_sig since format 10.2

Definition at line 261 of file cat_file.hpp.

## read_ver

archive_version libdar::cat_file::read_ver

private

archive format used/to use

Definition at line 264 of file cat_file.hpp.

Referenced by get_archive_version().

## size

infinint* libdar::cat_file::size

private

size of the data (uncompressed)

Definition at line 252 of file cat_file.hpp.

## storage_size

infinint* libdar::cat_file::storage_size

private

how much data used in archive (after compression)

Definition at line 253 of file cat_file.hpp.

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

- cat_file.hpp