Example #1
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 #2
0
        private IEnumerator <IAsyncResult> GetPropertiesImpl(BlobPropertyNames propertyNames, IBlobObjectCondition condition, AsyncIteratorContext <NoResults> context)
        {
            IAsyncResult asyncResult;

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

            try
            {
                this.blob.EndGetProperties(asyncResult);
            }
            catch (Exception exception1)
            {
                StorageStamp.TranslateException(exception1);
                throw;
            }
        }
Example #3
0
        private IEnumerator <IAsyncResult> ListBlobsImpl(string blobNamePrefix, BlobPropertyNames propertyNames, string separator, string blobNameStart, DateTime?snapshotStart, IBlobObjectCondition condition, int maxBlobNames, BlobServiceVersion version, AsyncIteratorContext <IBlobObjectCollection> context)
        {
            IAsyncResult asyncResult;

            try
            {
                asyncResult = this.InternalContainer.BeginListBlobs(blobNamePrefix, propertyNames, separator, blobNameStart, snapshotStart, Helpers.Convert(condition), maxBlobNames, version, context.GetResumeCallback(), context.GetResumeState("BlobContainer.ListBlobsImpl"));
            }
            catch (Exception exception)
            {
                StorageStamp.TranslateException(exception);
                throw;
            }
            yield return(asyncResult);

            try
            {
                IBlobObjectCollection blobObjectCollections = this.InternalContainer.EndListBlobs(asyncResult);
                context.ResultData = new BlobObjectCollection(blobObjectCollections);
            }
            catch (Exception exception1)
            {
                StorageStamp.TranslateException(exception1);
                throw;
            }
        }
Example #4
0
        public IAsyncResult BeginGetProperties(BlobPropertyNames propertyNames, IBlobObjectCondition condition, AsyncCallback callback, object state)
        {
            AsyncIteratorContext <NoResults> asyncIteratorContext = new AsyncIteratorContext <NoResults>("RealBlobObject.GetProperties", callback, state);

            asyncIteratorContext.Begin(this.GetPropertiesImpl(propertyNames, condition, asyncIteratorContext));
            return(asyncIteratorContext);
        }
Example #5
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 #6
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 #7
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 #8
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);
        }
Example #9
0
        private IEnumerator <IAsyncResult> ListBlobsImpl(string blobNamePrefix, BlobPropertyNames propertyNames, string separator, string blobNameStart, DateTime?snapshotStart, IBlobObjectCondition condition, int maxBlobNames, BlobServiceVersion version, AsyncIteratorContext <IBlobObjectCollection> context)
        {
            IStringDataEventStream verboseDebug = Logger <INormalAndDebugLogger> .Instance.VerboseDebug;

            object[] objArray = new object[] { blobNamePrefix, propertyNames, separator, blobNameStart, snapshotStart, condition, maxBlobNames, this.Timeout };
            verboseDebug.Log("ListBlobsImpl({0},{1},{2},{3},{4},{5},{6},{7})", objArray);
            IAsyncResult asyncResult = this.StorageManager.AsyncProcessor.BeginExecute <DbBlobObjectCollection>((TimeSpan param0) => {
                DbBlobObjectCollection dbBlobObjectCollections;
                using (DevelopmentStorageDbDataContext dbContext = DevelopmentStorageDbDataContext.GetDbContext())
                {
                    this.LoadBlobContainer(dbContext);
                    IQueryable <Blob> blobs = this.MakeListBlobsQuery(blobNamePrefix, blobNameStart, snapshotStart, separator, condition, maxBlobNames, dbContext);
                    dbBlobObjectCollections = this.ReadListBlobsResult(blobNamePrefix, separator, maxBlobNames, blobs);
                }
                return(dbBlobObjectCollections);
            }, this.Timeout, context.GetResumeCallback(), context.GetResumeState("DbBlobContainer.ListBlobs"));

            yield return(asyncResult);

            context.ResultData = this.StorageManager.AsyncProcessor.EndExecute <DbBlobObjectCollection>(asyncResult);
        }
Example #10
0
        IAsyncResult Microsoft.Cis.Services.Nephos.Common.Storage.IBlobContainer.BeginListBlobs(string blobNamePrefix, BlobPropertyNames propertyNames, string separator, string blobNameStart, DateTime?snapshotStart, IBlobObjectCondition condition, int maxBlobNames, BlobServiceVersion version, AsyncCallback callback, object state)
        {
            AsyncIteratorContext <IBlobObjectCollection> asyncIteratorContext = new AsyncIteratorContext <IBlobObjectCollection>("DbBlobContainer.ListBlobs", callback, state);

            asyncIteratorContext.Begin(this.ListBlobsImpl(blobNamePrefix, propertyNames, separator, blobNameStart, snapshotStart, condition, maxBlobNames, version, asyncIteratorContext));
            return(asyncIteratorContext);
        }
Example #11
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 #12
0
 public abstract IAsyncResult BeginGetPageRangeList(IAccountIdentifier identifier, string account, string container, string blob, long offset, long length, BlobPropertyNames additionalPropertyNames, BlobObjectCondition condition, DateTime?snapshot, int maxPageRanges, DateTime?prevSnapshotTimestamp, bool isRangeCompressed, bool skipClearPages, TimeSpan timeout, RequestContext requestContext, AsyncCallback callback, object state);
Example #13
0
 public abstract IAsyncResult BeginGetBlob(IAccountIdentifier identifier, string account, string container, string blob, Stream outputStream, long startOffset, long numberOfBytes, bool isCalculatingCrc64ForRange, bool isCalculatingMD5ForRange, BlobPropertyNames additionalPropertyNames, BlobObjectCondition condition, DateTime?snapshot, TimeSpan timeout, bool excludeNonSystemHeaders, Microsoft.Cis.Services.Nephos.Storage.Service.ServiceManager.ServiceManager.InterceptBlobProperties interceptBlobPropertiesCallback, Microsoft.Cis.Services.Nephos.Storage.Service.ServiceManager.ServiceManager.InterceptRangeCrc64 interceptRangeCrc64Callback, Microsoft.Cis.Services.Nephos.Storage.Service.ServiceManager.ServiceManager.InterceptRangeMD5 interceptRangeMD5Callback, RequestContext requestContext, AsyncCallback callback, object state);
Example #14
0
 public abstract IAsyncResult BeginGetBlob(IAccountIdentifier identifier, string account, string container, string blob, Stream outputStream, BlobPropertyNames additionalPropertyNames, BlobObjectCondition condition, DateTime?snapshot, TimeSpan timeout, bool excludeNonSystemHeaders, Microsoft.Cis.Services.Nephos.Storage.Service.ServiceManager.ServiceManager.InterceptBlobProperties interceptBlobPropertiesCallback, RequestContext requestContext, AsyncCallback callback, object state);