CernVM-FS  2.9.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 "subscriber.h"
9 
10 #include <string>
11 
12 #include "atomic.h"
13 #include "duplex_curl.h"
14 
15 namespace notify {
16 
30 class SubscriberSSE : public Subscriber {
31  public:
32  explicit SubscriberSSE(const std::string& server_url);
33  virtual ~SubscriberSSE();
34 
35  virtual bool Subscribe(const std::string& topic);
36  virtual void Unsubscribe();
37 
38  private:
39  bool ShouldQuit() const;
40 
48  void AppendToBuffer(const std::string& s);
49 
50  void ClearBuffer();
51 
52  static size_t CurlRecvCB(void* buffer, size_t size, size_t nmemb,
53  void* userp);
54  static int CurlProgressCB(void* clientp, curl_off_t dltotal, curl_off_t dlnow,
55  curl_off_t ultotal, curl_off_t ulnow);
56 
57  std::string server_url_;
58  std::string topic_;
59  std::string buffer_;
60 
62 };
63 
64 } // namespace notify
65 
66 #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:47