1 |
// Syncify |
2 |
// |
3 |
// Douglas Thrift |
4 |
// |
5 |
// $Id$ |
6 |
|
7 |
#ifndef _Syncify_hpp_ |
8 |
#define _Syncify_hpp_ |
9 |
|
10 |
#include <menes/platform.hpp> |
11 |
|
12 |
#ifdef MENES_PRAGMA_ONCE |
13 |
#pragma once |
14 |
#endif |
15 |
|
16 |
#include <menes-api/console.hpp> |
17 |
#include <menes-api/files.hpp> |
18 |
#include <menes-api/locks.hpp> |
19 |
#include <menes-api/path.hpp> |
20 |
#include <menes-api/threads.hpp> |
21 |
#include <menes-etl/fnbind.hpp> |
22 |
#include <menes-ext/scopes.hpp> |
23 |
#include <menes-ext/stack.hpp> |
24 |
#include <menes-ext/string.hpp> |
25 |
#include <menes-ext/threadset.hpp> |
26 |
#include <menes-ios/helpers.hpp> |
27 |
|
28 |
#include <queue> |
29 |
#include <utility> |
30 |
|
31 |
#include "Matcher/Matcher.hpp" |
32 |
|
33 |
#include "Error.hpp" |
34 |
|
35 |
struct Syncify |
36 |
{ |
37 |
Syncify(const ext::String& local, const ext::String& remote, const ext::String& pattern); |
38 |
~Syncify(); |
39 |
struct Transfer |
40 |
{ |
41 |
ext::String local, remote; |
42 |
Transfer() {} |
43 |
Transfer(const ext::String& local, const ext::String& remote) : local(local), remote(remote) {} |
44 |
}; |
45 |
static ext::String program; |
46 |
static bool debug; |
47 |
Matcher pattern; |
48 |
std::queue<Transfer> transfers; |
49 |
api::ThreadMutex transfersLock; |
50 |
bool transfering; |
51 |
ext::ThreadPool<> transferers; |
52 |
void syncify(const api::Path& local, const ext::String& remote); |
53 |
int transfer(); |
54 |
}; |
55 |
|
56 |
#endif//_Syncify_hpp_ |