public static IJob Create( JobResponse jobResponse, ITransferItemSource transferItemSource, ITransferrer transferrer) { var blobs = Blob.Convert(jobResponse); var rangesForRequests = blobs.ToLookup(b => b, b => b.Range); return(new FullObjectJob( jobResponse.BucketName, jobResponse.JobId, transferItemSource, transferrer, rangesForRequests, blobs )); }
public FullObjectJob( string bucketName, Guid jobId, ITransferItemSource transferItemSource, ITransferrer transferrer, ILookup <Blob, Range> rangesForRequests, IEnumerable <ContextRange <string> > itemsToTrack) : base( bucketName, jobId, transferItemSource, transferrer, rangesForRequests, new RequestToObjectRangeTranslator(rangesForRequests), itemsToTrack ) { }
public PartialReadJob( string bucketName, Guid jobId, ITransferItemSource transferItemSource, ILookup <Blob, Range> rangesForRequests, IEnumerable <Ds3PartialObject> allItems, IEnumerable <ContextRange <Ds3PartialObject> > itemsToTrack) : base( bucketName, jobId, transferItemSource, new PartialReadTransferrer(), rangesForRequests, new RequestToObjectRangeTranslator(rangesForRequests) .ComposedWith(new ObjectToPartRangeTranslator(allItems)), itemsToTrack ) { this.AllItems = allItems; }
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)) )); }
protected Job( string bucketName, Guid jobId, ITransferItemSource transferItemSource, ITransferrer transferrer, ILookup <Blob, Range> rangesForRequests, IRangeTranslator <Blob, TItem> rangeTranslator, IEnumerable <ContextRange <TItem> > itemsToTrack) { this.BucketName = bucketName; this.JobId = jobId; this._transferItemSource = transferItemSource; this._transferrer = transferrer; this._rangesForRequests = rangesForRequests; this._rangeTranslator = rangeTranslator; this._itemTracker = new JobItemTracker <TItem>(itemsToTrack); this._itemTracker.DataTransferred += size => this.DataTransferred.Call(size); this._itemTracker.ItemCompleted += item => { this._resourceStore.Close(item); this.ItemCompleted.Call(item); }; }