{"action":"created","comment":{"url":"https://api.github.com/repos/lukdut/SpringDeveloper/pulls/comments/236084181","pull_request_review_id":178091678,"id":236084181,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzNjA4NDE4MQ==","diff_hunk":"@@ -0,0 +1,60 @@\n+package gerasimov.springdev.nosqllibrary.facade;\n+\n+import com.netflix.hystrix.HystrixCommand;\n+import com.netflix.hystrix.HystrixCommandGroupKey;\n+import gerasimov.springdev.nosqllibrary.model.Book;\n+\n+import java.util.List;\n+import java.util.function.Function;\n+\n+public class SafeBookLibFacade implements BookLibFacade {\n+    private static final String DB_READ = \"DB_READ_DATA\";\n+    private static final String DB_WRITE = \"DB_WRITE_DATA\";\n+    private final BookLibFacade bookLibFacade;\n+\n+    public SafeBookLibFacade(MongoLibraryFacade bookLibFacade) {\n+        this.bookLibFacade = bookLibFacade;\n+    }\n+\n+    @Override\n+    public List<Book> allBooks() {\n+        return new RepoCommand<>(DB_READ, null, o -> bookLibFacade.allBooks()).execute();\n+    }\n+\n+    @Override\n+    public void deleteBook(String id) {\n+        new RepoCommand<>(DB_WRITE, id, s -> {\n+            bookLibFacade.deleteBook(s);\n+            return null;\n+        }).execute();\n+    }\n+\n+    @Override\n+    public void updateBook(Book book) {\n+        new RepoCommand<>(DB_WRITE, book, b -> {\n+            bookLibFacade.updateBook(b);\n+            return null;\n+        }).execute();\n+    }\n+\n+    @Override\n+    public String addBook(Book book) {\n+        return new RepoCommand<>(DB_WRITE, book, bookLibFacade::addBook).execute();\n+    }\n+\n+    private class RepoCommand<T, R> extends HystrixCommand<R> {","path":"NoSqlLibrary/src/main/java/gerasimov/springdev/nosqllibrary/facade/SafeBookLibFacade.java","position":45,"original_position":45,"commit_id":"9a60cb48ca8ac1f18db88eb8b3f0c525020e705d","original_commit_id":"9a60cb48ca8ac1f18db88eb8b3f0c525020e705d","user":{"login":"saroff","id":6500849,"node_id":"MDQ6VXNlcjY1MDA4NDk=","avatar_url":"https://avatars0.githubusercontent.com/u/6500849?v=4","gravatar_id":"","url":"https://api.github.com/users/saroff","html_url":"https://github.com/saroff","followers_url":"https://api.github.com/users/saroff/followers","following_url":"https://api.github.com/users/saroff/following{/other_user}","gists_url":"https://api.github.com/users/saroff/gists{/gist_id}","starred_url":"https://api.github.com/users/saroff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saroff/subscriptions","organizations_url":"https://api.github.com/users/saroff/orgs","repos_url":"https://api.github.com/users/saroff/repos","events_url":"https://api.github.com/users/saroff/events{/privacy}","received_events_url":"https://api.github.com/users/saroff/received_events","type":"User","site_admin":false},"body":"Круто!","created_at":"2018-11-25T18:16:20Z","updated_at":"2018-11-25T18:16:20Z","html_url":"https://github.com/lukdut/SpringDeveloper/pull/19#discussion_r236084181","pull_request_url":"https://api.github.com/repos/lukdut/SpringDeveloper/pulls/19","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/lukdut/SpringDeveloper/pulls/comments/236084181"},"html":{"href":"https://github.com/lukdut/SpringDeveloper/pull/19#discussion_r236084181"},"pull_request":{"href":"https://api.github.com/repos/lukdut/SpringDeveloper/pulls/19"}}},"pull_request":{"url":"https://api.github.com/repos/lukdut/SpringDeveloper/pulls/19","id":233384779,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMzMzg0Nzc5","html_url":"https://github.com/lukdut/SpringDeveloper/pull/19","diff_url":"https://github.com/lukdut/SpringDeveloper/pull/19.diff","patch_url":"https://github.com/lukdut/SpringDeveloper/pull/19.patch","issue_url":"https://api.github.com/repos/lukdut/SpringDeveloper/issues/19","number":19,"state":"open","locked":false,"title":"Lesson31","user":{"login":"lukdut","id":15714031,"node_id":"MDQ6VXNlcjE1NzE0MDMx","avatar_url":"https://avatars3.githubusercontent.com/u/15714031?v=4","gravatar_id":"","url":"https://api.github.com/users/lukdut","html_url":"https://github.com/lukdut","followers_url":"https://api.github.com/users/lukdut/followers","following_url":"https://api.github.com/users/lukdut/following{/other_user}","gists_url":"https://api.github.com/users/lukdut/gists{/gist_id}","starred_url":"https://api.github.com/users/lukdut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukdut/subscriptions","organizations_url":"https://api.github.com/users/lukdut/orgs","repos_url":"https://api.github.com/users/lukdut/repos","events_url":"https://api.github.com/users/lukdut/events{/privacy}","received_events_url":"https://api.github.com/users/lukdut/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-11-25T16:14:34Z","updated_at":"2018-11-25T18:16:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fc1b61921abbe78c0d306f93f1af8afee78ad96c","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/lukdut/SpringDeveloper/pulls/19/commits","review_comments_url":"https://api.github.com/repos/lukdut/SpringDeveloper/pulls/19/comments","review_comment_url":"https://api.github.com/repos/lukdut/SpringDeveloper/pulls/comments{/number}","comments_url":"https://api.github.com/repos/lukdut/SpringDeveloper/issues/19/comments","statuses_url":"https://api.github.com/repos/lukdut/SpringDeveloper/statuses/9a60cb48ca8ac1f18db88eb8b3f0c525020e705d","head":{"label":"lukdut:lesson31","ref":"lesson31","sha":"9a60cb48ca8ac1f18db88eb8b3f0c525020e705d","user":{"login":"lukdut","id":15714031,"node_id":"MDQ6VXNlcjE1NzE0MDMx","avatar_url":"https://avatars3.githubusercontent.com/u/15714031?v=4","gravatar_id":"","url":"https://api.github.com/users/lukdut","html_url":"https://github.com/lukdut","followers_url":"https://api.github.com/users/lukdut/followers","following_url":"https://api.github.com/users/lukdut/following{/other_user}","gists_url":"https://api.github.com/users/lukdut/gists{/gist_id}","starred_url":"https://api.github.com/users/lukdut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukdut/subscriptions","organizations_url":"https://api.github.com/users/lukdut/orgs","repos_url":"https://api.github.com/users/lukdut/repos","events_url":"https://api.github.com/users/lukdut/events{/privacy}","received_events_url":"https://api.github.com/users/lukdut/received_events","type":"User","site_admin":false},"repo":{"id":138929101,"node_id":"MDEwOlJlcG9zaXRvcnkxMzg5MjkxMDE=","name":"SpringDeveloper","full_name":"lukdut/SpringDeveloper","private":false,"owner":{"login":"lukdut","id":15714031,"node_id":"MDQ6VXNlcjE1NzE0MDMx","avatar_url":"https://avatars3.githubusercontent.com/u/15714031?v=4","gravatar_id":"","url":"https://api.github.com/users/lukdut","html_url":"https://github.com/lukdut","followers_url":"https://api.github.com/users/lukdut/followers","following_url":"https://api.github.com/users/lukdut/following{/other_user}","gists_url":"https://api.github.com/users/lukdut/gists{/gist_id}","starred_url":"https://api.github.com/users/lukdut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukdut/subscriptions","organizations_url":"https://api.github.com/users/lukdut/orgs","repos_url":"https://api.github.com/users/lukdut/repos","events_url":"https://api.github.com/users/lukdut/events{/privacy}","received_events_url":"https://api.github.com/users/lukdut/received_events","type":"User","site_admin":false},"html_url":"https://github.com/lukdut/SpringDeveloper","description":"OTUS Course","fork":false,"url":"https://api.github.com/repos/lukdut/SpringDeveloper","forks_url":"https://api.github.com/repos/lukdut/SpringDeveloper/forks","keys_url":"https://api.github.com/repos/lukdut/SpringDeveloper/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lukdut/SpringDeveloper/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lukdut/SpringDeveloper/teams","hooks_url":"https://api.github.com/repos/lukdut/SpringDeveloper/hooks","issue_events_url":"https://api.github.com/repos/lukdut/SpringDeveloper/issues/events{/number}","events_url":"https://api.github.com/repos/lukdut/SpringDeveloper/events","assignees_url":"https://api.github.com/repos/lukdut/SpringDeveloper/assignees{/user}","branches_url":"https://api.github.com/repos/lukdut/SpringDeveloper/branches{/branch}","tags_url":"https://api.github.com/repos/lukdut/SpringDeveloper/tags","blobs_url":"https://api.github.com/repos/lukdut/SpringDeveloper/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lukdut/SpringDeveloper/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lukdut/SpringDeveloper/git/refs{/sha}","trees_url":"https://api.github.com/repos/lukdut/SpringDeveloper/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lukdut/SpringDeveloper/statuses/{sha}","languages_url":"https://api.github.com/repos/lukdut/SpringDeveloper/languages","stargazers_url":"https://api.github.com/repos/lukdut/SpringDeveloper/stargazers","contributors_url":"https://api.github.com/repos/lukdut/SpringDeveloper/contributors","subscribers_url":"https://api.github.com/repos/lukdut/SpringDeveloper/subscribers","subscription_url":"https://api.github.com/repos/lukdut/SpringDeveloper/subscription","commits_url":"https://api.github.com/repos/lukdut/SpringDeveloper/commits{/sha}","git_commits_url":"https://api.github.com/repos/lukdut/SpringDeveloper/git/commits{/sha}","comments_url":"https://api.github.com/repos/lukdut/SpringDeveloper/comments{/number}","issue_comment_url":"https://api.github.com/repos/lukdut/SpringDeveloper/issues/comments{/number}","contents_url":"https://api.github.com/repos/lukdut/SpringDeveloper/contents/{+path}","compare_url":"https://api.github.com/repos/lukdut/SpringDeveloper/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lukdut/SpringDeveloper/merges","archive_url":"https://api.github.com/repos/lukdut/SpringDeveloper/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lukdut/SpringDeveloper/downloads","issues_url":"https://api.github.com/repos/lukdut/SpringDeveloper/issues{/number}","pulls_url":"https://api.github.com/repos/lukdut/SpringDeveloper/pulls{/number}","milestones_url":"https://api.github.com/repos/lukdut/SpringDeveloper/milestones{/number}","notifications_url":"https://api.github.com/repos/lukdut/SpringDeveloper/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lukdut/SpringDeveloper/labels{/name}","releases_url":"https://api.github.com/repos/lukdut/SpringDeveloper/releases{/id}","deployments_url":"https://api.github.com/repos/lukdut/SpringDeveloper/deployments","created_at":"2018-06-27T20:21:15Z","updated_at":"2018-11-25T11:40:37Z","pushed_at":"2018-11-25T16:14:34Z","git_url":"git://github.com/lukdut/SpringDeveloper.git","ssh_url":"git@github.com:lukdut/SpringDeveloper.git","clone_url":"https://github.com/lukdut/SpringDeveloper.git","svn_url":"https://github.com/lukdut/SpringDeveloper","homepage":null,"size":223,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"lukdut:master","ref":"master","sha":"482f8c72e28006c2fbd44d1625ca331f0bad9636","user":{"login":"lukdut","id":15714031,"node_id":"MDQ6VXNlcjE1NzE0MDMx","avatar_url":"https://avatars3.githubusercontent.com/u/15714031?v=4","gravatar_id":"","url":"https://api.github.com/users/lukdut","html_url":"https://github.com/lukdut","followers_url":"https://api.github.com/users/lukdut/followers","following_url":"https://api.github.com/users/lukdut/following{/other_user}","gists_url":"https://api.github.com/users/lukdut/gists{/gist_id}","starred_url":"https://api.github.com/users/lukdut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukdut/subscriptions","organizations_url":"https://api.github.com/users/lukdut/orgs","repos_url":"https://api.github.com/users/lukdut/repos","events_url":"https://api.github.com/users/lukdut/events{/privacy}","received_events_url":"https://api.github.com/users/lukdut/received_events","type":"User","site_admin":false},"repo":{"id":138929101,"node_id":"MDEwOlJlcG9zaXRvcnkxMzg5MjkxMDE=","name":"SpringDeveloper","full_name":"lukdut/SpringDeveloper","private":false,"owner":{"login":"lukdut","id":15714031,"node_id":"MDQ6VXNlcjE1NzE0MDMx","avatar_url":"https://avatars3.githubusercontent.com/u/15714031?v=4","gravatar_id":"","url":"https://api.github.com/users/lukdut","html_url":"https://github.com/lukdut","followers_url":"https://api.github.com/users/lukdut/followers","following_url":"https://api.github.com/users/lukdut/following{/other_user}","gists_url":"https://api.github.com/users/lukdut/gists{/gist_id}","starred_url":"https://api.github.com/users/lukdut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukdut/subscriptions","organizations_url":"https://api.github.com/users/lukdut/orgs","repos_url":"https://api.github.com/users/lukdut/repos","events_url":"https://api.github.com/users/lukdut/events{/privacy}","received_events_url":"https://api.github.com/users/lukdut/received_events","type":"User","site_admin":false},"html_url":"https://github.com/lukdut/SpringDeveloper","description":"OTUS Course","fork":false,"url":"https://api.github.com/repos/lukdut/SpringDeveloper","forks_url":"https://api.github.com/repos/lukdut/SpringDeveloper/forks","keys_url":"https://api.github.com/repos/lukdut/SpringDeveloper/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lukdut/SpringDeveloper/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lukdut/SpringDeveloper/teams","hooks_url":"https://api.github.com/repos/lukdut/SpringDeveloper/hooks","issue_events_url":"https://api.github.com/repos/lukdut/SpringDeveloper/issues/events{/number}","events_url":"https://api.github.com/repos/lukdut/SpringDeveloper/events","assignees_url":"https://api.github.com/repos/lukdut/SpringDeveloper/assignees{/user}","branches_url":"https://api.github.com/repos/lukdut/SpringDeveloper/branches{/branch}","tags_url":"https://api.github.com/repos/lukdut/SpringDeveloper/tags","blobs_url":"https://api.github.com/repos/lukdut/SpringDeveloper/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lukdut/SpringDeveloper/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lukdut/SpringDeveloper/git/refs{/sha}","trees_url":"https://api.github.com/repos/lukdut/SpringDeveloper/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lukdut/SpringDeveloper/statuses/{sha}","languages_url":"https://api.github.com/repos/lukdut/SpringDeveloper/languages","stargazers_url":"https://api.github.com/repos/lukdut/SpringDeveloper/stargazers","contributors_url":"https://api.github.com/repos/lukdut/SpringDeveloper/contributors","subscribers_url":"https://api.github.com/repos/lukdut/SpringDeveloper/subscribers","subscription_url":"https://api.github.com/repos/lukdut/SpringDeveloper/subscription","commits_url":"https://api.github.com/repos/lukdut/SpringDeveloper/commits{/sha}","git_commits_url":"https://api.github.com/repos/lukdut/SpringDeveloper/git/commits{/sha}","comments_url":"https://api.github.com/repos/lukdut/SpringDeveloper/comments{/number}","issue_comment_url":"https://api.github.com/repos/lukdut/SpringDeveloper/issues/comments{/number}","contents_url":"https://api.github.com/repos/lukdut/SpringDeveloper/contents/{+path}","compare_url":"https://api.github.com/repos/lukdut/SpringDeveloper/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lukdut/SpringDeveloper/merges","archive_url":"https://api.github.com/repos/lukdut/SpringDeveloper/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lukdut/SpringDeveloper/downloads","issues_url":"https://api.github.com/repos/lukdut/SpringDeveloper/issues{/number}","pulls_url":"https://api.github.com/repos/lukdut/SpringDeveloper/pulls{/number}","milestones_url":"https://api.github.com/repos/lukdut/SpringDeveloper/milestones{/number}","notifications_url":"https://api.github.com/repos/lukdut/SpringDeveloper/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lukdut/SpringDeveloper/labels{/name}","releases_url":"https://api.github.com/repos/lukdut/SpringDeveloper/releases{/id}","deployments_url":"https://api.github.com/repos/lukdut/SpringDeveloper/deployments","created_at":"2018-06-27T20:21:15Z","updated_at":"2018-11-25T11:40:37Z","pushed_at":"2018-11-25T16:14:34Z","git_url":"git://github.com/lukdut/SpringDeveloper.git","ssh_url":"git@github.com:lukdut/SpringDeveloper.git","clone_url":"https://github.com/lukdut/SpringDeveloper.git","svn_url":"https://github.com/lukdut/SpringDeveloper","homepage":null,"size":223,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/lukdut/SpringDeveloper/pulls/19"},"html":{"href":"https://github.com/lukdut/SpringDeveloper/pull/19"},"issue":{"href":"https://api.github.com/repos/lukdut/SpringDeveloper/issues/19"},"comments":{"href":"https://api.github.com/repos/lukdut/SpringDeveloper/issues/19/comments"},"review_comments":{"href":"https://api.github.com/repos/lukdut/SpringDeveloper/pulls/19/comments"},"review_comment":{"href":"https://api.github.com/repos/lukdut/SpringDeveloper/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/lukdut/SpringDeveloper/pulls/19/commits"},"statuses":{"href":"https://api.github.com/repos/lukdut/SpringDeveloper/statuses/9a60cb48ca8ac1f18db88eb8b3f0c525020e705d"}},"author_association":"OWNER"}}
{"actor":{"display_login":"saroff"}}