@@ -120,11 +120,9 @@ public RestorableState<CopyWriter> capture() {
120120 serviceOptions ,
121121 BlobId .fromPb (rewriteResponse .rewriteRequest .source ),
122122 rewriteResponse .rewriteRequest .sourceOptions ,
123- BlobId . of ( rewriteResponse .rewriteRequest .targetBucket ,
124- rewriteResponse .rewriteRequest .targetName ),
123+ rewriteResponse .rewriteRequest .overrideInfo ,
124+ BlobInfo . fromPb ( rewriteResponse .rewriteRequest .target ),
125125 rewriteResponse .rewriteRequest .targetOptions )
126- .targetInfo (rewriteResponse .rewriteRequest .targetObject != null
127- ? BlobInfo .fromPb (rewriteResponse .rewriteRequest .targetObject ) : null )
128126 .result (rewriteResponse .result != null ? BlobInfo .fromPb (rewriteResponse .result ) : null )
129127 .blobSize (blobSize ())
130128 .isDone (isDone ())
@@ -141,8 +139,8 @@ static class StateImpl implements RestorableState<CopyWriter>, Serializable {
141139 private final StorageOptions serviceOptions ;
142140 private final BlobId source ;
143141 private final Map <StorageRpc .Option , ?> sourceOptions ;
144- private final BlobId targetId ;
145- private final BlobInfo targetInfo ;
142+ private final boolean overrideInfo ;
143+ private final BlobInfo target ;
146144 private final Map <StorageRpc .Option , ?> targetOptions ;
147145 private final BlobInfo result ;
148146 private final long blobSize ;
@@ -155,8 +153,8 @@ static class StateImpl implements RestorableState<CopyWriter>, Serializable {
155153 this .serviceOptions = builder .serviceOptions ;
156154 this .source = builder .source ;
157155 this .sourceOptions = builder .sourceOptions ;
158- this .targetId = builder .targetId ;
159- this .targetInfo = builder .targetInfo ;
156+ this .overrideInfo = builder .overrideInfo ;
157+ this .target = builder .target ;
160158 this .targetOptions = builder .targetOptions ;
161159 this .result = builder .result ;
162160 this .blobSize = builder .blobSize ;
@@ -171,9 +169,9 @@ static class Builder {
171169 private final StorageOptions serviceOptions ;
172170 private final BlobId source ;
173171 private final Map <StorageRpc .Option , ?> sourceOptions ;
174- private final BlobId targetId ;
172+ private final boolean overrideInfo ;
173+ private BlobInfo target ;
175174 private final Map <StorageRpc .Option , ?> targetOptions ;
176- private BlobInfo targetInfo ;
177175 private BlobInfo result ;
178176 private long blobSize ;
179177 private boolean isDone ;
@@ -182,20 +180,16 @@ static class Builder {
182180 private Long megabytesCopiedPerChunk ;
183181
184182 private Builder (StorageOptions options , BlobId source ,
185- Map <StorageRpc .Option , ?> sourceOptions ,
186- BlobId targetId , Map <StorageRpc .Option , ?> targetOptions ) {
183+ Map <StorageRpc .Option , ?> sourceOptions , boolean overrideInfo , BlobInfo target ,
184+ Map <StorageRpc .Option , ?> targetOptions ) {
187185 this .serviceOptions = options ;
188186 this .source = source ;
189187 this .sourceOptions = sourceOptions ;
190- this .targetId = targetId ;
188+ this .overrideInfo = overrideInfo ;
189+ this .target = target ;
191190 this .targetOptions = targetOptions ;
192191 }
193192
194- Builder targetInfo (BlobInfo targetInfo ) {
195- this .targetInfo = targetInfo ;
196- return this ;
197- }
198-
199193 Builder result (BlobInfo result ) {
200194 this .result = result ;
201195 return this ;
@@ -232,16 +226,15 @@ RestorableState<CopyWriter> build() {
232226 }
233227
234228 static Builder builder (StorageOptions options , BlobId source ,
235- Map <StorageRpc .Option , ?> sourceOptions , BlobId targetId ,
229+ Map <StorageRpc .Option , ?> sourceOptions , boolean overrideInfo , BlobInfo target ,
236230 Map <StorageRpc .Option , ?> targetOptions ) {
237- return new Builder (options , source , sourceOptions , targetId , targetOptions );
231+ return new Builder (options , source , sourceOptions , overrideInfo , target , targetOptions );
238232 }
239233
240234 @ Override
241235 public CopyWriter restore () {
242236 RewriteRequest rewriteRequest = new RewriteRequest (source .toPb (), sourceOptions ,
243- targetId .bucket (), targetId .name (), targetInfo != null ? targetInfo .toPb () : null ,
244- targetOptions , megabytesCopiedPerChunk );
237+ overrideInfo , target .toPb (), targetOptions , megabytesCopiedPerChunk );
245238 RewriteResponse rewriteResponse = new RewriteResponse (rewriteRequest ,
246239 result != null ? result .toPb () : null , blobSize , isDone , rewriteToken ,
247240 totalBytesCopied );
@@ -250,7 +243,7 @@ public CopyWriter restore() {
250243
251244 @ Override
252245 public int hashCode () {
253- return Objects .hash (serviceOptions , source , sourceOptions , targetId , targetInfo ,
246+ return Objects .hash (serviceOptions , source , sourceOptions , overrideInfo , target ,
254247 targetOptions , result , blobSize , isDone , megabytesCopiedPerChunk , rewriteToken ,
255248 totalBytesCopied );
256249 }
@@ -267,8 +260,8 @@ public boolean equals(Object obj) {
267260 return Objects .equals (this .serviceOptions , other .serviceOptions )
268261 && Objects .equals (this .source , other .source )
269262 && Objects .equals (this .sourceOptions , other .sourceOptions )
270- && Objects .equals (this .targetId , other .targetId )
271- && Objects .equals (this .targetInfo , other .targetInfo )
263+ && Objects .equals (this .overrideInfo , other .overrideInfo )
264+ && Objects .equals (this .target , other .target )
272265 && Objects .equals (this .targetOptions , other .targetOptions )
273266 && Objects .equals (this .result , other .result )
274267 && Objects .equals (this .rewriteToken , other .rewriteToken )
@@ -282,8 +275,8 @@ public boolean equals(Object obj) {
282275 public String toString () {
283276 return MoreObjects .toStringHelper (this )
284277 .add ("source" , source )
285- .add ("targetId " , targetId )
286- .add ("targetInfo " , targetInfo )
278+ .add ("overrideInfo " , overrideInfo )
279+ .add ("target " , target )
287280 .add ("result" , result )
288281 .add ("blobSize" , blobSize )
289282 .add ("isDone" , isDone )
0 commit comments