public IAsyncResult BeginGetBlockList(IBlobObjectCondition condition, BlockListTypes blockListTypes, BlobServiceVersion blobServiceVersion, AsyncCallback callback, object state) { AsyncIteratorContext <IBlockLists> asyncIteratorContext = new AsyncIteratorContext <IBlockLists>("RealBlobObject.GetBlockList", callback, state); asyncIteratorContext.Begin(this.GetBlockListImpl(condition, blockListTypes, blobServiceVersion, asyncIteratorContext)); return(asyncIteratorContext); }
private IEnumerator <IAsyncResult> GetBlockListImpl(IBlobObjectCondition condition, BlockListTypes blockListTypes, BlobServiceVersion blobServiceVersion, AsyncIteratorContext <IBlockLists> context) { IAsyncResult asyncResult; try { asyncResult = ((IListBlobObject)this.blob).BeginGetBlockList(Helpers.Convert(condition), blockListTypes, blobServiceVersion, context.GetResumeCallback(), context.GetResumeState("RealBlobObject.GetBlockListImpl")); } catch (Exception exception) { StorageStamp.TranslateException(exception); throw; } yield return(asyncResult); try { context.ResultData = ((IListBlobObject)this.blob).EndGetBlockList(asyncResult); } catch (Exception exception1) { StorageStamp.TranslateException(exception1); throw; } }
/// <summary> /// Convert the BlockListTypes into a BlockListType. /// </summary> /// <param name="options"></param> /// <returns>The BlockList response.</returns> internal static BlockListType ToBlockListType(this BlockListTypes options) => options switch {
IAsyncResult Microsoft.Cis.Services.Nephos.Common.Storage.IListBlobObject.BeginGetBlockList(IBlobObjectCondition condition, BlockListTypes blockListTypes, BlobServiceVersion blobServiceVersion, AsyncCallback callback, object state) { AsyncIteratorContext <IBlockLists> asyncIteratorContext = new AsyncIteratorContext <IBlockLists>("DbListBlobObject.GetBlockList", callback, state); asyncIteratorContext.Begin(this.GetBlockListImpl(condition, blockListTypes, blobServiceVersion, asyncIteratorContext)); return(asyncIteratorContext); }
private IEnumerator <IAsyncResult> GetBlockListImpl(IBlobObjectCondition condition, BlockListTypes blockListTypes, BlobServiceVersion blobServiceVersion, AsyncIteratorContext <IBlockLists> context) { IAsyncResult asyncResult = this._storageManager.AsyncProcessor.BeginExecute <BlockLists>((TimeSpan param0) => { BlockLists blockList; using (TransactionScope transactionScope = new TransactionScope()) { using (DevelopmentStorageDbDataContext dbContext = DevelopmentStorageDbDataContext.GetDbContext()) { base.LoadContainer(dbContext); BlockBlob blockBlob = base.LoadBlockBlob(dbContext, true); BlobLeaseInfo blobLeaseInfo = new BlobLeaseInfo(blockBlob, DateTime.UtcNow); DbBlobObject.CheckConditionsAndReturnResetRequired(blockBlob, blobLeaseInfo, condition, null, false); BlockLists dbBlockCollections = new BlockLists() { BlobLastModificationTime = blockBlob.LastModificationTime.Value, BlobSize = blockBlob.ContentLength }; if ((blockListTypes & BlockListTypes.Committed) != BlockListTypes.None) { List <IBlock> blocks = new List <IBlock>(); if (blockBlob.HasBlock.Value) { foreach (CommittedBlock committedBlock in from blck in dbContext.CommittedBlocks where (blck.AccountName == this._blob.AccountName) && (blck.ContainerName == this._blob.ContainerName) && (blck.BlobName == this._blob.BlobName) && (blck.VersionTimestamp == this._blob.VersionTimestamp) select blck) { blocks.Add(new Block(DbListBlobObject.FromHexString(committedBlock.BlockId), committedBlock.Length.Value)); } } dbBlockCollections.CommittedBlockList = new DbListBlobObject.DbBlockCollection(blocks); } if ((blockListTypes & BlockListTypes.Uncommitted) != BlockListTypes.None) { List <IBlock> blocks1 = new List <IBlock>(); foreach (BlockData blockDatum in from blck in dbContext.BlocksData where (blck.AccountName == this._blob.AccountName) && (blck.ContainerName == this._blob.ContainerName) && (blck.BlobName == this._blob.BlobName) && (blck.VersionTimestamp == this._blob.VersionTimestamp) && !blck.IsCommitted select blck) { blocks1.Add(new Block(DbListBlobObject.FromHexString(blockDatum.BlockId), blockDatum.Length.Value)); } dbBlockCollections.UncommittedBlockList = new DbListBlobObject.DbBlockCollection(blocks1); } transactionScope.Complete(); this._blob = blockBlob; this.LeaseInfo = blobLeaseInfo; blockList = dbBlockCollections; } } return(blockList); }, base.Timeout, context.GetResumeCallback(), context.GetResumeState("DbListBlobObject.GetBlockList")); yield return(asyncResult); context.ResultData = this._storageManager.AsyncProcessor.EndExecute <BlockLists>(asyncResult); }
public abstract IAsyncResult BeginGetBlockList(IAccountIdentifier identifier, string account, string container, string blob, BlockListTypes blockListTypes, BlobServiceVersion blobServiceVersion, BlobObjectCondition condition, DateTime?snapshot, TimeSpan timeout, RequestContext requestContext, AsyncCallback callback, object state);