{"action":"created","comment":{"url":"https://api.github.com/repos/spotify/styx/pulls/comments/214010504","pull_request_review_id":150968796,"id":214010504,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNDAxMDUwNA==","diff_hunk":"@@ -0,0 +1,108 @@\n+/*\n+ * -\\-\\-\n+ * Spotify Styx Scheduler Service\n+ * --\n+ * Copyright (C) 2018 Spotify AB\n+ * --\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ * \n+ *      http://www.apache.org/licenses/LICENSE-2.0\n+ * \n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ * -/-/-\n+ */\n+\n+package com.spotify.styx.storage;\n+\n+import static com.google.common.collect.Iterables.toArray;\n+\n+import com.google.cloud.datastore.DatastoreException;\n+import com.google.cloud.datastore.DatastoreReaderWriter;\n+import com.google.cloud.datastore.Entity;\n+import com.google.cloud.datastore.EntityQuery;\n+import com.google.cloud.datastore.FullEntity;\n+import com.google.cloud.datastore.Key;\n+import com.google.common.collect.ImmutableList;\n+import java.io.IOException;\n+import java.util.List;\n+import java.util.Objects;\n+import java.util.function.Supplier;\n+\n+/**\n+ * A wrapper for {@link DatastoreReaderWriter} that translates unchecked {@link DatastoreException}s to checked\n+ * {@link DatastoreIOException}s.\n+ */\n+class CheckedDatastoreReaderWriter {\n+\n+  private final DatastoreReaderWriter rw;\n+\n+  CheckedDatastoreReaderWriter(DatastoreReaderWriter rw) {\n+    this.rw = Objects.requireNonNull(rw);\n+  }\n+\n+  Entity put(FullEntity<?> entity) throws IOException {\n+    return call(() -> rw.put(entity));\n+  }\n+\n+  Entity add(FullEntity<?> entity) throws IOException {\n+    return call(() -> rw.add(entity));\n+  }\n+\n+  void update(Entity entity) throws IOException {\n+    run(() -> rw.update(entity));\n+  }\n+\n+  Entity get(Key key) throws IOException {\n+    return call(() -> rw.get(key));\n+  }\n+\n+  List<Entity> get(Iterable<Key> keys) throws IOException {\n+    return call(() -> ImmutableList.copyOf(rw.get(toArray(keys, Key.class))));\n+  }\n+\n+  void get(Iterable<Key> keys, IOConsumer<Entity> f) throws IOException {\n+    run(() -> rw.get(toArray(keys, Key.class)).forEachRemaining(IOConsumer.unchecked(f)));\n+  }\n+\n+  List<Entity> query(EntityQuery query) throws IOException {\n+    return call(() -> ImmutableList.copyOf(rw.run(query)));\n+  }\n+\n+  void query(EntityQuery query, IOConsumer<Entity> f) throws IOException {","path":"styx-common/src/main/java/com/spotify/styx/storage/CheckedDatastoreReaderWriter.java","position":77,"original_position":77,"commit_id":"d28bff7245c10ec9d068af7f90428b68cf3f0331","original_commit_id":"d28bff7245c10ec9d068af7f90428b68cf3f0331","user":{"login":"honnix","id":158892,"node_id":"MDQ6VXNlcjE1ODg5Mg==","avatar_url":"https://avatars0.githubusercontent.com/u/158892?v=4","gravatar_id":"","url":"https://api.github.com/users/honnix","html_url":"https://github.com/honnix","followers_url":"https://api.github.com/users/honnix/followers","following_url":"https://api.github.com/users/honnix/following{/other_user}","gists_url":"https://api.github.com/users/honnix/gists{/gist_id}","starred_url":"https://api.github.com/users/honnix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/honnix/subscriptions","organizations_url":"https://api.github.com/users/honnix/orgs","repos_url":"https://api.github.com/users/honnix/repos","events_url":"https://api.github.com/users/honnix/events{/privacy}","received_events_url":"https://api.github.com/users/honnix/received_events","type":"User","site_admin":false},"body":"I guess in our use case it doesn't really matter because everything can fit into memory.","created_at":"2018-08-30T12:28:57Z","updated_at":"2018-08-30T12:28:57Z","html_url":"https://github.com/spotify/styx/pull/566#discussion_r214010504","pull_request_url":"https://api.github.com/repos/spotify/styx/pulls/566","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/spotify/styx/pulls/comments/214010504"},"html":{"href":"https://github.com/spotify/styx/pull/566#discussion_r214010504"},"pull_request":{"href":"https://api.github.com/repos/spotify/styx/pulls/566"}},"in_reply_to_id":214010291},"pull_request":{"url":"https://api.github.com/repos/spotify/styx/pulls/566","id":211642767,"node_id":"MDExOlB1bGxSZXF1ZXN0MjExNjQyNzY3","html_url":"https://github.com/spotify/styx/pull/566","diff_url":"https://github.com/spotify/styx/pull/566.diff","patch_url":"https://github.com/spotify/styx/pull/566.patch","issue_url":"https://api.github.com/repos/spotify/styx/issues/566","number":566,"state":"open","locked":false,"title":"handle datastore exceptions","user":{"login":"danielnorberg","id":393289,"node_id":"MDQ6VXNlcjM5MzI4OQ==","avatar_url":"https://avatars1.githubusercontent.com/u/393289?v=4","gravatar_id":"","url":"https://api.github.com/users/danielnorberg","html_url":"https://github.com/danielnorberg","followers_url":"https://api.github.com/users/danielnorberg/followers","following_url":"https://api.github.com/users/danielnorberg/following{/other_user}","gists_url":"https://api.github.com/users/danielnorberg/gists{/gist_id}","starred_url":"https://api.github.com/users/danielnorberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielnorberg/subscriptions","organizations_url":"https://api.github.com/users/danielnorberg/orgs","repos_url":"https://api.github.com/users/danielnorberg/repos","events_url":"https://api.github.com/users/danielnorberg/events{/privacy}","received_events_url":"https://api.github.com/users/danielnorberg/received_events","type":"User","site_admin":false},"body":"Wraps the `Datastore` client in a `CheckedDatastore` wrapper that throws `IOException` instead of `DatastoreException`.\r\n\r\nThis forces all callers to handle these errors and leverages all the exception handling we already had in place that was written assuming that storage errors result in `IOException`.\r\n\r\nAddresses #355","created_at":"2018-08-29T06:34:38Z","updated_at":"2018-08-30T12:28:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4cc83de99652e61c41968cd01e84401aafff7543","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/spotify/styx/pulls/566/commits","review_comments_url":"https://api.github.com/repos/spotify/styx/pulls/566/comments","review_comment_url":"https://api.github.com/repos/spotify/styx/pulls/comments{/number}","comments_url":"https://api.github.com/repos/spotify/styx/issues/566/comments","statuses_url":"https://api.github.com/repos/spotify/styx/statuses/d28bff7245c10ec9d068af7f90428b68cf3f0331","head":{"label":"spotify:handle-datastore-exceptions","ref":"handle-datastore-exceptions","sha":"d28bff7245c10ec9d068af7f90428b68cf3f0331","user":{"login":"spotify","id":251374,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI1MTM3NA==","avatar_url":"https://avatars2.githubusercontent.com/u/251374?v=4","gravatar_id":"","url":"https://api.github.com/users/spotify","html_url":"https://github.com/spotify","followers_url":"https://api.github.com/users/spotify/followers","following_url":"https://api.github.com/users/spotify/following{/other_user}","gists_url":"https://api.github.com/users/spotify/gists{/gist_id}","starred_url":"https://api.github.com/users/spotify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spotify/subscriptions","organizations_url":"https://api.github.com/users/spotify/orgs","repos_url":"https://api.github.com/users/spotify/repos","events_url":"https://api.github.com/users/spotify/events{/privacy}","received_events_url":"https://api.github.com/users/spotify/received_events","type":"Organization","site_admin":false},"repo":{"id":74431644,"node_id":"MDEwOlJlcG9zaXRvcnk3NDQzMTY0NA==","name":"styx","full_name":"spotify/styx","owner":{"login":"spotify","id":251374,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI1MTM3NA==","avatar_url":"https://avatars2.githubusercontent.com/u/251374?v=4","gravatar_id":"","url":"https://api.github.com/users/spotify","html_url":"https://github.com/spotify","followers_url":"https://api.github.com/users/spotify/followers","following_url":"https://api.github.com/users/spotify/following{/other_user}","gists_url":"https://api.github.com/users/spotify/gists{/gist_id}","starred_url":"https://api.github.com/users/spotify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spotify/subscriptions","organizations_url":"https://api.github.com/users/spotify/orgs","repos_url":"https://api.github.com/users/spotify/repos","events_url":"https://api.github.com/users/spotify/events{/privacy}","received_events_url":"https://api.github.com/users/spotify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/spotify/styx","description":"\"The path to execution\", Styx is a service that schedules batch data processing jobs in Docker containers on Kubernetes.","fork":false,"url":"https://api.github.com/repos/spotify/styx","forks_url":"https://api.github.com/repos/spotify/styx/forks","keys_url":"https://api.github.com/repos/spotify/styx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spotify/styx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spotify/styx/teams","hooks_url":"https://api.github.com/repos/spotify/styx/hooks","issue_events_url":"https://api.github.com/repos/spotify/styx/issues/events{/number}","events_url":"https://api.github.com/repos/spotify/styx/events","assignees_url":"https://api.github.com/repos/spotify/styx/assignees{/user}","branches_url":"https://api.github.com/repos/spotify/styx/branches{/branch}","tags_url":"https://api.github.com/repos/spotify/styx/tags","blobs_url":"https://api.github.com/repos/spotify/styx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spotify/styx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spotify/styx/git/refs{/sha}","trees_url":"https://api.github.com/repos/spotify/styx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spotify/styx/statuses/{sha}","languages_url":"https://api.github.com/repos/spotify/styx/languages","stargazers_url":"https://api.github.com/repos/spotify/styx/stargazers","contributors_url":"https://api.github.com/repos/spotify/styx/contributors","subscribers_url":"https://api.github.com/repos/spotify/styx/subscribers","subscription_url":"https://api.github.com/repos/spotify/styx/subscription","commits_url":"https://api.github.com/repos/spotify/styx/commits{/sha}","git_commits_url":"https://api.github.com/repos/spotify/styx/git/commits{/sha}","comments_url":"https://api.github.com/repos/spotify/styx/comments{/number}","issue_comment_url":"https://api.github.com/repos/spotify/styx/issues/comments{/number}","contents_url":"https://api.github.com/repos/spotify/styx/contents/{+path}","compare_url":"https://api.github.com/repos/spotify/styx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spotify/styx/merges","archive_url":"https://api.github.com/repos/spotify/styx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spotify/styx/downloads","issues_url":"https://api.github.com/repos/spotify/styx/issues{/number}","pulls_url":"https://api.github.com/repos/spotify/styx/pulls{/number}","milestones_url":"https://api.github.com/repos/spotify/styx/milestones{/number}","notifications_url":"https://api.github.com/repos/spotify/styx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spotify/styx/labels{/name}","releases_url":"https://api.github.com/repos/spotify/styx/releases{/id}","deployments_url":"https://api.github.com/repos/spotify/styx/deployments","created_at":"2016-11-22T03:44:55Z","updated_at":"2018-08-28T05:46:49Z","pushed_at":"2018-08-30T05:49:10Z","git_url":"git://github.com/spotify/styx.git","ssh_url":"git@github.com:spotify/styx.git","clone_url":"https://github.com/spotify/styx.git","svn_url":"https://github.com/spotify/styx","homepage":"","size":5752,"stargazers_count":110,"watchers_count":110,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":20,"mirror_url":null,"archived":false,"open_issues_count":23,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":20,"open_issues":23,"watchers":110,"default_branch":"master"}},"base":{"label":"spotify:master","ref":"master","sha":"1ae8c328ea68400827b00e6a398c71d0f3fe21f3","user":{"login":"spotify","id":251374,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI1MTM3NA==","avatar_url":"https://avatars2.githubusercontent.com/u/251374?v=4","gravatar_id":"","url":"https://api.github.com/users/spotify","html_url":"https://github.com/spotify","followers_url":"https://api.github.com/users/spotify/followers","following_url":"https://api.github.com/users/spotify/following{/other_user}","gists_url":"https://api.github.com/users/spotify/gists{/gist_id}","starred_url":"https://api.github.com/users/spotify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spotify/subscriptions","organizations_url":"https://api.github.com/users/spotify/orgs","repos_url":"https://api.github.com/users/spotify/repos","events_url":"https://api.github.com/users/spotify/events{/privacy}","received_events_url":"https://api.github.com/users/spotify/received_events","type":"Organization","site_admin":false},"repo":{"id":74431644,"node_id":"MDEwOlJlcG9zaXRvcnk3NDQzMTY0NA==","name":"styx","full_name":"spotify/styx","owner":{"login":"spotify","id":251374,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI1MTM3NA==","avatar_url":"https://avatars2.githubusercontent.com/u/251374?v=4","gravatar_id":"","url":"https://api.github.com/users/spotify","html_url":"https://github.com/spotify","followers_url":"https://api.github.com/users/spotify/followers","following_url":"https://api.github.com/users/spotify/following{/other_user}","gists_url":"https://api.github.com/users/spotify/gists{/gist_id}","starred_url":"https://api.github.com/users/spotify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spotify/subscriptions","organizations_url":"https://api.github.com/users/spotify/orgs","repos_url":"https://api.github.com/users/spotify/repos","events_url":"https://api.github.com/users/spotify/events{/privacy}","received_events_url":"https://api.github.com/users/spotify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/spotify/styx","description":"\"The path to execution\", Styx is a service that schedules batch data processing jobs in Docker containers on Kubernetes.","fork":false,"url":"https://api.github.com/repos/spotify/styx","forks_url":"https://api.github.com/repos/spotify/styx/forks","keys_url":"https://api.github.com/repos/spotify/styx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spotify/styx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spotify/styx/teams","hooks_url":"https://api.github.com/repos/spotify/styx/hooks","issue_events_url":"https://api.github.com/repos/spotify/styx/issues/events{/number}","events_url":"https://api.github.com/repos/spotify/styx/events","assignees_url":"https://api.github.com/repos/spotify/styx/assignees{/user}","branches_url":"https://api.github.com/repos/spotify/styx/branches{/branch}","tags_url":"https://api.github.com/repos/spotify/styx/tags","blobs_url":"https://api.github.com/repos/spotify/styx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spotify/styx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spotify/styx/git/refs{/sha}","trees_url":"https://api.github.com/repos/spotify/styx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spotify/styx/statuses/{sha}","languages_url":"https://api.github.com/repos/spotify/styx/languages","stargazers_url":"https://api.github.com/repos/spotify/styx/stargazers","contributors_url":"https://api.github.com/repos/spotify/styx/contributors","subscribers_url":"https://api.github.com/repos/spotify/styx/subscribers","subscription_url":"https://api.github.com/repos/spotify/styx/subscription","commits_url":"https://api.github.com/repos/spotify/styx/commits{/sha}","git_commits_url":"https://api.github.com/repos/spotify/styx/git/commits{/sha}","comments_url":"https://api.github.com/repos/spotify/styx/comments{/number}","issue_comment_url":"https://api.github.com/repos/spotify/styx/issues/comments{/number}","contents_url":"https://api.github.com/repos/spotify/styx/contents/{+path}","compare_url":"https://api.github.com/repos/spotify/styx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spotify/styx/merges","archive_url":"https://api.github.com/repos/spotify/styx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spotify/styx/downloads","issues_url":"https://api.github.com/repos/spotify/styx/issues{/number}","pulls_url":"https://api.github.com/repos/spotify/styx/pulls{/number}","milestones_url":"https://api.github.com/repos/spotify/styx/milestones{/number}","notifications_url":"https://api.github.com/repos/spotify/styx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spotify/styx/labels{/name}","releases_url":"https://api.github.com/repos/spotify/styx/releases{/id}","deployments_url":"https://api.github.com/repos/spotify/styx/deployments","created_at":"2016-11-22T03:44:55Z","updated_at":"2018-08-28T05:46:49Z","pushed_at":"2018-08-30T05:49:10Z","git_url":"git://github.com/spotify/styx.git","ssh_url":"git@github.com:spotify/styx.git","clone_url":"https://github.com/spotify/styx.git","svn_url":"https://github.com/spotify/styx","homepage":"","size":5752,"stargazers_count":110,"watchers_count":110,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":20,"mirror_url":null,"archived":false,"open_issues_count":23,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":20,"open_issues":23,"watchers":110,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/spotify/styx/pulls/566"},"html":{"href":"https://github.com/spotify/styx/pull/566"},"issue":{"href":"https://api.github.com/repos/spotify/styx/issues/566"},"comments":{"href":"https://api.github.com/repos/spotify/styx/issues/566/comments"},"review_comments":{"href":"https://api.github.com/repos/spotify/styx/pulls/566/comments"},"review_comment":{"href":"https://api.github.com/repos/spotify/styx/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/spotify/styx/pulls/566/commits"},"statuses":{"href":"https://api.github.com/repos/spotify/styx/statuses/d28bff7245c10ec9d068af7f90428b68cf3f0331"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"honnix"}}