Examples of PayloadSlice


Examples of org.jclouds.glacier.blobstore.strategy.PayloadSlice

      BaseSlicingStrategy slicer = new BaseSlicingStrategy(new BasePayloadSlicer());
      slicer.startSlicing(buildPayload(100 * MiB));

      long offset = 0;
      while (slicer.hasNext()) {
         PayloadSlice slice = slicer.nextSlice();
         long expectedLength = (slicer.hasNext() ? 8 : 4) * MiB;
         assertThat(slice.getPayload().getContentMetadata().getContentLength()).isEqualTo(expectedLength);
         assertThat(slice.getRange()).isEqualTo(ContentRange.build(offset, offset + expectedLength - 1));
         offset += expectedLength;
      }
   }
View Full Code Here

Examples of org.jclouds.glacier.blobstore.strategy.PayloadSlice

      BaseSlicingStrategy slicer = new BaseSlicingStrategy(new BasePayloadSlicer());
      slicer.startSlicing(buildPayload(2000 * MiB));

      long offset = 0;
      while (slicer.hasNext()) {
         PayloadSlice slice = slicer.nextSlice();
         long expectedLength = (slicer.hasNext() ? 32 : 16) * MiB;
         assertThat(slice.getPayload().getContentMetadata().getContentLength()).isEqualTo(expectedLength);
         assertThat(slice.getRange()).isEqualTo(ContentRange.build(offset, offset + expectedLength - 1));
         offset += expectedLength;
      }
   }
View Full Code Here

Examples of org.jclouds.glacier.blobstore.strategy.PayloadSlice

      BaseSlicingStrategy slicer = new BaseSlicingStrategy(new BasePayloadSlicer());
      slicer.startSlicing(buildPayload(2 * MiB));

      long offset = 0;
      while (slicer.hasNext()) {
         PayloadSlice slice = slicer.nextSlice();
         long expectedLength = 1 * MiB;
         assertThat(slice.getPayload().getContentMetadata().getContentLength()).isEqualTo(expectedLength);
         assertThat(slice.getRange()).isEqualTo(ContentRange.build(offset, offset + expectedLength - 1));
         offset += expectedLength;
      }
   }
View Full Code Here

Examples of org.jclouds.glacier.blobstore.strategy.PayloadSlice

      BaseSlicingStrategy slicer = new BaseSlicingStrategy(new BasePayloadSlicer());
      slicer.startSlicing(buildPayload(40000 * GiB));

      long offset = 0;
      while (slicer.hasNext()) {
         PayloadSlice slice = slicer.nextSlice();
         long expectedLength = 4096 * MiB;
         assertThat(slice.getPayload().getContentMetadata().getContentLength()).isEqualTo(expectedLength);
         assertThat(slice.getRange()).isEqualTo(ContentRange.build(offset, offset + expectedLength - 1));
         offset += expectedLength;
      }
   }
View Full Code Here

Examples of org.jclouds.glacier.blobstore.strategy.PayloadSlice

      String uploadId = client.initiateMultipartUpload(container, slicer.getPartSizeInMB(),
            blob.getMetadata().getName());
      try {
         ImmutableMap.Builder<Integer, HashCode> hashes = ImmutableMap.builder();
         while (slicer.hasNext()) {
            PayloadSlice slice = slicer.nextSlice();
            hashes.put(slice.getPart(),
                  client.uploadPart(container, uploadId, slice.getRange(), slice.getPayload()));
         }
         return client.completeMultipartUpload(container, uploadId, hashes.build(),
               blob.getPayload().getContentMetadata().getContentLength());
      } catch (RuntimeException exception) {
         client.abortMultipartUpload(container, uploadId);
View Full Code Here

Examples of org.jclouds.glacier.blobstore.strategy.PayloadSlice

      long sliceLength = Math.min(getRemaining(), partSizeInMB << 20);
      Payload slicedPayload = slicer.slice(payload, copied, sliceLength);
      ContentRange range = ContentRange.build(copied, copied + sliceLength - 1);
      copied += sliceLength;
      part++;
      return new PayloadSlice(slicedPayload, range, part);
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.