Example #1
0
        public IAsyncResult BeginPutPage(IBlobRegion blobRegion, Stream inputStream, CrcReaderStream crcReaderStream, IBlobObjectCondition condition, AsyncCallback callback, object state)
        {
            AsyncIteratorContext <NoResults> asyncIteratorContext = new AsyncIteratorContext <NoResults>("IndexBlobObject.PutPage", callback, state);

            asyncIteratorContext.Begin(this.PutPageImpl(blobRegion, inputStream, crcReaderStream, condition, asyncIteratorContext));
            return(asyncIteratorContext);
        }
Example #2
0
        private IEnumerator <IAsyncResult> ClearPageImpl(IBlobRegion blobRegion, IBlobObjectCondition condition, AsyncIteratorContext <NoResults> context)
        {
            IAsyncResult asyncResult;

            try
            {
                asyncResult = ((IIndexBlobObject)this.blob).BeginClearPage(blobRegion, Helpers.Convert(condition), context.GetResumeCallback(), context.GetResumeState("IndexBlobObject.ClearPageImpl"));
            }
            catch (Exception exception)
            {
                StorageStamp.TranslateException(exception);
                throw;
            }
            yield return(asyncResult);

            try
            {
                ((IIndexBlobObject)this.blob).EndClearPage(asyncResult);
            }
            catch (Exception exception1)
            {
                StorageStamp.TranslateException(exception1);
                throw;
            }
        }
Example #3
0
        public IAsyncResult BeginClearPage(IBlobRegion blobRegion, IBlobObjectCondition condition, AsyncCallback callback, object state)
        {
            AsyncIteratorContext <NoResults> asyncIteratorContext = new AsyncIteratorContext <NoResults>("IndexBlobObject.ClearPage", callback, state);

            asyncIteratorContext.Begin(this.ClearPageImpl(blobRegion, condition, asyncIteratorContext));
            return(asyncIteratorContext);
        }
Example #4
0
        public IAsyncResult BeginGetPageRangeList(IBlobRegion blobRegion, BlobPropertyNames additionalPropertyNames, IBlobObjectCondition condition, int maxPageRanges, DateTime?prevSnapshotTimestamp, bool isRangeCompressed, bool skipClearPages, AsyncCallback callback, object state)
        {
            AsyncIteratorContext <IPageRangeCollection> asyncIteratorContext = new AsyncIteratorContext <IPageRangeCollection>("IndexBlobObject.GetPageRangeList", callback, state);

            asyncIteratorContext.Begin(this.GetPageRangeListImpl(blobRegion, additionalPropertyNames, condition, maxPageRanges, prevSnapshotTimestamp, isRangeCompressed, skipClearPages, asyncIteratorContext));
            return(asyncIteratorContext);
        }
Example #5
0
        private IEnumerator <IAsyncResult> GetPageRangeListImpl(IBlobRegion blobRegion, BlobPropertyNames additionalPropertyNames, IBlobObjectCondition condition, int maxPageRanges, DateTime?prevSnapshotTimestamp, bool isRangeCompressed, bool skipClearPages, AsyncIteratorContext <IPageRangeCollection> context)
        {
            IAsyncResult asyncResult;

            try
            {
                asyncResult = ((IIndexBlobObject)this.blob).BeginGetPageRangeList(blobRegion, additionalPropertyNames, Helpers.Convert(condition), maxPageRanges, prevSnapshotTimestamp, isRangeCompressed, skipClearPages, context.GetResumeCallback(), context.GetResumeState("IndexBlobObject.GetPageRangeListImpl"));
            }
            catch (Exception exception)
            {
                StorageStamp.TranslateException(exception);
                throw;
            }
            yield return(asyncResult);

            try
            {
                context.ResultData = ((IIndexBlobObject)this.blob).EndGetPageRangeList(asyncResult);
            }
            catch (Exception exception1)
            {
                StorageStamp.TranslateException(exception1);
                throw;
            }
        }
Example #6
0
        private IEnumerator <IAsyncResult> GetBlobImpl(IBlobRegion blobRegion, BlobPropertyNames propertyNames, IBlobObjectCondition condition, AsyncIteratorContext <CrcStream> context)
        {
            IAsyncResult asyncResult;

            try
            {
                asyncResult = this.blob.BeginGetBlob(blobRegion, propertyNames, Helpers.Convert(condition), context.GetResumeCallback(), context.GetResumeState("RealBlobObject.GetBlobImpl"));
            }
            catch (Exception exception)
            {
                StorageStamp.TranslateException(exception);
                throw;
            }
            yield return(asyncResult);

            try
            {
                context.ResultData = this.blob.EndGetBlob(asyncResult);
            }
            catch (Exception exception1)
            {
                StorageStamp.TranslateException(exception1);
                throw;
            }
        }
