nitlog: oops, didn't deal properly with posts in months that haven't
[wvapps.git] / wvsync / wvsyncarbiter.h
blob34d0a2e46d93708147b17c780ec2412490e3580b
1 /*
2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2004 Net Integration Technologies, Inc.
5 * WvSyncArbiter makes decisions based on input WvSyncObj's. This is the
6 * brains of WvSync.
8 */
10 #ifndef __WVSYNCARBITER_H
11 #define __WVSYNCARBITER_H
13 #include <wvlog.h>
15 class UniConf;
16 class WvSyncObj;
18 class WvSyncArbiter
20 public:
21 WvSyncArbiter()
22 : log("Sync Arbiter", WvLog::Debug), err(log.split(WvLog::Error))
25 /** arblocal() takes a UniConf handle and a WvSyncObj representing a
26 * local object. If the object was already mentioned in the UniConf
27 * tree, then we know this isn't a *new* object. If it is new, we add
28 * it to the tree. We get the librsync signature for the object, and
29 * store it and a few other tidbits in the tree as well. arbremote()
30 * uses this info.
32 * The librsync signature is shoved into sigbuf.
34 * returns true if all is well, and false if getsig failed, implying
35 * the data couldn't be read.
37 bool arblocal(UniConf &root, WvSyncObj &obj, WvBuf &sigbuf);
39 /** arbremote() takes a UniConf handle and a WvSyncObj representing a
40 * local object. It also takes various information from the remote
41 * WvSync node about the same object. The goal of this function is to
42 * decide what needs to happen in the *exact* same way that this
43 * function decides on the remote node. This is harder than it sounds.
45 * returns true if we need to request a delta for this object from the
46 * remote side, and false if we don't. (if false, the other side may
47 * request one from us!)
49 bool arbremote(UniConf &root, WvSyncObj &obj,
50 WvStringParm remact, WvStringParm remmeta, time_t remmtime,
51 WvStringParm remmd5sig);
53 private:
54 WvLog log, err;
56 /** these are helpers for arbremote()
58 void arbr_win(UniConf &root, WvSyncObj &obj,
59 WvStringParm remact, WvStringParm remmeta, time_t remmtime,
60 WvStringParm remmd5sig);
61 void arbr_lose(UniConf &root, WvSyncObj &obj,
62 WvStringParm remact, WvStringParm remmeta, time_t remmtime,
63 WvStringParm remmd5sig);
64 bool arbr_conflict(UniConf &root, WvSyncObj &obj,
65 WvStringParm remact, WvStringParm remmeta,
66 time_t remmtime, WvStringParm remmd5sig);
67 bool arbr_ok(UniConf &root, WvSyncObj &obj,
68 WvStringParm remact, WvStringParm remmeta, time_t remmtime,
69 WvStringParm remmd5sig);
70 bool arbr_mod(UniConf &root, WvSyncObj &obj,
71 WvStringParm remact, WvStringParm remmeta, time_t remmtime,
72 WvStringParm remmd5sig);
73 bool arbr_meta(UniConf &root, WvSyncObj &obj,
74 WvStringParm remact, WvStringParm remmeta, time_t remmtime,
75 WvStringParm remmd5sig);
76 bool arbr_del(UniConf &root, WvSyncObj &obj,
77 WvStringParm remact, WvStringParm remmeta, time_t remmtime,
78 WvStringParm remmd5sig);
81 #endif // __WVSYNCARBITER_H