{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/comments/43072707","id":43072707,"diff_hunk":"@@ -596,6 +596,157 @@ public static Builder builder() {\n     }\n   }\n \n+  class RewriteRequest implements Serializable {\n+\n+    private static final long serialVersionUID = -4498650529476219937L;\n+\n+    private final BlobId source;\n+    private final List<BlobSourceOption> sourceOptions;\n+    private final BlobInfo target;\n+    private final List<BlobTargetOption> targetOptions;\n+    private final Long maxBytesRewrittenPerCall;\n+\n+    public static class Builder {\n+\n+      private final Set<BlobSourceOption> sourceOptions = new LinkedHashSet<>();\n+      private final Set<BlobTargetOption> targetOptions = new LinkedHashSet<>();\n+      private BlobId source;\n+      private BlobInfo target;\n+      private Long maxBytesRewrittenPerCall;\n+\n+      /**\n+       * Sets the blob to rewrite given bucket and blob name.\n+       *\n+       * @return the builder.\n+       */\n+      public Builder source(String bucket, String blob) {\n+        this.source = BlobId.of(bucket, blob);\n+        return this;\n+      }\n+\n+      /**\n+       * Sets the blob to rewrite given a {@link BlobId}.\n+       *\n+       * @return the builder.\n+       */\n+      public Builder source(BlobId source) {\n+        this.source = source;\n+        return this;\n+      }\n+\n+      /**\n+       * Sets blob's source options.\n+       *\n+       * @return the builder.\n+       */\n+      public Builder sourceOptions(BlobSourceOption... options) {\n+        Collections.addAll(sourceOptions, options);\n+        return this;\n+      }\n+\n+      /**\n+       * Sets blob's source options.\n+       *\n+       * @return the builder.\n+       */\n+      public Builder sourceOptions(Iterable<BlobSourceOption> options) {\n+        Iterables.addAll(sourceOptions, options);\n+        return this;\n+      }\n+\n+      /**\n+       * Sets the rewrite target.\n+       *\n+       * @return the builder.\n+       */\n+      public Builder target(BlobInfo target) {\n+        this.target = target;\n+        return this;\n+      }\n+\n+      /**\n+       * Sets blob's target options.\n+       *\n+       * @return the builder.\n+       */\n+      public Builder targetOptions(BlobTargetOption... options) {\n+        Collections.addAll(targetOptions, options);\n+        return this;\n+      }\n+\n+      /**\n+       * Sets blob's target options.\n+       *\n+       * @return the builder.\n+       */\n+      public Builder targetOptions(Iterable<BlobTargetOption> options) {\n+        Iterables.addAll(targetOptions, options);\n+        return this;\n+      }\n+\n+      /**\n+       * Sets the maximum number of bytes to copy for each RPC call. This parameter is ignored if\n+       * source and target blob share the same location and storage class as rewrite is made with\n+       * one single RPC.\n+       *\n+       * @return the builder.\n+       */\n+      public Builder maxBytesRewrittenPerCall(Long maxBytesRewrittenPerCall) {","path":"gcloud-java-storage/src/main/java/com/google/gcloud/storage/Storage.java","position":99,"original_position":99,"commit_id":"0b77a08a844575f052ed62770e3c51955855ce7a","original_commit_id":"0b77a08a844575f052ed62770e3c51955855ce7a","user":{"login":"aozarov","id":8921691,"avatar_url":"https://avatars.githubusercontent.com/u/8921691?v=3","gravatar_id":"","url":"https://api.github.com/users/aozarov","html_url":"https://github.com/aozarov","followers_url":"https://api.github.com/users/aozarov/followers","following_url":"https://api.github.com/users/aozarov/following{/other_user}","gists_url":"https://api.github.com/users/aozarov/gists{/gist_id}","starred_url":"https://api.github.com/users/aozarov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aozarov/subscriptions","organizations_url":"https://api.github.com/users/aozarov/orgs","repos_url":"https://api.github.com/users/aozarov/repos","events_url":"https://api.github.com/users/aozarov/events{/privacy}","received_events_url":"https://api.github.com/users/aozarov/received_events","type":"User","site_admin":false},"body":"See my comment above, suggesting that we should set it in MB.","created_at":"2015-10-27T00:34:19Z","updated_at":"2015-10-27T00:34:19Z","html_url":"https://github.com/GoogleCloudPlatform/gcloud-java/pull/294#discussion_r43072707","pull_request_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/294","_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/comments/43072707"},"html":{"href":"https://github.com/GoogleCloudPlatform/gcloud-java/pull/294#discussion_r43072707"},"pull_request":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/294"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/294","id":48766215,"html_url":"https://github.com/GoogleCloudPlatform/gcloud-java/pull/294","diff_url":"https://github.com/GoogleCloudPlatform/gcloud-java/pull/294.diff","patch_url":"https://github.com/GoogleCloudPlatform/gcloud-java/pull/294.patch","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues/294","number":294,"state":"open","locked":false,"title":"Add support for blob rewrite","user":{"login":"mziccard","id":450933,"avatar_url":"https://avatars.githubusercontent.com/u/450933?v=3","gravatar_id":"","url":"https://api.github.com/users/mziccard","html_url":"https://github.com/mziccard","followers_url":"https://api.github.com/users/mziccard/followers","following_url":"https://api.github.com/users/mziccard/following{/other_user}","gists_url":"https://api.github.com/users/mziccard/gists{/gist_id}","starred_url":"https://api.github.com/users/mziccard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mziccard/subscriptions","organizations_url":"https://api.github.com/users/mziccard/orgs","repos_url":"https://api.github.com/users/mziccard/repos","events_url":"https://api.github.com/users/mziccard/events{/privacy}","received_events_url":"https://api.github.com/users/mziccard/received_events","type":"User","site_admin":false},"body":"This follows from #291. Main changes are:\r\n- Add `rewrite` method to `StorageRpc` and `DefaultStorageRpc`\r\n- Add `BlobRewriter` class to wrap multiple rewrite requests\r\n- Add `rewriter` method to `Storage` and `StorageImpl` that returns a `BlobRewriter`\r\n- Add unit and integration tests","created_at":"2015-10-26T16:55:06Z","updated_at":"2015-10-27T00:34:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"088eb795448d5c9dfb571c0752792603d6ce875b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/294/commits","review_comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/294/comments","review_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues/294/comments","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/statuses/0b77a08a844575f052ed62770e3c51955855ce7a","head":{"label":"mziccard:add-support-for-rewrite","ref":"add-support-for-rewrite","sha":"0b77a08a844575f052ed62770e3c51955855ce7a","user":{"login":"mziccard","id":450933,"avatar_url":"https://avatars.githubusercontent.com/u/450933?v=3","gravatar_id":"","url":"https://api.github.com/users/mziccard","html_url":"https://github.com/mziccard","followers_url":"https://api.github.com/users/mziccard/followers","following_url":"https://api.github.com/users/mziccard/following{/other_user}","gists_url":"https://api.github.com/users/mziccard/gists{/gist_id}","starred_url":"https://api.github.com/users/mziccard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mziccard/subscriptions","organizations_url":"https://api.github.com/users/mziccard/orgs","repos_url":"https://api.github.com/users/mziccard/repos","events_url":"https://api.github.com/users/mziccard/events{/privacy}","received_events_url":"https://api.github.com/users/mziccard/received_events","type":"User","site_admin":false},"repo":{"id":40965279,"name":"gcloud-java","full_name":"mziccard/gcloud-java","owner":{"login":"mziccard","id":450933,"avatar_url":"https://avatars.githubusercontent.com/u/450933?v=3","gravatar_id":"","url":"https://api.github.com/users/mziccard","html_url":"https://github.com/mziccard","followers_url":"https://api.github.com/users/mziccard/followers","following_url":"https://api.github.com/users/mziccard/following{/other_user}","gists_url":"https://api.github.com/users/mziccard/gists{/gist_id}","starred_url":"https://api.github.com/users/mziccard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mziccard/subscriptions","organizations_url":"https://api.github.com/users/mziccard/orgs","repos_url":"https://api.github.com/users/mziccard/repos","events_url":"https://api.github.com/users/mziccard/events{/privacy}","received_events_url":"https://api.github.com/users/mziccard/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mziccard/gcloud-java","description":"Google Cloud Client Library for Java","fork":true,"url":"https://api.github.com/repos/mziccard/gcloud-java","forks_url":"https://api.github.com/repos/mziccard/gcloud-java/forks","keys_url":"https://api.github.com/repos/mziccard/gcloud-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mziccard/gcloud-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mziccard/gcloud-java/teams","hooks_url":"https://api.github.com/repos/mziccard/gcloud-java/hooks","issue_events_url":"https://api.github.com/repos/mziccard/gcloud-java/issues/events{/number}","events_url":"https://api.github.com/repos/mziccard/gcloud-java/events","assignees_url":"https://api.github.com/repos/mziccard/gcloud-java/assignees{/user}","branches_url":"https://api.github.com/repos/mziccard/gcloud-java/branches{/branch}","tags_url":"https://api.github.com/repos/mziccard/gcloud-java/tags","blobs_url":"https://api.github.com/repos/mziccard/gcloud-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mziccard/gcloud-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mziccard/gcloud-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/mziccard/gcloud-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mziccard/gcloud-java/statuses/{sha}","languages_url":"https://api.github.com/repos/mziccard/gcloud-java/languages","stargazers_url":"https://api.github.com/repos/mziccard/gcloud-java/stargazers","contributors_url":"https://api.github.com/repos/mziccard/gcloud-java/contributors","subscribers_url":"https://api.github.com/repos/mziccard/gcloud-java/subscribers","subscription_url":"https://api.github.com/repos/mziccard/gcloud-java/subscription","commits_url":"https://api.github.com/repos/mziccard/gcloud-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/mziccard/gcloud-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/mziccard/gcloud-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/mziccard/gcloud-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/mziccard/gcloud-java/contents/{+path}","compare_url":"https://api.github.com/repos/mziccard/gcloud-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mziccard/gcloud-java/merges","archive_url":"https://api.github.com/repos/mziccard/gcloud-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mziccard/gcloud-java/downloads","issues_url":"https://api.github.com/repos/mziccard/gcloud-java/issues{/number}","pulls_url":"https://api.github.com/repos/mziccard/gcloud-java/pulls{/number}","milestones_url":"https://api.github.com/repos/mziccard/gcloud-java/milestones{/number}","notifications_url":"https://api.github.com/repos/mziccard/gcloud-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mziccard/gcloud-java/labels{/name}","releases_url":"https://api.github.com/repos/mziccard/gcloud-java/releases{/id}","created_at":"2015-08-18T10:16:17Z","updated_at":"2015-08-18T10:16:18Z","pushed_at":"2015-10-26T21:39:31Z","git_url":"git://github.com/mziccard/gcloud-java.git","ssh_url":"git@github.com:mziccard/gcloud-java.git","clone_url":"https://github.com/mziccard/gcloud-java.git","svn_url":"https://github.com/mziccard/gcloud-java","homepage":"http://googlecloudplatform.github.io/gcloud-java/site/0.0.6/","size":16143,"stargazers_count":0,"watchers_count":0,"language":"Java","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":"GoogleCloudPlatform:master","ref":"master","sha":"6e25709f99a32fa7a23357dc6ae97d4a0eb8ceea","user":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"repo":{"id":26181278,"name":"gcloud-java","full_name":"GoogleCloudPlatform/gcloud-java","owner":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleCloudPlatform/gcloud-java","description":"Google Cloud Client Library for Java","fork":false,"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java","forks_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/forks","keys_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/teams","hooks_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/hooks","issue_events_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/events","assignees_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/tags","blobs_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/languages","stargazers_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/stargazers","contributors_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/contributors","subscribers_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/subscribers","subscription_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/subscription","commits_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/merges","archive_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/downloads","issues_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/labels{/name}","releases_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/releases{/id}","created_at":"2014-11-04T17:57:16Z","updated_at":"2015-10-05T17:41:55Z","pushed_at":"2015-10-26T21:42:32Z","git_url":"git://github.com/GoogleCloudPlatform/gcloud-java.git","ssh_url":"git@github.com:GoogleCloudPlatform/gcloud-java.git","clone_url":"https://github.com/GoogleCloudPlatform/gcloud-java.git","svn_url":"https://github.com/GoogleCloudPlatform/gcloud-java","homepage":"http://googlecloudplatform.github.io/gcloud-java/","size":207352,"stargazers_count":35,"watchers_count":35,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":23,"mirror_url":null,"open_issues_count":67,"forks":23,"open_issues":67,"watchers":35,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/294"},"html":{"href":"https://github.com/GoogleCloudPlatform/gcloud-java/pull/294"},"issue":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues/294"},"comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues/294/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/294/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/294/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/statuses/0b77a08a844575f052ed62770e3c51955855ce7a"}}}}