libdar::cat_delta_signature Class Reference
Private

the cat_delta_signature file class More...

`#include <cat_delta_signature.hpp>`

## Public Member Functions

| cat_delta_signature (generic_file *f, proto_compressor *c)
| constructor to read an object (using read() later on) from filesystem/backup More...
| cat_delta_signature ()
| constructor to write an object to filesytem/backup (using dump_* methods later on) More...
| cat_delta_signature (const cat_delta_signature &ref)
| copy constructor More...
| cat_delta_signature (cat_delta_signature &&ref) noexcept
| move constructor More...
cat_delta_signature & | operator= (const cat_delta_signature &ref)
| assignement operator More...
cat_delta_signature & | operator= (cat_delta_signature &&ref) noexcept
| move assignment operator More...
| ~cat_delta_signature ()
| destructor More...
bool | is_pending_read () const
| tells whether the read() call has been invoked More...
void | read (bool sequential_read, const archive_version &ver)
bool | can_obtain_sig () const
| the cat_delta_signature structure can only hold CRC without delta_signature, this call gives the situation about that point More...
std::shared_ptr< memory_file > | obtain_sig (const archive_version &ver) const
| provide a memory_file object which the caller has the duty to destroy after use More...
U_I | obtain_sig_block_size () const
| provide the block size used for delta signature More...
void | drop_sig () const
| drop signature but keep metadata available More...
void | will_have_signature ()
| give the object where to fetch from the delta signature, object must exist up to the next call to dump_data More...
void | set_sig (const std::shared_ptr< memory_file > &ptr, U_I sig_block_size)
| the object pointed to by ptr must stay available when calling dump_data()/dump_metadata() later on More...
void | set_sig ()
| variante used when the delta_signature object will only contain CRCs (no delta signature) More...
void | dump_data (generic_file &f, bool sequential_mode, const archive_version &ver) const
| write down the data eventually with sequential read mark followed by delta sig metadata More...
void | dump_metadata (generic_file &f) const
| write down the delta_signature metadata for catalogue
bool | has_patch_base_crc () const
| returns whether the object has a base patch CRC (s_delta status objects) More...
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) More...
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 | clear ()
| reset the object More...

## Private Member Functions

void | init () noexcept
void | copy_from (const cat_delta_signature &ref)
void | move_from (cat_delta_signature &&ref) noexcept
void | destroy () noexcept
void | fetch_data (const archive_version &ver) const

## Private Attributes

crc * | patch_base_check
| associated CRC for the file this signature has been computed on, moved to cat_file since format 11.2, still need for older formats More...
infinint | delta_sig_size
| size of the data to setup "sig" (set to zero when reading in sequential mode, sig is then setup on-fly) More...
infinint | delta_sig_offset
std::shared_ptr< memory_file > | sig
| the signature data, if set nullptr it will be fetched from f in direct access mode only More...
crc * | patch_result_check
| associated CRC More...
generic_file * | src
| where to read data from More...
proto_compressor * | zip
| needed to disable compression when reading delta signature data from an archive More...
U_I | sig_block_len
| block length used within delta signature More...
bool | pending_read
| when the object has been created for read but data not yet read from archive More...

## Detailed Description

the cat_delta_signature file class

this class works in two implicit modes

- read mode read the metadata from an archive the caller having to know where to find it read the data and fill the provided memory_file (get_sig()) by the delta signature provide access to the associated CRC
- write mode stores the associated CRC write down the given delta signature (with metadata in sequential mode) write down the metadata the signature is not stored

Definition at line 93 of file cat_delta_signature.hpp.

## Constructor & Destructor Documentation

## cat_delta_signature() [1/4]

libdar::cat_delta_signature::cat_delta_signature | ( | generic_file * | f,
|  | proto_compressor * | c
| ) |  |

constructor to read an object (using read() later on) from filesystem/backup

