* which will upload it to the remote server. */
RemoteFile *RemoteStore::alloc_file(const string &name, const string &type)
{
- fprintf(stderr, "Allocate file: %s\n", name.c_str());
pthread_mutex_lock(&lock);
files_outstanding++;
pthread_mutex_unlock(&lock);
* responsible for its destruction. */
void RemoteStore::enqueue(RemoteFile *file)
{
- fprintf(stderr, "Enqueue: %s\n", file->remote_path.c_str());
-
pthread_mutex_lock(&lock);
while (transfer_queue.size() >= MAX_QUEUE_SIZE)
/* Wait for all transfers to finish. */
void RemoteStore::sync()
{
- fprintf(stderr, "RemoteStore::sync() start\n");
pthread_mutex_lock(&lock);
while (busy)
pthread_cond_wait(&cond, &lock);
pthread_mutex_unlock(&lock);
- fprintf(stderr, "RemoteStore::sync() end\n");
}
void *RemoteStore::start_transfer_thread(void *arg)
pthread_mutex_unlock(&lock);
// Transfer the file
- fprintf(stderr, "Start transfer: %s\n", file->remote_path.c_str());
if (backup_script != "") {
pid_t pid = fork();
if (pid < 0) {
file->local_path.c_str());
}
}
- fprintf(stderr, "Finish transfer: %s\n", file->remote_path.c_str());
delete file;
}
for (list<string>::iterator i = includes.begin();
i != includes.end(); ++i) {
if (path == *i) {
- printf("Including %s\n", path.c_str());
include = true;
}
}
for (list<string>::iterator i = excludes.begin();
i != excludes.end(); ++i) {
if (path == *i) {
- printf("Excluding %s\n", path.c_str());
include = false;
}
}
for (list<string>::iterator i = searches.begin();
i != searches.end(); ++i) {
if (path == *i) {
- printf("Scanning %s\n", path.c_str());
scan_only = true;
}
}
* themselves are excluded from being backed up. */
void add_include(const char *path)
{
- printf("Add: %s\n", path);
/* Was an absolute path specified? If so, we'll need to start scanning
* from the root directory. Make sure that the user was consistent in
* providing either all relative paths or all absolute paths. */
return 1;
}
- // Dump paths for debugging/informational purposes
- {
- list<string>::const_iterator i;
-
- printf("LBS Version: %s\n", lbs_version);
-
- printf("--dest=%s\n--localdb=%s\n--upload-script=%s\n",
- backup_dest.c_str(), localdb_dir.c_str(), backup_script.c_str());
-
- printf("Includes:\n");
- for (i = includes.begin(); i != includes.end(); ++i)
- printf(" %s\n", i->c_str());
-
- printf("Excludes:\n");
- for (i = excludes.begin(); i != excludes.end(); ++i)
- printf(" %s\n", i->c_str());
-
- printf("Searching:\n");
- for (i = searches.begin(); i != searches.end(); ++i)
- printf(" %s\n", i->c_str());
- }
-
block_buf = new char[LBS_BLOCK_SIZE];
/* Initialize the remote storage layer. If using an upload script, create