karazeh
A cross-platform software updating library.
kzh::delta_encoder Class Reference

librsync implementation of delta encoding, used in rdiff. More...

#include <delta_encoder.hpp>

+ Inheritance diagram for kzh::delta_encoder:
+ Collaboration diagram for kzh::delta_encoder:

Public Member Functions

 delta_encoder ()
 
virtual ~delta_encoder ()
 
rs_result delta (path_t const &signature, path_t const &new_file, path_t const &delta)
 
rs_result patch (path_t const &basis, path_t const &delta, path_t const &target)
 
rs_result signature (path_t const &basis, path_t const &signature)
 
- Public Member Functions inherited from kzh::logger
 logger (string_t context)
 
virtual ~logger ()
 
logstream alert () const
 
logstream crit () const
 
logstream debug () const
 
logstream error () const
 
logstream info () const
 
logstream notice () const
 
logstream plain () const
 
void set_uuid_prefix (string_t const &)
 
string_t const & uuid_prefix () const
 
logstream warn () const
 

Protected Attributes

file_manager file_manager_
 used for validating paths and file permissions More...
 

Additional Inherited Members

- Static Public Member Functions inherited from kzh::logger
static void deindent ()
 
static void enable_timestamps (bool on_or_off)
 
static void indent ()
 
static void mute ()
 
static void set_app_name (string_t const &app_name)
 
static void set_stream (std::ostream *)
 
static void set_threshold (char level)
 
static void unmute ()
 
- Protected Member Functions inherited from kzh::logger
void rename_context (string_t const &)
 

Detailed Description

librsync implementation of delta encoding, used in rdiff.

Constructor & Destructor Documentation

kzh::delta_encoder::delta_encoder ( )
kzh::delta_encoder::~delta_encoder ( )
virtual

Member Function Documentation

rs_result kzh::delta_encoder::delta ( path_t const &  signature,
path_t const &  new_file,
path_t const &  delta 
)

Generates a delta patch based on the given signature and the new file.

Parameters
signaturethe signature of the basis file, generatable using signature()
new_filethe new version of basis
deltapath to where the delta file will be stored
Returns
the status of rs_delta_file() (
See also
man rdiff)
Exceptions
kzh::invalid_resourceif basis does not exist or is unreadable
kzh::invalid_resourceif delta does not exist or is unreadable
kzh::invalid_stateif target destination is unwritable

References file_manager_, kzh::file_manager::is_readable(), and kzh::file_manager::is_writable().

Referenced by TEST_CASE().

rs_result kzh::delta_encoder::patch ( path_t const &  basis,
path_t const &  delta,
path_t const &  target 
)

Applies a patch on the basis file and stores it somewhere else.

Parameters
basisthe base file to patch
deltathe delta to patch the basis with, generatable using delta()
targetthe destination where the patched file will be stored
Returns
the status of rs_patch_file() (
See also
man rdiff)
Exceptions
kzh::invalid_resourceif basis does not exist or is unreadable
kzh::invalid_resourceif delta does not exist or is unreadable
kzh::invalid_stateif target destination is unwritable

References file_manager_, kzh::file_manager::is_readable(), and kzh::file_manager::is_writable().

Referenced by kzh::update_operation::deploy(), and TEST_CASE().

rs_result kzh::delta_encoder::signature ( path_t const &  basis,
path_t const &  signature 
)

Generates the signature from the basis file.

Parameters
basispath to the file you want to generate the signature for
signaturepath to where the signature file should be stored
Returns
the status of rs_sig_file() (
See also
man rdiff)
Exceptions
kzh::invalid_resourceif basis does not exist or is unreadable
kzh::invalid_stateif signature is not writable

References file_manager_, kzh::file_manager::is_readable(), and kzh::file_manager::is_writable().

Referenced by kzh::update_operation::stage(), and TEST_CASE().

Member Data Documentation

file_manager kzh::delta_encoder::file_manager_
protected

used for validating paths and file permissions

Referenced by delta(), patch(), and signature().


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