-
Notifications
You must be signed in to change notification settings - Fork 1
/
ManifestManager.h
49 lines (36 loc) · 1.05 KB
/
ManifestManager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef __MANIFESTMANAGER_H
#define __MANIFESTMANAGER_H
#include <wx/wx.h>
#include <wx/filename.h>
#include <wx/dir.h>
#include <wx/ffile.h>
#include <vector>
/* the number of ticks to wait between sending synch requests */
#define SYNC_INTERVAL 512
/* the number of manifests to send when an unsyncronised peer requests we check
* their sync */
#define MANIFEST_CHUNKS 32
#include "Message.h"
namespace RAIN
{
class ManifestEntry;
class ManifestManager : public RAIN::MessageHandler
{
public:
ManifestManager();
~ManifestManager();
void HandleMessage(RAIN::Message *msg);
void Tick();
int GetMessageHandlerID();
size_t GetAllManifests(std::vector<RAIN::ManifestEntry*>& v);
private:
off_t tickCount;
void MergeManifests(RAIN::Message *m);
void CheckSynchronise(RAIN::Message *m);
void Synchronise();
wxString getManifestDir();
size_t getManifestsAfter(std::vector<RAIN::ManifestEntry*>& v, time_t after, int n);
time_t getLatestTimestamp();
};
}
#endif//__MANIFESTMANAGER_H