public static IPartialReadJob Create( JobResponse jobResponse, IEnumerable <string> fullObjects, IEnumerable <Ds3PartialObject> partialObjects, ITransferItemSource transferItemSource) { var blobs = Blob.Convert(jobResponse).ToList(); var allItems = partialObjects .Concat(PartialObjectRangeUtilities.ObjectPartsForFullObjects(fullObjects, blobs)) .ToList(); return(new PartialReadJob( jobResponse.BucketName, jobResponse.JobId, transferItemSource, PartialObjectRangeUtilities.RangesForRequests(blobs, allItems), allItems, allItems.Select(po => ContextRange.Create(Range.ByLength(0L, po.Range.Length), po)) )); }
public void ObjectPartsForFullObjectsReturnsExpectedParts() { var fullObjects = new[] { "foo", "bar", "baz" }; var blobs = new[] { new Blob(Range.ByLength(10L, 10L), "hello"), new Blob(Range.ByLength(0L, 123L), "baz"), new Blob(Range.ByLength(15L, 15L), "bar"), new Blob(Range.ByLength(100L, 10L), "foo"), new Blob(Range.ByLength(0L, 15L), "bar"), new Blob(Range.ByLength(0L, 100L), "foo"), }; CollectionAssert.AreEquivalent( new[] { new Ds3PartialObject(Range.ByLength(0L, 123L), "baz"), new Ds3PartialObject(Range.ByLength(0L, 110L), "foo"), new Ds3PartialObject(Range.ByLength(0L, 30L), "bar"), }, PartialObjectRangeUtilities.ObjectPartsForFullObjects(fullObjects, blobs) ); }