45#define DEBUG_RECURSIVE_FILE_COPY
48#define FAKE_HOSTNAME "internal_fake_host"
51#define LOG(s) CLASS_EMERGENCY_LOG(program_wide_logger::get(), s)
53#define BASE_LOG(s) EMERGENCY_LOG(program_wide_logger::get(), s)
55#define RETURN_ERROR_RFC(msg, err) { \
88 const astring transfer_name =
"snootums";
90 astring source_root = transfer_name;
91 if (source_start.
t()) {
124 if (!reply_from_init) {
125LOG(
"spewing list of what IS there...");
152 start_ret = ring_leader.
evaluate(comparison_req, req_id);
157 if (!reply_from_init) {
158LOG(
"spewing list of what IS there...");
169 if (!diffs.
unpack(pack_copy)) {
181 outcome ini_resp_ret = client_spider.
evaluate(reply_from_init, resp_id);
193#ifdef DEBUG_RECURSIVE_FILE_COPY
210 .acquire_specific_result(chunk_id);
216 +
"\" to \"" + target_dir +
"\"");
221 while (
copy.length()) {
a_sprintf is a specialization of astring that provides printf style support.
Provides a dynamically resizable ASCII character string.
bool t() const
t() is a shortcut for the string being "true", as in non-empty.
A very common template for a dynamic array of bytes.
static const char * outcome_name(const outcome &to_name)
Returns a string representation of the outcome "to_name".
Outcomes describe the state of completion for an operation.
An object that traverses directory trees and provides a view of all files.
bool calculate(bool just_size)
visits each file in the directory_tree and calculates its attributes.
virtual bool unpack(basis::byte_array &packed_form)
Restores the packable from the "packed_form".
static basis::astring default_separator()
returns the default separator character for this OS.
basis::astring text_form() const
Base objects used by the file transfer tentacle to schedule transfers.
@ BUILD_TARGET_TREE
asks the target side to build the directory tree from the source.
@ CONCLUDE_TRANSFER_MARKER
this infoton marks the end of the transfer process.
@ PLACE_FILE_CHUNKS
the destination side requests a new set of chunks.
@ TREE_COMPARISON
the destination root will be compared with the source root.
basis::abyte _command
one of the commands above.
basis::outcome _success
reports what kind of result occurred.
basis::astring _src_root
the top-level directory of the source.
bool _request
if it's not a request, then it's a response.
basis::astring _dest_root
the top-level directory of the destination.
void package_tree_info(const filesystem::directory_tree &tree, const structures::string_array &includes)
prepares the packed data from the "tree" and "includes" list.
basis::byte_array _packed_data
the packed headers and file chunks.
Manages the transferrence of directory trees from one place to another.
basis::outcome add_correspondence(const basis::astring &source_mapping, const basis::astring &source_root, int refresh_interval)
adds a file transfer correspondence.
@ COMPARE_CONTENT_SAMPLE
samples parts of file for comparison.
basis::outcome register_file_transfer(const octopus_entity &ent, const basis::astring &src_root, const basis::astring &dest_root, const structures::string_array &include)
records a transfer that is going to commence.
An infoton is an individual request parcel with accompanying information.
Provides a way of identifying users of an octopus object.
Identifies requests made on an octopus by users.
Octopus is a design pattern for generalized request processing systems.
entity_data_bin & responses()
allows external access to our set of results.
basis::outcome add_tentacle(tentacle *to_add, bool filter=false)
hooks a tentacle in to provide processing of one type of infoton.
basis::outcome evaluate(infoton *request, const octopus_request_id &item_id, bool now=false)
tries to process the "request" using the current set of tentacles.
octopus_entity issue_identity()
creates an entity identifier that is unique for this octopus.
infoton * acquire_specific_result(const octopus_request_id &original_id)
supports seeking the result for a specific request.
static const char * outcome_name(const basis::outcome &to_name)
static basis::outcome copy_hierarchy(int transfer_mode, const basis::astring &source_dir, const basis::astring &target_dir, const structures::string_array &includes, const basis::astring &source_start=basis::astring::empty_string())
copies a directory hierarchy starting at "source_dir" into "target_dir".
virtual ~recursive_file_copy()
An array of strings with some additional helpful methods.
#define FUNCDEF(func_in)
FUNCDEF sets the name of a function (and plugs it into the callstack).
Implements an application lock to ensure only one is running at once.
The guards collection helps in testing preconditions and reporting errors.
const int MEGABYTE
Number of bytes in a megabyte.
const int HOUR_ms
Number of milliseconds in an hour.
A platform independent way to obtain the timestamp of a file.
A logger that sends to the console screen using the standard output device.
const int MAX_CHUNK_RFC_COPY_HIER
const int EXPECTED_MAXIMUM_TRANSFER_TIME
A dynamic container class that holds any kind of object via pointers.
#define RETURN_ERROR_RFC(msg, err)