GCC Code Coverage Report


Directory: cvmfs/
File: cvmfs/notify/subscriber.h
Date: 2024-04-28 02:33:07
Exec Total Coverage
Lines: 0 3 0.0%
Branches: 0 0 -%

Line Branch Exec Source
1 /**
2 * This file is part of the CernVM File System.
3 */
4
5 #ifndef CVMFS_NOTIFY_SUBSCRIBER_H_
6 #define CVMFS_NOTIFY_SUBSCRIBER_H_
7
8 #include <string>
9
10 namespace notify {
11
12 /**
13 * Base class for creating a subscription to the notification system
14 */
15 class Subscriber {
16 public:
17 enum Status {
18 kContinue,
19 kFinish,
20 kError,
21 };
22
23 Subscriber() {}
24 virtual ~Subscriber() {}
25
26 /**
27 * Subscribe to a specific message topic
28 *
29 * The only topics currently used by the notification system are repository
30 * names. The subscription delivers activity messages containing the current
31 * repository manifest. Returns false if an error occurred.
32 */
33 virtual bool Subscribe(const std::string& topic) = 0;
34
35 /**
36 * Unsubscribe
37 *
38 * Cancel an active subscription
39 */
40 virtual void Unsubscribe() {}
41
42 protected:
43 /**
44 * Consume a message
45 *
46 * Consume the message and return the status value that can be used
47 * to exit the subscription loop.
48 */
49 virtual Status Consume(const std::string& topic,
50 const std::string& msg_text) = 0;
51 };
52
53 } // namespace notify
54
55 #endif // CVMFS_NOTIFY_SUBSCRIBER_H_
56