{"action":"created","comment":{"url":"https://api.github.com/repos/imzhenyu/rocksdb/pulls/comments/49185659","id":49185659,"diff_hunk":"@@ -0,0 +1,54 @@\n+#pragma once\n+\n+#include <string>\n+#include \"rrdb_error.h\"\n+\n+namespace dsn { namespace apps {\n+\n+// irrdb_client is the base class that users use to access a specific cluster.\n+// user can't create an instance, instead, they should get an instace through client_factory::get_context(const char* cluster_name),\n+// and destroy through client_factory::drop_context(client* context);\n+//\n+// the class of client provides the basic operation to:\n+// set/get/delete the value of a key in a app.\n+\n+class irrdb_client\n+{\n+public:\n+    // destructor\n+    virtual ~irrdb_client(){}\n+\n+    virtual const char* get_cluster_name() const = 0;\n+    virtual const char* get_app_name() const = 0;\n+\n+    virtual int set(\n+        const std::string& hashkey,\n+        const std::string& sortkey,\n+        const std::string& value,\n+        int timeout_milliseconds = 5000\n+        ) = 0;\n+\n+    virtual int get(\n+        const std::string& hashkey,\n+        const std::string& sortkey,\n+        std::string& value,\n+        int timeout_milliseconds = 5000\n+        ) = 0;\n+\n+    virtual int del(\n+        const std::string& hashkey,\n+        const std::string& sortkey,\n+        int timeout_milliseconds = 5000\n+        ) = 0;\n+\n+    virtual const char* get_error_string(int error_code) const = 0;\n+};\n+\n+class rrdb_client_factory\n+{\n+public:\n+  static bool initialize(const char* config_file);\n+  static irrdb_client* get_client(const char* app_name, const char* cluster_name = \"\");","path":"replication/client_lib/include/rrdb_client.h","position":51,"original_position":51,"commit_id":"ac70b81983d91d08e88d6a26c99b9d8489fd4930","original_commit_id":"a5438034214c71da82a9c35e65e57bab5b1487ee","user":{"login":"xiaotz","id":10770438,"avatar_url":"https://avatars.githubusercontent.com/u/10770438?v=3","gravatar_id":"","url":"https://api.github.com/users/xiaotz","html_url":"https://github.com/xiaotz","followers_url":"https://api.github.com/users/xiaotz/followers","following_url":"https://api.github.com/users/xiaotz/following{/other_user}","gists_url":"https://api.github.com/users/xiaotz/gists{/gist_id}","starred_url":"https://api.github.com/users/xiaotz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xiaotz/subscriptions","organizations_url":"https://api.github.com/users/xiaotz/orgs","repos_url":"https://api.github.com/users/xiaotz/repos","events_url":"https://api.github.com/users/xiaotz/events{/privacy}","received_events_url":"https://api.github.com/users/xiaotz/received_events","type":"User","site_admin":false},"body":"the instances are not going to destroy because there will be only a few instances be created.","created_at":"2016-01-08T13:02:28Z","updated_at":"2016-01-08T13:02:28Z","html_url":"https://github.com/imzhenyu/rocksdb/pull/6#discussion_r49185659","pull_request_url":"https://api.github.com/repos/imzhenyu/rocksdb/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/imzhenyu/rocksdb/pulls/comments/49185659"},"html":{"href":"https://github.com/imzhenyu/rocksdb/pull/6#discussion_r49185659"},"pull_request":{"href":"https://api.github.com/repos/imzhenyu/rocksdb/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/imzhenyu/rocksdb/pulls/6","id":55091691,"html_url":"https://github.com/imzhenyu/rocksdb/pull/6","diff_url":"https://github.com/imzhenyu/rocksdb/pull/6.diff","patch_url":"https://github.com/imzhenyu/rocksdb/pull/6.patch","issue_url":"https://api.github.com/repos/imzhenyu/rocksdb/issues/6","number":6,"state":"open","locked":false,"title":"add rrdb client lib","user":{"login":"xiaotz","id":10770438,"avatar_url":"https://avatars.githubusercontent.com/u/10770438?v=3","gravatar_id":"","url":"https://api.github.com/users/xiaotz","html_url":"https://github.com/xiaotz","followers_url":"https://api.github.com/users/xiaotz/followers","following_url":"https://api.github.com/users/xiaotz/following{/other_user}","gists_url":"https://api.github.com/users/xiaotz/gists{/gist_id}","starred_url":"https://api.github.com/users/xiaotz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xiaotz/subscriptions","organizations_url":"https://api.github.com/users/xiaotz/orgs","repos_url":"https://api.github.com/users/xiaotz/repos","events_url":"https://api.github.com/users/xiaotz/events{/privacy}","received_events_url":"https://api.github.com/users/xiaotz/received_events","type":"User","site_admin":false},"body":"Hi, @imzhenyu , I just added a rocksdb client lib which is going to be used by our cusomer.\r\nno sure if this is the proper position to put it.\r\nplease also help to review.\r\n\r\nthanks.","created_at":"2016-01-05T13:36:40Z","updated_at":"2016-01-08T13:02:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dfd15e5cad6b9ec0bf33c4dc5e19d2961a0b4de6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/imzhenyu/rocksdb/pulls/6/commits","review_comments_url":"https://api.github.com/repos/imzhenyu/rocksdb/pulls/6/comments","review_comment_url":"https://api.github.com/repos/imzhenyu/rocksdb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/imzhenyu/rocksdb/issues/6/comments","statuses_url":"https://api.github.com/repos/imzhenyu/rocksdb/statuses/ac70b81983d91d08e88d6a26c99b9d8489fd4930","head":{"label":"xiaotz:pegasus","ref":"pegasus","sha":"ac70b81983d91d08e88d6a26c99b9d8489fd4930","user":{"login":"xiaotz","id":10770438,"avatar_url":"https://avatars.githubusercontent.com/u/10770438?v=3","gravatar_id":"","url":"https://api.github.com/users/xiaotz","html_url":"https://github.com/xiaotz","followers_url":"https://api.github.com/users/xiaotz/followers","following_url":"https://api.github.com/users/xiaotz/following{/other_user}","gists_url":"https://api.github.com/users/xiaotz/gists{/gist_id}","starred_url":"https://api.github.com/users/xiaotz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xiaotz/subscriptions","organizations_url":"https://api.github.com/users/xiaotz/orgs","repos_url":"https://api.github.com/users/xiaotz/repos","events_url":"https://api.github.com/users/xiaotz/events{/privacy}","received_events_url":"https://api.github.com/users/xiaotz/received_events","type":"User","site_admin":false},"repo":{"id":48533705,"name":"rocksdb","full_name":"xiaotz/rocksdb","owner":{"login":"xiaotz","id":10770438,"avatar_url":"https://avatars.githubusercontent.com/u/10770438?v=3","gravatar_id":"","url":"https://api.github.com/users/xiaotz","html_url":"https://github.com/xiaotz","followers_url":"https://api.github.com/users/xiaotz/followers","following_url":"https://api.github.com/users/xiaotz/following{/other_user}","gists_url":"https://api.github.com/users/xiaotz/gists{/gist_id}","starred_url":"https://api.github.com/users/xiaotz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xiaotz/subscriptions","organizations_url":"https://api.github.com/users/xiaotz/orgs","repos_url":"https://api.github.com/users/xiaotz/repos","events_url":"https://api.github.com/users/xiaotz/events{/privacy}","received_events_url":"https://api.github.com/users/xiaotz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/xiaotz/rocksdb","description":"rocksdb replicated using rDSN (simple mode)","fork":true,"url":"https://api.github.com/repos/xiaotz/rocksdb","forks_url":"https://api.github.com/repos/xiaotz/rocksdb/forks","keys_url":"https://api.github.com/repos/xiaotz/rocksdb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xiaotz/rocksdb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xiaotz/rocksdb/teams","hooks_url":"https://api.github.com/repos/xiaotz/rocksdb/hooks","issue_events_url":"https://api.github.com/repos/xiaotz/rocksdb/issues/events{/number}","events_url":"https://api.github.com/repos/xiaotz/rocksdb/events","assignees_url":"https://api.github.com/repos/xiaotz/rocksdb/assignees{/user}","branches_url":"https://api.github.com/repos/xiaotz/rocksdb/branches{/branch}","tags_url":"https://api.github.com/repos/xiaotz/rocksdb/tags","blobs_url":"https://api.github.com/repos/xiaotz/rocksdb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xiaotz/rocksdb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xiaotz/rocksdb/git/refs{/sha}","trees_url":"https://api.github.com/repos/xiaotz/rocksdb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xiaotz/rocksdb/statuses/{sha}","languages_url":"https://api.github.com/repos/xiaotz/rocksdb/languages","stargazers_url":"https://api.github.com/repos/xiaotz/rocksdb/stargazers","contributors_url":"https://api.github.com/repos/xiaotz/rocksdb/contributors","subscribers_url":"https://api.github.com/repos/xiaotz/rocksdb/subscribers","subscription_url":"https://api.github.com/repos/xiaotz/rocksdb/subscription","commits_url":"https://api.github.com/repos/xiaotz/rocksdb/commits{/sha}","git_commits_url":"https://api.github.com/repos/xiaotz/rocksdb/git/commits{/sha}","comments_url":"https://api.github.com/repos/xiaotz/rocksdb/comments{/number}","issue_comment_url":"https://api.github.com/repos/xiaotz/rocksdb/issues/comments{/number}","contents_url":"https://api.github.com/repos/xiaotz/rocksdb/contents/{+path}","compare_url":"https://api.github.com/repos/xiaotz/rocksdb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xiaotz/rocksdb/merges","archive_url":"https://api.github.com/repos/xiaotz/rocksdb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xiaotz/rocksdb/downloads","issues_url":"https://api.github.com/repos/xiaotz/rocksdb/issues{/number}","pulls_url":"https://api.github.com/repos/xiaotz/rocksdb/pulls{/number}","milestones_url":"https://api.github.com/repos/xiaotz/rocksdb/milestones{/number}","notifications_url":"https://api.github.com/repos/xiaotz/rocksdb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xiaotz/rocksdb/labels{/name}","releases_url":"https://api.github.com/repos/xiaotz/rocksdb/releases{/id}","created_at":"2015-12-24T08:29:35Z","updated_at":"2015-12-24T08:29:38Z","pushed_at":"2016-01-08T12:47:17Z","git_url":"git://github.com/xiaotz/rocksdb.git","ssh_url":"git@github.com:xiaotz/rocksdb.git","clone_url":"https://github.com/xiaotz/rocksdb.git","svn_url":"https://github.com/xiaotz/rocksdb","homepage":"http://rocksdb.org","size":55513,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"imzhenyu:master","ref":"master","sha":"c9e3d905bb59dee207b2cd3e1326c6f7d342447d","user":{"login":"imzhenyu","id":6927143,"avatar_url":"https://avatars.githubusercontent.com/u/6927143?v=3","gravatar_id":"","url":"https://api.github.com/users/imzhenyu","html_url":"https://github.com/imzhenyu","followers_url":"https://api.github.com/users/imzhenyu/followers","following_url":"https://api.github.com/users/imzhenyu/following{/other_user}","gists_url":"https://api.github.com/users/imzhenyu/gists{/gist_id}","starred_url":"https://api.github.com/users/imzhenyu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imzhenyu/subscriptions","organizations_url":"https://api.github.com/users/imzhenyu/orgs","repos_url":"https://api.github.com/users/imzhenyu/repos","events_url":"https://api.github.com/users/imzhenyu/events{/privacy}","received_events_url":"https://api.github.com/users/imzhenyu/received_events","type":"User","site_admin":false},"repo":{"id":43558683,"name":"rocksdb","full_name":"imzhenyu/rocksdb","owner":{"login":"imzhenyu","id":6927143,"avatar_url":"https://avatars.githubusercontent.com/u/6927143?v=3","gravatar_id":"","url":"https://api.github.com/users/imzhenyu","html_url":"https://github.com/imzhenyu","followers_url":"https://api.github.com/users/imzhenyu/followers","following_url":"https://api.github.com/users/imzhenyu/following{/other_user}","gists_url":"https://api.github.com/users/imzhenyu/gists{/gist_id}","starred_url":"https://api.github.com/users/imzhenyu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imzhenyu/subscriptions","organizations_url":"https://api.github.com/users/imzhenyu/orgs","repos_url":"https://api.github.com/users/imzhenyu/repos","events_url":"https://api.github.com/users/imzhenyu/events{/privacy}","received_events_url":"https://api.github.com/users/imzhenyu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/imzhenyu/rocksdb","description":"rocksdb replicated using rDSN (simple mode)","fork":true,"url":"https://api.github.com/repos/imzhenyu/rocksdb","forks_url":"https://api.github.com/repos/imzhenyu/rocksdb/forks","keys_url":"https://api.github.com/repos/imzhenyu/rocksdb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/imzhenyu/rocksdb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/imzhenyu/rocksdb/teams","hooks_url":"https://api.github.com/repos/imzhenyu/rocksdb/hooks","issue_events_url":"https://api.github.com/repos/imzhenyu/rocksdb/issues/events{/number}","events_url":"https://api.github.com/repos/imzhenyu/rocksdb/events","assignees_url":"https://api.github.com/repos/imzhenyu/rocksdb/assignees{/user}","branches_url":"https://api.github.com/repos/imzhenyu/rocksdb/branches{/branch}","tags_url":"https://api.github.com/repos/imzhenyu/rocksdb/tags","blobs_url":"https://api.github.com/repos/imzhenyu/rocksdb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/imzhenyu/rocksdb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/imzhenyu/rocksdb/git/refs{/sha}","trees_url":"https://api.github.com/repos/imzhenyu/rocksdb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/imzhenyu/rocksdb/statuses/{sha}","languages_url":"https://api.github.com/repos/imzhenyu/rocksdb/languages","stargazers_url":"https://api.github.com/repos/imzhenyu/rocksdb/stargazers","contributors_url":"https://api.github.com/repos/imzhenyu/rocksdb/contributors","subscribers_url":"https://api.github.com/repos/imzhenyu/rocksdb/subscribers","subscription_url":"https://api.github.com/repos/imzhenyu/rocksdb/subscription","commits_url":"https://api.github.com/repos/imzhenyu/rocksdb/commits{/sha}","git_commits_url":"https://api.github.com/repos/imzhenyu/rocksdb/git/commits{/sha}","comments_url":"https://api.github.com/repos/imzhenyu/rocksdb/comments{/number}","issue_comment_url":"https://api.github.com/repos/imzhenyu/rocksdb/issues/comments{/number}","contents_url":"https://api.github.com/repos/imzhenyu/rocksdb/contents/{+path}","compare_url":"https://api.github.com/repos/imzhenyu/rocksdb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/imzhenyu/rocksdb/merges","archive_url":"https://api.github.com/repos/imzhenyu/rocksdb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/imzhenyu/rocksdb/downloads","issues_url":"https://api.github.com/repos/imzhenyu/rocksdb/issues{/number}","pulls_url":"https://api.github.com/repos/imzhenyu/rocksdb/pulls{/number}","milestones_url":"https://api.github.com/repos/imzhenyu/rocksdb/milestones{/number}","notifications_url":"https://api.github.com/repos/imzhenyu/rocksdb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/imzhenyu/rocksdb/labels{/name}","releases_url":"https://api.github.com/repos/imzhenyu/rocksdb/releases{/id}","created_at":"2015-10-02T14:53:43Z","updated_at":"2015-12-10T06:04:50Z","pushed_at":"2016-01-08T12:47:18Z","git_url":"git://github.com/imzhenyu/rocksdb.git","ssh_url":"git@github.com:imzhenyu/rocksdb.git","clone_url":"https://github.com/imzhenyu/rocksdb.git","svn_url":"https://github.com/imzhenyu/rocksdb","homepage":"http://rocksdb.org","size":55509,"stargazers_count":2,"watchers_count":2,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":2,"mirror_url":null,"open_issues_count":2,"forks":2,"open_issues":2,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/imzhenyu/rocksdb/pulls/6"},"html":{"href":"https://github.com/imzhenyu/rocksdb/pull/6"},"issue":{"href":"https://api.github.com/repos/imzhenyu/rocksdb/issues/6"},"comments":{"href":"https://api.github.com/repos/imzhenyu/rocksdb/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/imzhenyu/rocksdb/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/imzhenyu/rocksdb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/imzhenyu/rocksdb/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/imzhenyu/rocksdb/statuses/ac70b81983d91d08e88d6a26c99b9d8489fd4930"}}}}