{"action":"created","comment":{"url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/pulls/comments/184197286","pull_request_review_id":115343997,"id":184197286,"diff_hunk":"@@ -49,6 +51,45 @@ impl Database {\n             Ok(Transaction::new(self.clone(), trx))\n         }\n     }\n+\n+    /// `transact` returns a future which retries on error. It tries to resolve a future created by\n+    /// caller-provided function `f` inside a retry loop, providing it with a newly created\n+    /// transaction. After caller-provided future resolves, the transaction will be committed\n+    /// automatically.\n+    pub fn transact<F, Fut, Item>(&self, f: F) -> Box<Future<Item = Fut::Item, Error = FdbError>>\n+    where\n+        F: FnMut(Transaction) -> Fut + 'static,\n+        Fut: Future<Item = Item, Error = FdbError> + 'static,\n+        Item: 'static,\n+    {\n+        let db = self.clone();\n+\n+        let f = result(db.create_trx()).and_then(|trx| {\n+            loop_fn((trx, f), |(trx, mut f)| {\n+                let trx0 = trx.clone();\n+                f(trx.clone())\n+                    .and_then(move |res| {\n+                        // try to commit the transaction\n+                        trx0.commit().map(|_| res)\n+                    })\n+                    .then(|res| match res {\n+                        Ok(v) => {\n+                            // committed\n+                            Ok(Loop::Break(v))\n+                        }\n+                        Err(e) => {\n+                            if e.should_retry() {","path":"foundationdb/src/database.rs","position":40,"original_position":40,"commit_id":"faca17dd0b13a607821e03450c4074b9587595c0","original_commit_id":"faca17dd0b13a607821e03450c4074b9587595c0","user":{"login":"bluejekyll","id":986845,"avatar_url":"https://avatars3.githubusercontent.com/u/986845?v=4","gravatar_id":"","url":"https://api.github.com/users/bluejekyll","html_url":"https://github.com/bluejekyll","followers_url":"https://api.github.com/users/bluejekyll/followers","following_url":"https://api.github.com/users/bluejekyll/following{/other_user}","gists_url":"https://api.github.com/users/bluejekyll/gists{/gist_id}","starred_url":"https://api.github.com/users/bluejekyll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bluejekyll/subscriptions","organizations_url":"https://api.github.com/users/bluejekyll/orgs","repos_url":"https://api.github.com/users/bluejekyll/repos","events_url":"https://api.github.com/users/bluejekyll/events{/privacy}","received_events_url":"https://api.github.com/users/bluejekyll/received_events","type":"User","site_admin":false},"body":"Can we add a comment documenting the reliance on the RetryLimit as the upper bound for this? That way people won't accidentally be caught off-guard by it.","created_at":"2018-04-25T20:34:46Z","updated_at":"2018-04-25T20:34:46Z","html_url":"https://github.com/bluejekyll/foundationdb-rs/pull/34#discussion_r184197286","pull_request_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/pulls/34","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/bluejekyll/foundationdb-rs/pulls/comments/184197286"},"html":{"href":"https://github.com/bluejekyll/foundationdb-rs/pull/34#discussion_r184197286"},"pull_request":{"href":"https://api.github.com/repos/bluejekyll/foundationdb-rs/pulls/34"}},"in_reply_to_id":184154786},"pull_request":{"url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/pulls/34","id":184109719,"html_url":"https://github.com/bluejekyll/foundationdb-rs/pull/34","diff_url":"https://github.com/bluejekyll/foundationdb-rs/pull/34.diff","patch_url":"https://github.com/bluejekyll/foundationdb-rs/pull/34.patch","issue_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/issues/34","number":34,"state":"open","locked":false,"title":"Add `Database::transact`, #29","user":{"login":"yjh0502","id":554344,"avatar_url":"https://avatars1.githubusercontent.com/u/554344?v=4","gravatar_id":"","url":"https://api.github.com/users/yjh0502","html_url":"https://github.com/yjh0502","followers_url":"https://api.github.com/users/yjh0502/followers","following_url":"https://api.github.com/users/yjh0502/following{/other_user}","gists_url":"https://api.github.com/users/yjh0502/gists{/gist_id}","starred_url":"https://api.github.com/users/yjh0502/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yjh0502/subscriptions","organizations_url":"https://api.github.com/users/yjh0502/orgs","repos_url":"https://api.github.com/users/yjh0502/repos","events_url":"https://api.github.com/users/yjh0502/events{/privacy}","received_events_url":"https://api.github.com/users/yjh0502/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-04-25T17:32:24Z","updated_at":"2018-04-25T20:34:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"54d4753c0c3dac62d2a76039c01874ce9bf56d77","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/pulls/34/commits","review_comments_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/pulls/34/comments","review_comment_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/issues/34/comments","statuses_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/statuses/faca17dd0b13a607821e03450c4074b9587595c0","head":{"label":"yjh0502:transact","ref":"transact","sha":"faca17dd0b13a607821e03450c4074b9587595c0","user":{"login":"yjh0502","id":554344,"avatar_url":"https://avatars1.githubusercontent.com/u/554344?v=4","gravatar_id":"","url":"https://api.github.com/users/yjh0502","html_url":"https://github.com/yjh0502","followers_url":"https://api.github.com/users/yjh0502/followers","following_url":"https://api.github.com/users/yjh0502/following{/other_user}","gists_url":"https://api.github.com/users/yjh0502/gists{/gist_id}","starred_url":"https://api.github.com/users/yjh0502/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yjh0502/subscriptions","organizations_url":"https://api.github.com/users/yjh0502/orgs","repos_url":"https://api.github.com/users/yjh0502/repos","events_url":"https://api.github.com/users/yjh0502/events{/privacy}","received_events_url":"https://api.github.com/users/yjh0502/received_events","type":"User","site_admin":false},"repo":{"id":130451145,"name":"foundationdb-rs","full_name":"yjh0502/foundationdb-rs","owner":{"login":"yjh0502","id":554344,"avatar_url":"https://avatars1.githubusercontent.com/u/554344?v=4","gravatar_id":"","url":"https://api.github.com/users/yjh0502","html_url":"https://github.com/yjh0502","followers_url":"https://api.github.com/users/yjh0502/followers","following_url":"https://api.github.com/users/yjh0502/following{/other_user}","gists_url":"https://api.github.com/users/yjh0502/gists{/gist_id}","starred_url":"https://api.github.com/users/yjh0502/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yjh0502/subscriptions","organizations_url":"https://api.github.com/users/yjh0502/orgs","repos_url":"https://api.github.com/users/yjh0502/repos","events_url":"https://api.github.com/users/yjh0502/events{/privacy}","received_events_url":"https://api.github.com/users/yjh0502/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yjh0502/foundationdb-rs","description":"FoundationDB Rust client api","fork":true,"url":"https://api.github.com/repos/yjh0502/foundationdb-rs","forks_url":"https://api.github.com/repos/yjh0502/foundationdb-rs/forks","keys_url":"https://api.github.com/repos/yjh0502/foundationdb-rs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yjh0502/foundationdb-rs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yjh0502/foundationdb-rs/teams","hooks_url":"https://api.github.com/repos/yjh0502/foundationdb-rs/hooks","issue_events_url":"https://api.github.com/repos/yjh0502/foundationdb-rs/issues/events{/number}","events_url":"https://api.github.com/repos/yjh0502/foundationdb-rs/events","assignees_url":"https://api.github.com/repos/yjh0502/foundationdb-rs/assignees{/user}","branches_url":"https://api.github.com/repos/yjh0502/foundationdb-rs/branches{/branch}","tags_url":"https://api.github.com/repos/yjh0502/foundationdb-rs/tags","blobs_url":"https://api.github.com/repos/yjh0502/foundationdb-rs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yjh0502/foundationdb-rs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yjh0502/foundationdb-rs/git/refs{/sha}","trees_url":"https://api.github.com/repos/yjh0502/foundationdb-rs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yjh0502/foundationdb-rs/statuses/{sha}","languages_url":"https://api.github.com/repos/yjh0502/foundationdb-rs/languages","stargazers_url":"https://api.github.com/repos/yjh0502/foundationdb-rs/stargazers","contributors_url":"https://api.github.com/repos/yjh0502/foundationdb-rs/contributors","subscribers_url":"https://api.github.com/repos/yjh0502/foundationdb-rs/subscribers","subscription_url":"https://api.github.com/repos/yjh0502/foundationdb-rs/subscription","commits_url":"https://api.github.com/repos/yjh0502/foundationdb-rs/commits{/sha}","git_commits_url":"https://api.github.com/repos/yjh0502/foundationdb-rs/git/commits{/sha}","comments_url":"https://api.github.com/repos/yjh0502/foundationdb-rs/comments{/number}","issue_comment_url":"https://api.github.com/repos/yjh0502/foundationdb-rs/issues/comments{/number}","contents_url":"https://api.github.com/repos/yjh0502/foundationdb-rs/contents/{+path}","compare_url":"https://api.github.com/repos/yjh0502/foundationdb-rs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yjh0502/foundationdb-rs/merges","archive_url":"https://api.github.com/repos/yjh0502/foundationdb-rs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yjh0502/foundationdb-rs/downloads","issues_url":"https://api.github.com/repos/yjh0502/foundationdb-rs/issues{/number}","pulls_url":"https://api.github.com/repos/yjh0502/foundationdb-rs/pulls{/number}","milestones_url":"https://api.github.com/repos/yjh0502/foundationdb-rs/milestones{/number}","notifications_url":"https://api.github.com/repos/yjh0502/foundationdb-rs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yjh0502/foundationdb-rs/labels{/name}","releases_url":"https://api.github.com/repos/yjh0502/foundationdb-rs/releases{/id}","deployments_url":"https://api.github.com/repos/yjh0502/foundationdb-rs/deployments","created_at":"2018-04-21T07:35:46Z","updated_at":"2018-04-21T07:35:48Z","pushed_at":"2018-04-25T17:31:49Z","git_url":"git://github.com/yjh0502/foundationdb-rs.git","ssh_url":"git@github.com:yjh0502/foundationdb-rs.git","clone_url":"https://github.com/yjh0502/foundationdb-rs.git","svn_url":"https://github.com/yjh0502/foundationdb-rs","homepage":null,"size":134,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"bluejekyll:master","ref":"master","sha":"b4467b5aa073422f28442d902c3e55c1beb28e6e","user":{"login":"bluejekyll","id":986845,"avatar_url":"https://avatars3.githubusercontent.com/u/986845?v=4","gravatar_id":"","url":"https://api.github.com/users/bluejekyll","html_url":"https://github.com/bluejekyll","followers_url":"https://api.github.com/users/bluejekyll/followers","following_url":"https://api.github.com/users/bluejekyll/following{/other_user}","gists_url":"https://api.github.com/users/bluejekyll/gists{/gist_id}","starred_url":"https://api.github.com/users/bluejekyll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bluejekyll/subscriptions","organizations_url":"https://api.github.com/users/bluejekyll/orgs","repos_url":"https://api.github.com/users/bluejekyll/repos","events_url":"https://api.github.com/users/bluejekyll/events{/privacy}","received_events_url":"https://api.github.com/users/bluejekyll/received_events","type":"User","site_admin":false},"repo":{"id":130315778,"name":"foundationdb-rs","full_name":"bluejekyll/foundationdb-rs","owner":{"login":"bluejekyll","id":986845,"avatar_url":"https://avatars3.githubusercontent.com/u/986845?v=4","gravatar_id":"","url":"https://api.github.com/users/bluejekyll","html_url":"https://github.com/bluejekyll","followers_url":"https://api.github.com/users/bluejekyll/followers","following_url":"https://api.github.com/users/bluejekyll/following{/other_user}","gists_url":"https://api.github.com/users/bluejekyll/gists{/gist_id}","starred_url":"https://api.github.com/users/bluejekyll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bluejekyll/subscriptions","organizations_url":"https://api.github.com/users/bluejekyll/orgs","repos_url":"https://api.github.com/users/bluejekyll/repos","events_url":"https://api.github.com/users/bluejekyll/events{/privacy}","received_events_url":"https://api.github.com/users/bluejekyll/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bluejekyll/foundationdb-rs","description":"FoundationDB Rust client api","fork":false,"url":"https://api.github.com/repos/bluejekyll/foundationdb-rs","forks_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/forks","keys_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/teams","hooks_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/hooks","issue_events_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/issues/events{/number}","events_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/events","assignees_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/assignees{/user}","branches_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/branches{/branch}","tags_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/tags","blobs_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/git/refs{/sha}","trees_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/statuses/{sha}","languages_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/languages","stargazers_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/stargazers","contributors_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/contributors","subscribers_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/subscribers","subscription_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/subscription","commits_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/commits{/sha}","git_commits_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/git/commits{/sha}","comments_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/comments{/number}","issue_comment_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/issues/comments{/number}","contents_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/contents/{+path}","compare_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/merges","archive_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/downloads","issues_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/issues{/number}","pulls_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/pulls{/number}","milestones_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/milestones{/number}","notifications_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/labels{/name}","releases_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/releases{/id}","deployments_url":"https://api.github.com/repos/bluejekyll/foundationdb-rs/deployments","created_at":"2018-04-20T05:58:31Z","updated_at":"2018-04-25T20:31:30Z","pushed_at":"2018-04-25T20:31:28Z","git_url":"git://github.com/bluejekyll/foundationdb-rs.git","ssh_url":"git@github.com:bluejekyll/foundationdb-rs.git","clone_url":"https://github.com/bluejekyll/foundationdb-rs.git","svn_url":"https://github.com/bluejekyll/foundationdb-rs","homepage":null,"size":136,"stargazers_count":35,"watchers_count":35,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":8,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":2,"open_issues":8,"watchers":35,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bluejekyll/foundationdb-rs/pulls/34"},"html":{"href":"https://github.com/bluejekyll/foundationdb-rs/pull/34"},"issue":{"href":"https://api.github.com/repos/bluejekyll/foundationdb-rs/issues/34"},"comments":{"href":"https://api.github.com/repos/bluejekyll/foundationdb-rs/issues/34/comments"},"review_comments":{"href":"https://api.github.com/repos/bluejekyll/foundationdb-rs/pulls/34/comments"},"review_comment":{"href":"https://api.github.com/repos/bluejekyll/foundationdb-rs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bluejekyll/foundationdb-rs/pulls/34/commits"},"statuses":{"href":"https://api.github.com/repos/bluejekyll/foundationdb-rs/statuses/faca17dd0b13a607821e03450c4074b9587595c0"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"bluejekyll"}}