karazeh
A cross-platform software updating library.
|
#include <create.hpp>
Public Member Functions | |
create_operation (config_t const &, release_manifest const &) | |
virtual | ~create_operation () |
virtual void | commit () |
virtual STAGE_RC | deploy () |
void | marked_for_deletion () |
virtual void | rollback () |
virtual STAGE_RC | stage () |
virtual string_t | tostring () |
Public Member Functions inherited from kzh::operation | |
operation (config_t const &config, release_manifest const &rm) | |
virtual | ~operation () |
Public Attributes | |
string_t | dst_path |
bool | is_executable |
string_t | src_checksum |
uint64_t | src_size |
string_t | src_uri |
Protected Member Functions | |
path_t | get_destination () const |
bool | has_deployed () const |
Protected Member Functions inherited from kzh::logger | |
void | rename_context (string_t const &) |
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 |
Additional Inherited Members | |
Static Protected 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 Attributes inherited from kzh::operation | |
config_t const & | config_ |
release_manifest const & | rm_ |
kzh::create_operation::create_operation | ( | config_t const & | config, |
release_manifest const & | rm | ||
) |
|
virtual |
|
virtual |
Purging is handy for operations that use the Karazeh cache while deploying or staging. When an operation is called to commit, it is guaranteed that the patch has been rolled out successfully and any transient data will not be needed (no rollback will be invoked).
The cache is used for operations that require storing some data in a safe place only for the use of rollbacks if required, but should otherwise be discarded.
Reimplemented from kzh::operation.
References kzh::operation::config_, kzh::file_manager::exists(), kzh::KARAZEH_EXPORT::file_manager, kzh::KARAZEH_EXPORT::hasher, kzh::hasher::hex_digest(), kzh::file_manager::remove_file(), and src_checksum.
Referenced by TEST_CASE().
|
virtual |
When all operations are staged, they are called to deploy their changes and do whatever is necessary now that they have their resources.
Failure at the deploy stage will incur a rollback() on all the patch operations that have been deployted and/or staged.
Implements kzh::operation.
References kzh::operation::config_, kzh::logger::debug(), kzh::hasher::digest_rc::digest, dst_path, kzh::logger::error(), kzh::KARAZEH_EXPORT::file_manager, kzh::KARAZEH_EXPORT::hasher, kzh::hasher::hex_digest(), kzh::logger::info(), is_executable, kzh::file_manager::is_readable(), kzh::file_manager::is_writable(), kzh::file_manager::make_executable(), kzh::file_manager::move(), kzh::KARAZEH_EXPORT::root_path, src_checksum, kzh::STAGE_FILE_EXISTS, kzh::STAGE_FILE_INTEGRITY_MISMATCH, kzh::STAGE_OK, and kzh::STAGE_UNAUTHORIZED.
Referenced by TEST_CASE().
|
protected |
References kzh::operation::config_, dst_path, and kzh::KARAZEH_EXPORT::root_path.
Referenced by has_deployed(), and rollback().
|
protected |
References kzh::operation::config_, kzh::file_manager::exists(), kzh::KARAZEH_EXPORT::file_manager, get_destination(), kzh::KARAZEH_EXPORT::hasher, kzh::hasher::hex_digest(), and src_checksum.
Referenced by rollback().
void kzh::create_operation::marked_for_deletion | ( | ) |
Referenced by kzh::version_manifest::get_available_updates(), and TEST_CASE().
|
virtual |
Rolling-back ALL the changes that have been made to the repository while stage()ing or deploy()ing.
Use internal flags or members to keep track of the changes you make if necessary. rollback() might be invoked after operation::stage(), operation::deploy(), or neither!
Implements kzh::operation.
References kzh::operation::config_, kzh::KARAZEH_EXPORT::file_manager, get_destination(), has_deployed(), kzh::file_manager::is_empty(), kzh::file_manager::move(), and kzh::file_manager::remove_directory().
Referenced by TEST_CASE().
|
virtual |
Downloads the file from src_uri and stores it in the staging temporary repository. If an integrity mismatch occurs, the file will be re-downloaded up to resource_manager::download_retries times.
The following conditions must be met for the staging to be successful:
kzh::invalid_resource | if the file couldn't be DLed |
Returns STAGE_OK on success, otherwise an error indicated by the return code, see karazeh/operation.hpp for a complete listing.
Implements kzh::operation.
References kzh::KARAZEH_EXPORT::cache_path, kzh::operation::config_, kzh::file_manager::create_directory(), kzh::logger::debug(), kzh::logger::deindent(), kzh::KARAZEH_EXPORT::downloader, dst_path, kzh::file_manager::ensure_directory(), kzh::logger::error(), kzh::file_manager::exists(), kzh::downloader::fetch(), kzh::KARAZEH_EXPORT::file_manager, kzh::release_manifest::id, kzh::logger::indent(), kzh::file_manager::is_readable(), kzh::file_manager::is_writable(), kzh::operation::rm_, kzh::KARAZEH_EXPORT::root_path, src_checksum, src_size, src_uri, kzh::STAGE_FILE_EXISTS, kzh::STAGE_OK, kzh::STAGE_UNAUTHORIZED, and kzh::KARAZEH_EXPORT::verbose.
Referenced by TEST_CASE().
|
virtual |
Used internally for exceptions and logging
Reimplemented from kzh::operation.
References dst_path, src_checksum, src_size, and src_uri.
string_t kzh::create_operation::dst_path |
Referenced by deploy(), kzh::version_manifest::get_available_updates(), get_destination(), stage(), TEST_CASE(), and tostring().
bool kzh::create_operation::is_executable |
Referenced by deploy(), kzh::version_manifest::get_available_updates(), and TEST_CASE().
string_t kzh::create_operation::src_checksum |
Referenced by commit(), deploy(), kzh::version_manifest::get_available_updates(), has_deployed(), stage(), TEST_CASE(), and tostring().
uint64_t kzh::create_operation::src_size |
Referenced by kzh::version_manifest::get_available_updates(), stage(), TEST_CASE(), and tostring().
string_t kzh::create_operation::src_uri |
Referenced by kzh::version_manifest::get_available_updates(), stage(), TEST_CASE(), and tostring().