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

class cat_signature combines the cat_entree::signature() of the object with its saved_status and read and store this combinason More...

#include <cat_signature.hpp>

+ Collaboration diagram for libdar::cat_signature:

Public Member Functions

 cat_signature (unsigned char original, saved_status status)
 set a signature from running libdar
 
 cat_signature (generic_file &f, const archive_version &reading_ver)
 set a signature from an disk archive
 
bool read (generic_file &f, const archive_version &reading_ver)
 read a signature from archive for an existing cat_signature object (overwrite its value) More...
 
void write (generic_file &f)
 
bool get_base_and_status (unsigned char &base, saved_status &saved) const
 provide typ and status as read from the archive More...
 

Static Public Member Functions

static bool compatible_signature (unsigned char a, unsigned char b)
 

Private Attributes

unsigned char field
 stores file type and status information More...
 

Static Private Attributes

static constexpr U_8 SAVED_FAKE_BIT = 0x80
 
static constexpr U_8 SAVED_NON_DELTA_BIT = 0x40
 

Detailed Description

class cat_signature combines the cat_entree::signature() of the object with its saved_status and read and store this combinason

historically these two fields were saved on a single byte, but as libdar received new feature it was to narrow where from this class to transparently manage this field evolution

Definition at line 48 of file cat_signature.hpp.

Member Function Documentation

◆ get_base_and_status()

bool libdar::cat_signature::get_base_and_status ( unsigned char &  base,
saved_status saved 
) const

provide typ and status as read from the archive

Parameters
[out]basethe signature() of the entry
[out]savedthe get_saved_status() of the entry
Returns
false if the field read from the archive is malformed, in which case the returned argument are meaningless

◆ read()

bool libdar::cat_signature::read ( generic_file f,
const archive_version reading_ver 
)

read a signature from archive for an existing cat_signature object (overwrite its value)

Parameters
[in]fwhere to read data from
[in]reading_verwhich format to expect
Returns
true if data could be read, false else.
Note
the validity of the read data is not checked at that time but a the time get_base_and_status() is called

Member Data Documentation

◆ field

unsigned char libdar::cat_signature::field
private

stores file type and status information

Note
this field "field" stores two types of information: Historically, the type was stored as different letters, then the differential backup has been added and the saved/not_saved status appeared as uppercase for not_saved status and lowercase for saved status (backward compatibility)

adding features after features, the FAKE status used in isolated catalogues used the bit 8 (ASCII used 7 lower bits only).

but while adding the delta-diff feature it has been realized that 3 bits could be used beside information type to store the status thanks to the way ASCI encodes letters: the 5 lower bits encode the letter nature, remains the bits 6, 7 and 8 to encode the status of the inode:

Definition at line 107 of file cat_signature.hpp.


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