Line |
Branch |
Exec |
Source |
1 |
|
|
/** |
2 |
|
|
* This file is part of the CernVM File System. |
3 |
|
|
*/ |
4 |
|
|
|
5 |
|
|
#ifndef CVMFS_NOTIFY_MESSAGES_H_ |
6 |
|
|
#define CVMFS_NOTIFY_MESSAGES_H_ |
7 |
|
|
|
8 |
|
|
#include <string> |
9 |
|
|
|
10 |
|
|
namespace notify { |
11 |
|
|
|
12 |
|
|
namespace msg { |
13 |
|
|
|
14 |
|
|
enum Version { |
15 |
|
|
kProtocolVersion = 1 |
16 |
|
|
}; |
17 |
|
|
|
18 |
|
|
/** |
19 |
|
|
* The base class of all notification messages |
20 |
|
|
* |
21 |
|
|
* All notifications inherit from this base class and need to implement |
22 |
|
|
* the JSON serialization and deserialization methods. |
23 |
|
|
*/ |
24 |
|
|
class Message { |
25 |
|
|
public: |
26 |
|
|
virtual void ToJSONString(std::string *s) = 0; |
27 |
|
|
virtual bool FromJSONString(const std::string &s) = 0; |
28 |
|
|
|
29 |
|
12 |
virtual ~Message() { } |
30 |
|
|
}; |
31 |
|
|
|
32 |
|
|
/** |
33 |
|
|
* Activity notification |
34 |
|
|
* |
35 |
|
|
* The activity message informs about the current revision of a repository. It |
36 |
|
|
* contains a timestamp, repository name and the repository manifest. |
37 |
|
|
*/ |
38 |
|
|
class Activity : public Message { |
39 |
|
|
public: |
40 |
|
|
Activity(); |
41 |
|
|
virtual ~Activity(); |
42 |
|
|
|
43 |
|
|
bool operator==(const Activity &other) const; |
44 |
|
|
|
45 |
|
|
virtual void ToJSONString(std::string *s); |
46 |
|
|
virtual bool FromJSONString(const std::string &s); |
47 |
|
|
|
48 |
|
|
int version_; |
49 |
|
|
std::string timestamp_; |
50 |
|
|
std::string repository_; |
51 |
|
|
std::string manifest_; |
52 |
|
|
}; |
53 |
|
|
|
54 |
|
|
} // namespace msg |
55 |
|
|
|
56 |
|
|
} // namespace notify |
57 |
|
|
|
58 |
|
|
#endif // CVMFS_NOTIFY_MESSAGES_H_ |
59 |
|
|
|