pulsar-client-cpp
TableView.h
1 
19 #ifndef TABEL_VIEW_HPP_
20 #define TABEL_VIEW_HPP_
21 
22 #include <pulsar/Result.h>
23 #include <pulsar/TableViewConfiguration.h>
24 #include <pulsar/defines.h>
25 
26 #include <functional>
27 #include <unordered_map>
28 
29 namespace pulsar {
30 
31 class TableViewImpl;
32 
33 typedef std::function<void(Result result)> ResultCallback;
34 typedef std::function<void(const std::string& key, const std::string& value)> TableViewAction;
38 class PULSAR_PUBLIC TableView {
39  public:
43  TableView();
44 
69  bool retrieveValue(const std::string& key, std::string& value);
70 
78  bool getValue(const std::string& key, std::string& value) const;
79 
85  bool containsKey(const std::string& key) const;
86 
90  std::unordered_map<std::string, std::string> snapshot();
91 
95  std::size_t size() const;
96 
101  void forEach(TableViewAction action);
102 
107  void forEachAndListen(TableViewAction action);
108 
112  void closeAsync(ResultCallback callback);
113 
117  Result close();
118 
119  private:
120  typedef std::shared_ptr<TableViewImpl> TableViewImplPtr;
121  TableViewImplPtr impl_;
122  explicit TableView(TableViewImplPtr);
123 
124  friend class PulsarFriend;
125  friend class ClientImpl;
126 };
127 } // namespace pulsar
128 
129 #endif /* TABEL_VIEW_HPP_ */
pulsar::Result
Result
Definition: Result.h:31
pulsar::TableView
Definition: TableView.h:38
pulsar
Definition: Authentication.h:31
pulsar::ResultCallback
std::function< void(Result result)> ResultCallback
Callback definition for non-data operation.
Definition: ConsumerConfiguration.h:50