Example #7
0
        public IAsyncResult BeginGetBlob(IBlobRegion blobRegion, BlobPropertyNames propertyNames, IBlobObjectCondition condition, AsyncCallback callback, object state)
        {
            AsyncIteratorContext <CrcStream> asyncIteratorContext = new AsyncIteratorContext <CrcStream>("RealBlobObject.GetBlob", callback, state);

            asyncIteratorContext.Begin(this.GetBlobImpl(blobRegion, propertyNames, condition, asyncIteratorContext));
            return(asyncIteratorContext);
        }
Example #8
0
        public IAsyncResult BeginGetPageRangeList(IBlobRegion blobRegion, BlobPropertyNames additionalPropertyNames, IBlobObjectCondition condition, int maxPageRanges, AsyncCallback callback, object state)
        {
            AsyncIteratorContext <IPageRangeCollection> asyncIteratorContext = new AsyncIteratorContext <IPageRangeCollection>("IndexBlobObject.GetPageRangeList", callback, state);
            DateTime?nullable = null;

            asyncIteratorContext.Begin(this.GetPageRangeListImpl(blobRegion, additionalPropertyNames, condition, maxPageRanges, nullable, true, true, asyncIteratorContext));
            return(asyncIteratorContext);
        }
Example #9
0
        private IEnumerator <IAsyncResult> GetBlobImpl(IBlobRegion blobRegion, BlobPropertyNames propertyNames, IBlobObjectCondition condition, AsyncIteratorContext <CrcStream> context)
        {
            IAsyncResult asyncResult = this._storageManager.AsyncProcessor.BeginExecute <CrcStream>((TimeSpan param0) => {
                CrcStream streamFromByteArray;
                using (TransactionScope transactionScope = new TransactionScope())
                {
                    using (DevelopmentStorageDbDataContext dbContext = DevelopmentStorageDbDataContext.GetDbContext())
                    {
                        base.LoadContainer(dbContext);
                        BlockBlob blockBlob = base.LoadBlockBlob(dbContext);
                        if (blobRegion == null)
                        {
                            blobRegion = new BlobRegion((long)0, blockBlob.ContentLength);
                        }
                        else if (blobRegion.Offset > blockBlob.ContentLength || blobRegion.Offset == blockBlob.ContentLength && blockBlob.ContentLength > (long)0)
                        {
                            throw new InvalidBlobRegionException(new long?(blobRegion.Offset), "Offset value is greater than the contentlength");
                        }
                        BlobLeaseInfo blobLeaseInfo = new BlobLeaseInfo(blockBlob, DateTime.UtcNow);
                        DbBlobObject.CheckConditionsAndReturnResetRequired(blockBlob, blobLeaseInfo, condition, null, false);
                        long offset = blobRegion.Offset;
                        long num    = Math.Min(offset + blobRegion.Length, blockBlob.ContentLength);
                        IOrderedQueryable <CommittedBlock> committedBlocks =
                            from b in dbContext.CommittedBlocks
                            where (b.AccountName == this._blob.AccountName) && (b.ContainerName == this._blob.ContainerName) && (b.BlobName == this._blob.BlobName) && (b.VersionTimestamp == this._blob.VersionTimestamp) && (long?)b.Offset + b.Length >= (long?)offset && b.Offset < num
                            orderby b.Offset
                            select b;
                        byte[] bytesFromCommittedBlocks = this.GetBytesFromCommittedBlocks(dbContext, offset, num, committedBlocks);
                        transactionScope.Complete();
                        this._blob          = blockBlob;
                        this.LeaseInfo      = blobLeaseInfo;
                        streamFromByteArray = DbStorageHelper.GetStreamFromByteArray(bytesFromCommittedBlocks);
                    }
                }
                return(streamFromByteArray);
            }, base.Timeout, context.GetResumeCallback(), context.GetResumeState("DbListBlobObject.GetBlob"));

            yield return(asyncResult);

            context.ResultData = this._storageManager.AsyncProcessor.EndExecute <CrcStream>(asyncResult);
        }