Beispiel #1
0
        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
                       ));
        }
Beispiel #2
0
 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
         )
 {
 }
Beispiel #3
0
 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;
 }
Beispiel #4
0
        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))
                       ));
        }
Beispiel #5
0
        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);
            };
        }