Parameters

  [in] | f | where to read the data from, used when calling read() later on. f must not be set to nullptr and the pointed to object must survive this cat_delta_signature object
  [in] | c | points to the compressor layer in order to suspend compression when reading data (metadata will be read compressed or not depending on the its location (in-lined or in the catalogue at end of archive)

## cat_delta_signature() [2/4]

libdar::cat_delta_signature::cat_delta_signature | ( |  | ) |

inline

constructor to write an object to filesytem/backup (using dump_* methods later on)

Definition at line 106 of file cat_delta_signature.hpp.

## cat_delta_signature() [3/4]

libdar::cat_delta_signature::cat_delta_signature | ( | const cat_delta_signature & | ref | ) |

inline

copy constructor

Definition at line 109 of file cat_delta_signature.hpp.

## cat_delta_signature() [4/4]

libdar::cat_delta_signature::cat_delta_signature | ( | cat_delta_signature && | ref | ) |

inlinenoexcept

move constructor

Definition at line 112 of file cat_delta_signature.hpp.

## ~cat_delta_signature()

libdar::cat_delta_signature::~cat_delta_signature | ( |  | ) |

inline

destructor

Definition at line 121 of file cat_delta_signature.hpp.

## Member Function Documentation

## can_obtain_sig()

bool libdar::cat_delta_signature::can_obtain_sig | ( |  | ) | const

inline

the cat_delta_signature structure can only hold CRC without delta_signature, this call gives the situation about that point

Definition at line 134 of file cat_delta_signature.hpp.

References delta_sig_size, and libdar::infinint::is_zero().

Referenced by libdar::cat_file::has_delta_signature_available().

## clear()

void libdar::cat_delta_signature::clear | ( |  | ) |

inline

reset the object

Definition at line 201 of file cat_delta_signature.hpp.

Referenced by operator=().

## drop_sig()

void libdar::cat_delta_signature::drop_sig | ( |  | ) | const

inline

drop signature but keep metadata available

Note
  there is a lot of chance that a call to obtain_sig() will fail after drop_sig() has been called when in sequential read mode, due to the limited possibility to skip backward in that mode

Definition at line 150 of file cat_delta_signature.hpp.

References sig.

## dump_data()

void libdar::cat_delta_signature::dump_data | ( | generic_file & | f,
|  | bool | sequential_mode,
|  | const archive_version & | ver
| ) |  | const

write down the data eventually with sequential read mark followed by delta sig metadata

Note
  ver is only used to know which version to use for reading the data, but it is always written following the most recent supported archive format version

## has_patch_base_crc()

bool libdar::cat_delta_signature::has_patch_base_crc | ( |  | ) | const

inline

returns whether the object has a base patch CRC (s_delta status objects)

Definition at line 183 of file cat_delta_signature.hpp.

References patch_base_check.

## has_patch_result_crc()

bool libdar::cat_delta_signature::has_patch_result_crc | ( |  | ) | const

inline

returns whether the object has a CRC corresponding to data (for s_saved, s_delta, and when delta signature is present)

Definition at line 192 of file cat_delta_signature.hpp.

References patch_result_check.

## is_pending_read()

bool libdar::cat_delta_signature::is_pending_read | ( |  | ) | const

inline

tells whether the read() call has been invoked

Definition at line 126 of file cat_delta_signature.hpp.

References pending_read.

## obtain_sig()

std::shared_ptr< memory_file > libdar::cat_delta_signature::obtain_sig | ( | const archive_version & | ver | ) | const

provide a memory_file object which the caller has the duty to destroy after use

Note
  while drop_sig has not been called, obtain_sig() can be called any number of time
  in direct mode (not sequential_real mode) the first call to obtain_sig() fetches the data from the archive and loads it to memory.

## obtain_sig_block_size()

U_I libdar::cat_delta_signature::obtain_sig_block_size | ( |  | ) | const

inline

provide the block size used for delta signature

Definition at line 144 of file cat_delta_signature.hpp.

References sig_block_len.

## operator=() [1/2]

cat_delta_signature & libdar::cat_delta_signature::operator= | ( | cat_delta_signature && | ref | ) |

inlinenoexcept

move assignment operator

Definition at line 118 of file cat_delta_signature.hpp.

## operator=() [2/2]

cat_delta_signature & libdar::cat_delta_signature::operator= | ( | const cat_delta_signature & | ref | ) |

inline

assignement operator

Definition at line 115 of file cat_delta_signature.hpp.

References clear().

## read()

void libdar::cat_delta_signature::read | ( | bool | sequential_read,
|  | const archive_version & | ver
| ) |  |

read the metadata of the object from the generic_file given at construction time

Note
  in sequential read mode, the data is also read at that time and loaded into memory, thing which is done transparently by obtain_sig() when in direct access mode

## set_sig() [1/2]

void libdar::cat_delta_signature::set_sig | ( |  | ) |

inline

variante used when the delta_signature object will only contain CRCs (no delta signature)

Definition at line 168 of file cat_delta_signature.hpp.

References delta_sig_offset, delta_sig_size, sig, and sig_block_len.

## set_sig() [2/2]

void libdar::cat_delta_signature::set_sig | ( | const std::shared_ptr< memory_file > & | ptr,
|  | U_I | sig_block_size
| ) |  |

the object pointed to by ptr must stay available when calling dump_data()/dump_metadata() later on

Note
  sig_block_size is an additional information about the block size used to setup the signature, this is not the size of the signature!

## will_have_signature()

void libdar::cat_delta_signature::will_have_signature | ( |  | ) |

inline

give the object where to fetch from the delta signature, object must exist up to the next call to dump_data

Note
  seg_sig_ref() must be called each time before invoking dump_data(), normally it is done once... for can_obtain_sig() to return true before the signature is provided

Definition at line 159 of file cat_delta_signature.hpp.

References delta_sig_size.

## Member Data Documentation

## delta_sig_offset

infinint libdar::cat_delta_signature::delta_sig_offset

private

where to read sig_block_len followed by delta_sig_size bytes of data from which to setup "sig"

Definition at line 206 of file cat_delta_signature.hpp.

Referenced by set_sig().

## delta_sig_size

infinint libdar::cat_delta_signature::delta_sig_size

private

size of the data to setup "sig" (set to zero when reading in sequential mode, sig is then setup on-fly)

Definition at line 205 of file cat_delta_signature.hpp.

Referenced by can_obtain_sig(), set_sig(), and will_have_signature().

## patch_base_check

crc* libdar::cat_delta_signature::patch_base_check

private

associated CRC for the file this signature has been computed on, moved to cat_file since format 11.2, still need for older formats

Definition at line 204 of file cat_delta_signature.hpp.

Referenced by has_patch_base_crc().

## patch_result_check

crc* libdar::cat_delta_signature::patch_result_check

private

associated CRC

Definition at line 209 of file cat_delta_signature.hpp.

Referenced by has_patch_result_crc().

## pending_read

bool libdar::cat_delta_signature::pending_read

private

when the object has been created for read but data not yet read from archive

Definition at line 213 of file cat_delta_signature.hpp.

Referenced by is_pending_read().

## sig

std::shared_ptr<memory_file> libdar::cat_delta_signature::sig

mutableprivate

the signature data, if set nullptr it will be fetched from f in direct access mode only

Note
  delta_sig_offset is set to zero when read in sequential mode, sig is setup on-fly

Definition at line 208 of file cat_delta_signature.hpp.

Referenced by drop_sig(), and set_sig().

## sig_block_len

U_I libdar::cat_delta_signature::sig_block_len

mutableprivate

block length used within delta signature

Definition at line 212 of file cat_delta_signature.hpp.

Referenced by obtain_sig_block_size(), and set_sig().

## src

generic_file* libdar::cat_delta_signature::src

private

where to read data from

Definition at line 210 of file cat_delta_signature.hpp.

## zip

proto_compressor* libdar::cat_delta_signature::zip

private

needed to disable compression when reading delta signature data from an archive

Definition at line 211 of file cat_delta_signature.hpp.

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

- cat_delta_signature.hpp