CernVM-FS  2.13.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
subscriber_sse.h
Go to the documentation of this file.
1 
5 #ifndef CVMFS_NOTIFY_SUBSCRIBER_SSE_H_
6 #define CVMFS_NOTIFY_SUBSCRIBER_SSE_H_
7 
8 #include <string>
9 
10 #include "duplex_curl.h"
11 #include "subscriber.h"
12 #include "util/atomic.h"
13 
14 namespace notify {
15 
29 class SubscriberSSE : public Subscriber {
30  public:
31  explicit SubscriberSSE(const std::string &server_url);
32  virtual ~SubscriberSSE();
33 
34  virtual bool Subscribe(const std::string &topic);
35  virtual void Unsubscribe();
36 
37  private:
38  bool ShouldQuit() const;
39 
47  void AppendToBuffer(const std::string &s);
48 
49  void ClearBuffer();
50 
51  static size_t CurlRecvCB(void *buffer, size_t size, size_t nmemb,
52  void *userp);
53  static int CurlProgressCB(void *clientp, curl_off_t dltotal, curl_off_t dlnow,
54  curl_off_t ultotal, curl_off_t ulnow);
55 
56  std::string server_url_;
57  std::string topic_;
58  std::string buffer_;
59 
61 };
62 
63 } // namespace notify
64 
65 #endif // CVMFS_NOTIFY_SUBSCRIBER_SSE_H_
virtual void Unsubscribe()
static int CurlProgressCB(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow)
int32_t atomic_int32
Definition: atomic.h:17
void AppendToBuffer(const std::string &s)
atomic_int32 should_quit_
bool ShouldQuit() const
static size_t CurlRecvCB(void *buffer, size_t size, size_t nmemb, void *userp)
virtual bool Subscribe(const std::string &topic)
SubscriberSSE(const std::string &server_url)
static void size_t size
Definition: smalloc.h:54