Add John MucCullough's simple key/value storage server.
[bluesky.git] / kvstore / kvclient.h
diff --git a/kvstore/kvclient.h b/kvstore/kvclient.h
new file mode 100644 (file)
index 0000000..dfe86d2
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef _KVCLIENT_H_
+#define _KVCLIENT_H_ 1
+
+#include "kvstore.pb.h"
+#include "workqueue.h"
+#include "protobufrpc.h"
+
+using namespace bicker;
+
+namespace kvstore
+{
+    class KeyValueClientRouter;
+
+    class KeyValueClient
+    {
+    public:
+        KeyValueClient(const string& host,
+                       const string& port);
+
+        KeyValueClient(const list<string> &hosts);
+
+        bool Put(const string& key,
+                 const string& value);
+
+        bool Put(const string& key,
+                 const string& value,
+                 TaskNotification &tn);
+
+        bool Get(const string& key, string* value);
+
+        bool Get(const string& key,
+                 string* value,
+                 TaskNotification &tn);
+
+    private:
+        shared_ptr<KeyValueClientRouter> _router;
+    };
+} // namespace kvstore
+
+#endif