private BlobResultSegment GetNextHeartbeats(CloudBlobDirectory directory, BlobContinuationToken currentToken) { const int batchSize = 100; try { return directory.ListBlobsSegmented(useFlatBlobListing: true, blobListingDetails: BlobListingDetails.None, maxResults: batchSize, currentToken: currentToken, options: null, operationContext: null); } catch (StorageException exception) { if (exception.IsNotFound()) { return null; } else { throw; } } }
public static void ListAllFilesFromDirectory() { var cloudStorage = Microsoft.WindowsAzure.Storage.CloudStorageAccount.Parse(connsctionString); var cloudBlobClient = cloudStorage.CreateCloudBlobClient(); var cloudBlobContainer = cloudBlobClient.GetContainerReference("donmablogsample"); var resultCreateContainer = cloudBlobContainer.CreateIfNotExistsAsync().Result; Console.WriteLine("donmablogsample create already."); Microsoft.WindowsAzure.Storage.Blob.CloudBlobDirectory cloudBlobDirectory = cloudBlobContainer.GetDirectoryReference("TEST2/TEST21/"); var res = new List <string>(); //這種方法在 Azure Storge 包括 table 很常使用 Microsoft.WindowsAzure.Storage.Blob.BlobContinuationToken continuationToken = null; do { var listingResult = cloudBlobDirectory.ListBlobsSegmentedAsync(continuationToken).Result; continuationToken = listingResult.ContinuationToken; res.AddRange(listingResult.Results.Select(x => System.IO.Path.GetFileName(x.Uri.AbsolutePath)).ToList()); }while (continuationToken != null); Console.WriteLine("Result: " + string.Join("\r\n", res)); }
public BlobResultSegment ListBlobsSegmented(string prefix, bool useFlatListing, BlobListingDetails blobListingDetails, int? maxResults, BlobContinuationToken continuationToken, BlobRequestOptions blobRequestOptions, OperationContext operationContext) { return _client.ListBlobsSegmented(prefix, useFlatListing, blobListingDetails, maxResults, continuationToken, blobRequestOptions, operationContext); }
/// <summary> /// Returns an enumerable collection of the blobs in the container that are retrieved asynchronously. /// </summary> /// <param name="blobDirectory">Cloud blob directory.</param> /// <param name="cloudBlobs">List of cloud blobs.</param> /// <param name="useFlatBlobListing">Whether to list blobs in a flat listing, or whether to list blobs hierarchically, by virtual directory.</param> /// <param name="blobListingDetails"> /// A <see cref="T:Microsoft.WindowsAzure.Storage.Blob.BlobListingDetails" /> enumeration describing which items to include in the listing. /// </param> /// <param name="maxResults"> /// A non-negative integer value that indicates the maximum number of results to be returned at a time, up to the /// per-operation limit of 5000. If this value is null, the maximum possible number of results will be returned, up to 5000. /// </param> /// <param name="continuationToken">Continuation token.</param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns> /// An enumerable collection of objects that implement <see cref="T:Microsoft.WindowsAzure.Storage.Blob.IListBlobItem" /> that are retrieved. /// </returns> private static Task<List<IListBlobItem>> ListBlobsImplAsync( this CloudBlobDirectory blobDirectory, List<IListBlobItem> cloudBlobs, bool useFlatBlobListing, BlobListingDetails blobListingDetails, int? maxResults, BlobContinuationToken continuationToken, CancellationToken cancellationToken = default (CancellationToken)) { return blobDirectory .ListBlobsSegmentedAsync(useFlatBlobListing, blobListingDetails, maxResults, continuationToken, cancellationToken) .Then(result => { cancellationToken.ThrowIfCancellationRequested(); cloudBlobs.AddRange(result.Results); // Checks whether maxresults entities has been received if (maxResults.HasValue && cloudBlobs.Count >= maxResults.Value) { return TaskHelpers.FromResult(cloudBlobs.Take(maxResults.Value).ToList()); } // Checks whether enumeration has been completed if (result.ContinuationToken != null) { return ListBlobsImplAsync(blobDirectory, cloudBlobs, useFlatBlobListing, blobListingDetails, maxResults, continuationToken, cancellationToken); } return TaskHelpers.FromResult(cloudBlobs); }); }
public static IAzureBlobResultSegment ListBlobsSegmentedAsync( string containerDirectory, string searchDirectory, string prefix, BlobListing blobListing, BlobListingDetails blobListingDetails, int? maxResults, BlobContinuationToken currentToken) { if (blobListing == BlobListing.Hierarchical && (blobListingDetails & BlobListingDetails.Snapshots) == BlobListingDetails.Snapshots) { throw new ArgumentException("Listing snapshots is only supported in flat mode."); } var numberToSkip = DetermineNumberToSkip(currentToken); var resultSegment = blobListing == BlobListing.Flat ? FindFilesFlattened(containerDirectory, searchDirectory, prefix, maxResults, numberToSkip) : FindFilesHierarchical(containerDirectory, searchDirectory, prefix, maxResults, numberToSkip); if ((blobListingDetails & BlobListingDetails.Metadata) == BlobListingDetails.Metadata) { foreach (var blob in resultSegment.Results.OfType<StandaloneAzureBlockBlob>()) { blob.FetchAttributes(); } } return resultSegment; }
private Task<BlobResultSegment> ListBlobsSegmented(string prefix, bool useFlatBlobListing, BlobListingDetails blobListingDetails, int? maxResults, BlobContinuationToken continuationToken, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken = default(CancellationToken)) { return AsyncTaskUtil.RunAsyncCancellable<BlobResultSegment>( _inner.BeginListBlobsSegmented(prefix, useFlatBlobListing, blobListingDetails, maxResults, continuationToken, options, operationContext, null, null), _inner.EndListBlobsSegmented, cancellationToken); }
private Task<ContainerResultSegment> ListContainersSegmented(string prefix, ContainerListingDetails detailsIncluded, int? maxResults, BlobContinuationToken continuationToken, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken = default(CancellationToken)) { return AsyncTaskUtil.RunAsyncCancellable<ContainerResultSegment>( _inner.BeginListContainersSegmented(prefix, detailsIncluded, maxResults, continuationToken, options, operationContext, null, null), _inner.EndListContainersSegmented, cancellationToken); }
/// <inheritdoc /> public Task<IStorageBlobResultSegment> ListBlobsSegmentedAsync(string prefix, bool useFlatBlobListing, BlobListingDetails blobListingDetails, int? maxResults, BlobContinuationToken currentToken, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) { Task<BlobResultSegment> sdkTask = _sdk.ListBlobsSegmentedAsync(prefix, useFlatBlobListing, blobListingDetails, maxResults, currentToken, options, operationContext, cancellationToken); return ListBlobsSegmentedAsyncCore(sdkTask); }
public async Task<IAzureBlobResultSegment> ListBlobsSegmentedAsync(BlobListing blobListing, BlobListingDetails blobListingDetails, int? maxResults, BlobContinuationToken currentToken) { return new HostedAzureBlobResultSegment(await _cloudBlobDirectory.ListBlobsSegmentedAsync( blobListing == BlobListing.Flat, blobListingDetails, maxResults, currentToken, null, null)); }
private static int DetermineNumberToSkip(BlobContinuationToken currentToken) { if (currentToken == null) { return 0; } int numberToSkip; return Int32.TryParse(currentToken.NextMarker, out numberToSkip) ? numberToSkip : 0; }
public Task<IAzureBlobResultSegment> ListBlobsSegmentedAsync(BlobListing blobListing, BlobListingDetails blobListingDetails, int? maxResults, BlobContinuationToken currentToken) { return Task.FromResult(StandaloneList.ListBlobsSegmentedAsync( _containerDirectory, _directoryPath, "", blobListing, blobListingDetails, maxResults, currentToken)); }
public static void RecovertDataJson3() { var cloudStorage = Microsoft.WindowsAzure.Storage.CloudStorageAccount.Parse(connsctionString); var cloudBlobClient = cloudStorage.CreateCloudBlobClient(); var cloudBlobContainer = cloudBlobClient.GetContainerReference("donmablogsample"); //建立如果不存在的話 var resultCreateContainer = cloudBlobContainer.CreateIfNotExistsAsync().Result; Console.WriteLine("donmablogsample create already."); Microsoft.WindowsAzure.Storage.Blob.CloudBlobDirectory cloudBlobDirectory = cloudBlobContainer.GetDirectoryReference("TEST2/TEST21/"); var bbReference = cloudBlobDirectory.GetBlockBlobReference("sampleText3.json"); var res = new List <CloudBlockBlob>(); Microsoft.WindowsAzure.Storage.Blob.BlobContinuationToken continuationToken = null; do { //只看 TEST2/TEST21/sampleText3.json 的快照 var listingResult = cloudBlobContainer.ListBlobsSegmentedAsync("TEST2/TEST21/sampleText3.json", true, Microsoft.WindowsAzure.Storage.Blob.BlobListingDetails.Snapshots, 100, continuationToken, null, new Microsoft.WindowsAzure.Storage.OperationContext { }).Result; continuationToken = listingResult.ContinuationToken; res.AddRange(listingResult.Results.Select(x => (x as Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob)).ToList()); }while (continuationToken != null); foreach (var r in res) { r.FetchAttributesAsync().GetAwaiter().GetResult(); Console.WriteLine("Meta-tag:" + (r.Metadata.ContainsKey("tag") ? (r.Metadata["tag"]) : "") + "," + r.DownloadTextAsync().Result + ";" + " IsSnapShot:" + r.IsSnapshot); } //Recovery from tag:9 //還原 tag 9 的快照 var bFileInfo = cloudBlobDirectory.GetBlockBlobReference("sampleText3.json"); foreach (var r in res) { if (r.IsSnapshot && r.Metadata.ContainsKey("tag")) { if (r.Metadata["tag"] == "9") { var copyResult = bFileInfo.StartCopyAsync(r).Result; Console.WriteLine("Copy Result:" + copyResult); } } } }
public StandaloneAzureBlobResultSegment(IEnumerable<IAzureListBlobItem> results, BlobContinuationToken continuationToken) { if (results == null) { throw new ArgumentNullException("results"); } if (continuationToken == null) { throw new ArgumentNullException("continuationToken"); } Results = results; ContinuationToken = continuationToken; }
public Task<IAzureBlobResultSegment> ListBlobsSegmentedAsync(string prefix, BlobListing blobListing, BlobListingDetails blobListingDetails, int? maxResults, BlobContinuationToken currentToken) { if (blobListing == BlobListing.Hierarchical && (blobListingDetails & BlobListingDetails.Snapshots) == BlobListingDetails.Snapshots) { throw new ArgumentException("Listing snapshots is only supported in flat mode."); } var numberToSkip = DetermineNumberToSkip(currentToken); var resultSegment = blobListing == BlobListing.Flat ? FindFilesFlattened(prefix, maxResults, numberToSkip) : FindFilesHierarchical(prefix, maxResults, numberToSkip); return Task.FromResult((IAzureBlobResultSegment) resultSegment); }
public static string Serialize(BlobContinuationToken token) { if (token == null) { return null; } // Include TargetLocation in serialized form to ensure consistent results for RA-GRS accounts. (Without it, // each request could see different sides of eventually consisent replication). // See: http://blogs.msdn.com/b/windowsazurestorage/archive/2013/12/04/ (ignore source line break) // introducing-read-access-geo-replicated-storage-ra-grs-for-windows-azure-storage.aspx // Prefix the NextMarker with a single character indicating TargetLocation. return Serialize(token.TargetLocation) + token.NextMarker; }
public IObservable<AsyncCloudBlobContainer> ListContainers(string prefix, ContainerListingDetails detailsIncluded, int? maxResults, BlobRequestOptions options, OperationContext operationContext) { return Observable.Create<AsyncCloudBlobContainer>( async (observer, ct) => { var containerToken = new BlobContinuationToken(); while (containerToken != null) { var results = await ListContainersSegmented(prefix, detailsIncluded, maxResults, containerToken, options, operationContext, ct); foreach (var result in results.Results) { observer.OnNext(new AsyncCloudBlobContainer(result)); } containerToken = results.ContinuationToken; } }); }
public IObservable<IAsyncListBlobItem> ListBlobs(string prefix, bool useFlatBlobListing, BlobListingDetails blobListingDetails = BlobListingDetails.None, int? maxResults = null, BlobRequestOptions options = null, OperationContext operationContext = null) { return Observable.Create<IAsyncListBlobItem>( async (observer, ct) => { var containerToken = new BlobContinuationToken(); while (containerToken != null) { var results = await ListBlobsSegmented(prefix, useFlatBlobListing, blobListingDetails, maxResults, containerToken, options, operationContext, ct); foreach (var result in results.Results) { observer.OnNext(AsyncListBlobItemHelpers.FromIListBlobItem(result)); } containerToken = results.ContinuationToken; } }); }
public Task<IStorageBlobResultSegment> ListBlobsSegmentedAsync(string prefix, bool useFlatBlobListing, BlobListingDetails blobListingDetails, int? maxResults, BlobContinuationToken currentToken, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) { if (options != null) { throw new NotImplementedException(); } if (operationContext != null) { throw new NotImplementedException(); } Func<string, IStorageBlobContainer> containerFactory = (n) => new FakeStorageBlobContainer(_store, n, this); IStorageBlobResultSegment segment = _store.ListBlobsSegmented(containerFactory, prefix, useFlatBlobListing, blobListingDetails, maxResults, currentToken); return Task.FromResult(segment); }
/// <summary> /// Returns a result segment containing a collection of blob items in the container asynchronously. /// </summary> /// <param name="blobDirectory">Cloud blob directory.</param> /// <param name="useFlatBlobListing">Whether to list blobs in a flat listing, or whether to list blobs hierarchically, by virtual directory.</param> /// <param name="blobListingDetails"> /// A <see cref="T:Microsoft.WindowsAzure.Storage.Blob.BlobListingDetails" /> enumeration describing which items to include in the listing. /// </param> /// <param name="maxResults"> /// A non-negative integer value that indicates the maximum number of results to be returned at a time, up to the /// per-operation limit of 5000. If this value is <c>null</c>, the maximum possible number of results will be returned, up to 5000. /// </param> /// <param name="continuationToken">A continuation token returned by a previous listing operation.</param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns> /// The ID of the acquired lease. /// </returns> public static Task<BlobResultSegment> ListBlobsSegmentedAsync( this CloudBlobDirectory blobDirectory, bool useFlatBlobListing, BlobListingDetails blobListingDetails, int? maxResults, BlobContinuationToken continuationToken, CancellationToken cancellationToken = default (CancellationToken)) { ICancellableAsyncResult asyncResult = blobDirectory.BeginListBlobsSegmented(useFlatBlobListing, blobListingDetails, maxResults, continuationToken, null, null, null, null); CancellationTokenRegistration registration = cancellationToken.Register(p => asyncResult.Cancel(), null); return Task<BlobResultSegment>.Factory.FromAsync( asyncResult, result => { registration.Dispose(); return blobDirectory.EndListBlobsSegmented(result); }); }
public IStorageBlobResultSegment ListBlobsSegmented(Func<string, IStorageBlobContainer> containerFactory, string prefix, bool useFlatBlobListing, BlobListingDetails blobListingDetails, int? maxResults, BlobContinuationToken currentToken) { if (prefix == null) { throw new ArgumentNullException("prefix"); } if (!useFlatBlobListing) { throw new NotImplementedException(); } if (maxResults.HasValue) { throw new NotImplementedException(); } if (blobListingDetails != BlobListingDetails.None && blobListingDetails != BlobListingDetails.Metadata) { throw new NotImplementedException(); } if (prefix.StartsWith("$logs/")) { return null; } if (prefix.Contains("/")) { throw new NotImplementedException(); } if (!_items.ContainsKey(prefix)) { return null; } IStorageBlobContainer parent = containerFactory.Invoke(prefix); IEnumerable<IStorageBlob> results = _items[prefix].ListBlobs(this, parent, blobListingDetails); return new StorageBlobResultSegment(null, results); }
public Task<IStorageBlobResultSegment> ListBlobsSegmentedAsync(string prefix, bool useFlatBlobListing, BlobListingDetails blobListingDetails, int? maxResults, BlobContinuationToken currentToken, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) { if (options != null) { throw new NotImplementedException(); } if (operationContext != null) { throw new NotImplementedException(); } string fullPrefix; if (!String.IsNullOrEmpty(prefix)) { fullPrefix = _containerName + "/" + prefix; } else { fullPrefix = _containerName; } Func<string, IStorageBlobContainer> containerFactory = (name) => { if (name != _containerName) { throw new InvalidOperationException(); } return this; }; IStorageBlobResultSegment segment = _store.ListBlobsSegmented(containerFactory, fullPrefix, useFlatBlobListing, blobListingDetails, maxResults, currentToken); return Task.FromResult(segment); }
/// <summary> /// Async get container permission /// </summary> /// <param name="container">CloudBlobContainer object</param> /// <param name="taskId">Task id</param> /// <param name="context">Azure storage context</param> /// <returns></returns> internal async Task GetContainerPermission(long taskId, IStorageBlobManagement localChannel, CloudBlobContainer container, BlobContinuationToken continuationToken) { BlobRequestOptions requestOptions = RequestOptions; AccessCondition accessCondition = null; BlobContainerPermissions permissions = null; try { permissions = await localChannel.GetContainerPermissionsAsync(container, accessCondition, requestOptions, OperationContext, CmdletCancellationToken); } catch (StorageException e) { if (!e.IsNotFoundException()) { throw; } //404 Not found means we don't have permission to query the Permission of the specified container. } WriteCloudContainerObject(taskId, localChannel, container, permissions, continuationToken); }
public ContainerResultSegment ListContainersSegmented(string prefix, ContainerListingDetails detailsIncluded, int? maxResults, BlobContinuationToken currentToken, BlobRequestOptions options = null, OperationContext operationContext = null) { BlobRequestOptions modifiedOptions = BlobRequestOptions.ApplyDefaults(options, BlobType.Unspecified, this); ResultSegment<CloudBlobContainer> resultSegment = this.ListContainersSegmentedCore(prefix, detailsIncluded, maxResults, currentToken, modifiedOptions, operationContext); return new ContainerResultSegment(resultSegment.Results, (BlobContinuationToken)resultSegment.ContinuationToken); }
public virtual Task <ContainerResultSegment> ListContainersSegmentedAsync(string prefix, ContainerListingDetails detailsIncluded, int?maxResults, BlobContinuationToken currentToken, BlobRequestOptions options, OperationContext operationContext) { return(this.ListContainersSegmentedAsync(prefix, detailsIncluded, maxResults, currentToken, options, operationContext, CancellationToken.None)); }
internal BlobResultSegment(IEnumerable <IListBlobItem> blobs, BlobContinuationToken continuationToken) { throw new System.NotImplementedException(); }
public ICancellableAsyncResult BeginListContainersSegmented(string prefix, ContainerListingDetails detailsIncluded, int?maxResults, BlobContinuationToken continuationToken, BlobRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state) { BlobRequestOptions modifiedOptions = BlobRequestOptions.ApplyDefaults(options, BlobType.Unspecified, this); return(Executor.BeginExecuteAsync( this.ListContainersImpl(prefix, detailsIncluded, continuationToken, maxResults, modifiedOptions), modifiedOptions.RetryPolicy, operationContext, callback, state)); }
/// <summary> /// Core implementation for the ListContainers method. /// </summary> /// <param name="prefix">The container prefix.</param> /// <param name="detailsIncluded">The details included.</param> /// <param name="currentToken">The continuation token.</param> /// <param name="maxResults">A non-negative integer value that indicates the maximum number of results to be returned at a time, up to the /// per-operation limit of 5000. If this value is <c>null</c>, the maximum possible number of results will be returned, up to 5000.</param> /// <param name="options">A <see cref="BlobRequestOptions"/> object that specifies execution options, such as retry policy and timeout settings, for the operation.</param> /// <returns>A <see cref="TaskSequence"/> that lists the containers.</returns> private RESTCommand <ResultSegment <CloudBlobContainer> > ListContainersImpl(string prefix, ContainerListingDetails detailsIncluded, BlobContinuationToken currentToken, int?maxResults, BlobRequestOptions options) { ListingContext listingContext = new ListingContext(prefix, maxResults) { Marker = currentToken != null ? currentToken.NextMarker : null }; RESTCommand <ResultSegment <CloudBlobContainer> > getCmd = new RESTCommand <ResultSegment <CloudBlobContainer> >(this.Credentials, this.StorageUri); options.ApplyToStorageCommand(getCmd); getCmd.CommandLocationMode = CommonUtility.GetListingLocationMode(currentToken); getCmd.RetrieveResponseStream = true; getCmd.BuildRequest = (cmd, uri, builder, cnt, serverTimeout, ctx) => ContainerHttpRequestMessageFactory.List(uri, serverTimeout, listingContext, detailsIncluded, cnt, ctx, this.GetCanonicalizer(), this.Credentials); getCmd.PreProcessResponse = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp, null /* retVal */, cmd, ex); getCmd.PostProcessResponse = (cmd, resp, ctx) => { ListContainersResponse listContainersResponse = new ListContainersResponse(cmd.ResponseStream); List <CloudBlobContainer> containersList = listContainersResponse.Containers.Select(item => new CloudBlobContainer(item.Properties, item.Metadata, item.Name, this)).ToList(); BlobContinuationToken continuationToken = null; if (listContainersResponse.NextMarker != null) { continuationToken = new BlobContinuationToken() { NextMarker = listContainersResponse.NextMarker, TargetLocation = cmd.CurrentResult.TargetLocation, }; } return(Task.FromResult(new ResultSegment <CloudBlobContainer>(containersList) { ContinuationToken = continuationToken, })); }; return(getCmd); }
public IAsyncOperation <ContainerResultSegment> ListContainersSegmentedAsync(BlobContinuationToken currentToken) { return(this.ListContainersSegmentedAsync(null /* prefix */, ContainerListingDetails.None, null /* maxResults */, currentToken, null /* options */, null /* operationContext */)); }
public ICancellableAsyncResult BeginListBlobsSegmented(string prefix, BlobContinuationToken currentToken, AsyncCallback callback, object state) { return this.BeginListBlobsSegmented(prefix, false, BlobListingDetails.None, null /* maxResults */, currentToken, null /* options */, null /* operationContext */, callback, state); }
public IAsyncOperation <BlobResultSegment> ListBlobsSegmentedAsync(string prefix, BlobContinuationToken currentToken) { return(this.ListBlobsSegmentedAsync(prefix, false, BlobListingDetails.None, null /* maxResults */, currentToken, null /* options */, null /* operationContext */)); }
/// <summary> /// Core implementation for the ListContainers method. /// </summary> /// <param name="prefix">The container prefix.</param> /// <param name="detailsIncluded">The details included.</param> /// <param name="currentToken">The continuation token.</param> /// <param name="maxResults">A non-negative integer value that indicates the maximum number of results to be returned at a time, up to the /// per-operation limit of 5000. If this value is <c>null</c>, the maximum possible number of results will be returned, up to 5000.</param> /// <param name="options">A <see cref="BlobRequestOptions"/> object that specifies execution options, such as retry policy and timeout settings, for the operation.</param> /// <returns>A <see cref="TaskSequence"/> that lists the containers.</returns> private RESTCommand <ResultSegment <CloudBlobContainer> > ListContainersImpl(string prefix, ContainerListingDetails detailsIncluded, BlobContinuationToken currentToken, int?maxResults, BlobRequestOptions options) { ListingContext listingContext = new ListingContext(prefix, maxResults) { Marker = currentToken != null ? currentToken.NextMarker : null }; RESTCommand <ResultSegment <CloudBlobContainer> > getCmd = new RESTCommand <ResultSegment <CloudBlobContainer> >(this.Credentials, this.BaseUri); getCmd.ApplyRequestOptions(options); getCmd.RetrieveResponseStream = true; getCmd.Handler = this.AuthenticationHandler; getCmd.BuildClient = HttpClientFactory.BuildHttpClient; getCmd.BuildRequest = (cmd, cnt, ctx) => ContainerHttpRequestMessageFactory.List(cmd.Uri, cmd.ServerTimeoutInSeconds, listingContext, detailsIncluded, cnt, ctx); getCmd.PreProcessResponse = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp, null /* retVal */, cmd, ex); getCmd.PostProcessResponse = (cmd, resp, ctx) => { return(Task.Factory.StartNew(() => { ListContainersResponse listContainersResponse = new ListContainersResponse(cmd.ResponseStream); List <CloudBlobContainer> containersList = new List <CloudBlobContainer>( listContainersResponse.Containers.Select(item => new CloudBlobContainer(item.Properties, item.Metadata, item.Name, this))); BlobContinuationToken continuationToken = null; if (listContainersResponse.NextMarker != null) { continuationToken = new BlobContinuationToken() { NextMarker = listContainersResponse.NextMarker, }; } return new ResultSegment <CloudBlobContainer>(containersList) { ContinuationToken = continuationToken, }; })); }; return(getCmd); }
public IAsyncOperation <ContainerResultSegment> ListContainersSegmentedAsync(string prefix, ContainerListingDetails detailsIncluded, int?maxResults, BlobContinuationToken currentToken, BlobRequestOptions options, OperationContext operationContext) { return(AsyncInfo.Run(async(token) => { BlobRequestOptions modifiedOptions = BlobRequestOptions.ApplyDefaults(options, BlobType.Unspecified, this); ResultSegment <CloudBlobContainer> resultSegment = await Executor.ExecuteAsync( this.ListContainersImpl(prefix, detailsIncluded, currentToken, maxResults, modifiedOptions), modifiedOptions.RetryPolicy, operationContext, token); return new ContainerResultSegment(resultSegment.Results, (BlobContinuationToken)resultSegment.ContinuationToken); })); }
public ICancellableAsyncResult BeginListContainersSegmented(BlobContinuationToken continuationToken, AsyncCallback callback, object state) { return(this.BeginListContainersSegmented(null /* prefix */, ContainerListingDetails.None, null /* maxResults */, continuationToken, null /* options */, null /* operationContext */, callback, state)); }
internal ContainerResultSegment(IEnumerable <CloudBlobContainer> containers, BlobContinuationToken continuationToken) { throw new System.NotImplementedException(); }
public ICancellableAsyncResult BeginListContainersSegmented(BlobContinuationToken continuationToken, AsyncCallback callback, object state) { return this.BeginListContainersSegmented(null /* prefix */, ContainerListingDetails.None, null /* maxResults */, continuationToken, null /* options */, null /* operationContext */, callback, state); }
public void CloudBlobDirectoryFlatListingAPM() { foreach (String delimiter in Delimiters) { CloudBlobClient client = GenerateCloudBlobClient(); client.DefaultDelimiter = delimiter; string name = GetRandomContainerName(); CloudBlobContainer container = client.GetContainerReference(name); try { container.Create(); if (CloudBlobDirectorySetupWithDelimiter(container, delimiter)) { using (AutoResetEvent waitHandle = new AutoResetEvent(false)) { IAsyncResult result; BlobContinuationToken token = null; CloudBlobDirectory directory = container.GetDirectoryReference("TopDir1"); List <IListBlobItem> list1 = new List <IListBlobItem>(); do { result = directory.BeginListBlobsSegmented(token, ar => waitHandle.Set(), null); waitHandle.WaitOne(); BlobResultSegment result1 = directory.EndListBlobsSegmented(result); list1.AddRange(result1.Results); token = result1.ContinuationToken; }while (token != null); Assert.IsTrue(list1.Count == 3); IListBlobItem item11 = list1.ElementAt(0); Assert.IsTrue(item11.Uri.Equals(container.Uri + "/TopDir1" + delimiter + "Blob1")); IListBlobItem item12 = list1.ElementAt(1); Assert.IsTrue(item12.Uri.Equals(container.Uri + "/TopDir1" + delimiter + "MidDir1" + delimiter)); IListBlobItem item13 = list1.ElementAt(2); Assert.IsTrue(item13.Uri.Equals(container.Uri + "/TopDir1" + delimiter + "MidDir2" + delimiter)); CloudBlobDirectory midDir2 = (CloudBlobDirectory)item13; List <IListBlobItem> list2 = new List <IListBlobItem>(); do { result = midDir2.BeginListBlobsSegmented(true, BlobListingDetails.None, null, token, null, null, ar => waitHandle.Set(), null); waitHandle.WaitOne(); BlobResultSegment result2 = midDir2.EndListBlobsSegmented(result); list2.AddRange(result2.Results); token = result2.ContinuationToken; }while (token != null); Assert.IsTrue(list2.Count == 2); IListBlobItem item41 = list2.ElementAt(0); Assert.IsTrue(item41.Uri.Equals(container.Uri + "/TopDir1" + delimiter + "MidDir2" + delimiter + "EndDir1" + delimiter + "EndBlob1")); IListBlobItem item42 = list2.ElementAt(1); Assert.IsTrue(item42.Uri.Equals(container.Uri + "/TopDir1" + delimiter + "MidDir2" + delimiter + "EndDir2" + delimiter + "EndBlob2")); } } } finally { container.DeleteIfExists(); } } }
public BlobResultSegment ListBlobsSegmented(string prefix, BlobContinuationToken currentToken) { return this.ListBlobsSegmented(prefix, false, BlobListingDetails.None, null /* maxResults */, currentToken, null /* options */, null /* operationContext */); }
/// <summary> /// Returns a result segment containing a collection of containers /// whose names begin with the specified prefix. /// </summary> /// <param name="prefix">The container name prefix.</param> /// <param name="detailsIncluded">A value that indicates whether to return container metadata with the listing.</param> /// <param name="maxResults">A non-negative integer value that indicates the maximum number of results to be returned /// in the result segment, up to the per-operation limit of 5000. If this value is null, the maximum possible number of results will be returned, up to 5000.</param> /// <param name="continuationToken">A continuation token returned by a previous listing operation.</param> /// <param name="options">A <see cref="BlobRequestOptions"/> object that specifies execution options, such as retry policy and timeout settings, for the operation.</param> /// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param> /// <returns>A result segment of containers.</returns> private ResultSegment <CloudBlobContainer> ListContainersSegmentedCore(string prefix, ContainerListingDetails detailsIncluded, int?maxResults, BlobContinuationToken continuationToken, BlobRequestOptions options, OperationContext operationContext) { return(Executor.ExecuteSync( this.ListContainersImpl(prefix, detailsIncluded, continuationToken, maxResults, options), options.RetryPolicy, operationContext)); }
/// <summary> /// Core implementation for the ListContainers method. /// </summary> /// <param name="prefix">The container prefix.</param> /// <param name="detailsIncluded">The details included.</param> /// <param name="currentToken">The continuation token.</param> /// <param name="maxResults">A non-negative integer value that indicates the maximum number of results to be returned /// in the result segment, up to the per-operation limit of 5000. If this value is null, the maximum possible number of results will be returned, up to 5000.</param> /// <param name="options">A <see cref="BlobRequestOptions"/> object that specifies any additional options for the request.</param> /// <returns>A <see cref="ResultSegment{T}"/> that lists the containers.</returns> private RESTCommand<ResultSegment<CloudBlobContainer>> ListContainersImpl(string prefix, ContainerListingDetails detailsIncluded, BlobContinuationToken currentToken, int? maxResults, BlobRequestOptions options) { ListingContext listingContext = new ListingContext(prefix, maxResults) { Marker = currentToken != null ? currentToken.NextMarker : null }; RESTCommand<ResultSegment<CloudBlobContainer>> getCmd = new RESTCommand<ResultSegment<CloudBlobContainer>>(this.Credentials, this.BaseUri); getCmd.ApplyRequestOptions(options); getCmd.RetrieveResponseStream = true; getCmd.BuildRequestDelegate = (uri, builder, serverTimeout, ctx) => ContainerHttpWebRequestFactory.List(uri, serverTimeout, listingContext, detailsIncluded, ctx); getCmd.SignRequest = this.AuthenticationHandler.SignRequest; getCmd.PreProcessResponse = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp, null /* retVal */, cmd, ex, ctx); getCmd.PostProcessResponse = (cmd, resp, ex, ctx) => { ListContainersResponse listContainersResponse = new ListContainersResponse(cmd.ResponseStream); List<CloudBlobContainer> containersList = new List<CloudBlobContainer>( listContainersResponse.Containers.Select(item => new CloudBlobContainer(item.Properties, item.Metadata, item.Name, this))); BlobContinuationToken continuationToken = null; if (listContainersResponse.NextMarker != null) { continuationToken = new BlobContinuationToken() { NextMarker = listContainersResponse.NextMarker, }; } return new ResultSegment<CloudBlobContainer>(containersList) { ContinuationToken = continuationToken, }; }; return getCmd; }
public virtual Task <BlobResultSegment> ListBlobsSegmentedAsync(BlobContinuationToken currentToken, CancellationToken cancellationToken) { return(this.Container.ListBlobsSegmentedAsync(this.Prefix, false /*useFlatBlobListDetails*/, BlobListingDetails.None, null /*maxResults*/, currentToken, default(BlobRequestOptions), default(OperationContext), cancellationToken)); }
public virtual Task <BlobResultSegment> ListBlobsSegmentedAsync(string prefix, bool useFlatBlobListing, BlobListingDetails blobListingDetails, int?maxResults, BlobContinuationToken currentToken, BlobRequestOptions options, OperationContext operationContext) { string containerName; string listingPrefix; CloudBlobClient.ParseUserPrefix(prefix, out containerName, out listingPrefix); CloudBlobContainer container = this.GetContainerReference(containerName); return(container.ListBlobsSegmentedAsync(listingPrefix, useFlatBlobListing, blobListingDetails, maxResults, currentToken, options, operationContext)); }
public virtual Task <BlobResultSegment> ListBlobsSegmentedAsync(bool useFlatBlobListing, BlobListingDetails blobListingDetails, int?maxResults, BlobContinuationToken currentToken, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) { return(this.Container.ListBlobsSegmentedAsync(this.Prefix, useFlatBlobListing, blobListingDetails, maxResults, currentToken, options, operationContext, cancellationToken)); }
public virtual Task <ContainerResultSegment> ListContainersSegmentedAsync(string prefix, BlobContinuationToken currentToken) { return(this.ListContainersSegmentedAsync(prefix, ContainerListingDetails.None, null /* maxResults */, currentToken, null /* options */, null /* operationContext */)); }
public virtual BlobResultSegment ListBlobsSegmented(BlobContinuationToken currentToken) { return(this.ListBlobsSegmented(false, BlobListingDetails.None, null /* maxResults */, currentToken, null /* options */, null /* operationContext */)); }
public void CloudBlobSoftDeleteNoSnapshotTask() { CloudBlobContainer container = GetRandomContainerReference(); try { //Enables a delete retention policy on the blob with 1 day of default retention days container.ServiceClient.EnableSoftDelete(); container.CreateAsync().Wait(); // Upload some data to the blob. MemoryStream originalData = new MemoryStream(GetRandomBuffer(1024)); CloudAppendBlob appendBlob = container.GetAppendBlobReference(BlobName); appendBlob.CreateOrReplaceAsync().Wait(); appendBlob.AppendBlockAsync(originalData, null).Wait(); CloudBlob blob = container.GetBlobReference(BlobName); Assert.IsTrue(blob.ExistsAsync().Result); Assert.IsFalse(blob.IsDeleted); blob.DeleteAsync().Wait(); Assert.IsFalse(blob.ExistsAsync().Result); int blobCount = 0; BlobContinuationToken ct = null; do { foreach (IListBlobItem item in container.ListBlobsSegmentedAsync (null, true, BlobListingDetails.All, null, ct, null, null) .Result .Results .ToList()) { CloudAppendBlob blobItem = (CloudAppendBlob)item; Assert.AreEqual(blobItem.Name, BlobName); Assert.IsTrue(blobItem.IsDeleted); Assert.IsNotNull(blobItem.Properties.DeletedTime); Assert.AreEqual(blobItem.Properties.RemainingDaysBeforePermanentDelete, 0); blobCount++; } } while (ct != null); Assert.AreEqual(blobCount, 1); blob.UndeleteAsync().Wait(); blob.FetchAttributes(); Assert.IsFalse(blob.IsDeleted); Assert.IsNull(blob.Properties.DeletedTime); Assert.IsNull(blob.Properties.RemainingDaysBeforePermanentDelete); blobCount = 0; ct = null; do { foreach (IListBlobItem item in container.ListBlobsSegmentedAsync (null, true, BlobListingDetails.All, null, ct, null, null) .Result .Results .ToList()) { CloudAppendBlob blobItem = (CloudAppendBlob)item; Assert.AreEqual(blobItem.Name, BlobName); Assert.IsFalse(blobItem.IsDeleted); Assert.IsNull(blobItem.Properties.DeletedTime); Assert.IsNull(blobItem.Properties.RemainingDaysBeforePermanentDelete); blobCount++; } } while (ct != null); Assert.AreEqual(blobCount, 1); } finally { container.ServiceClient.DisableSoftDelete(); container.DeleteIfExists(); } }
public virtual BlobResultSegment ListBlobsSegmented(bool useFlatBlobListing, BlobListingDetails blobListingDetails, int?maxResults, BlobContinuationToken currentToken, BlobRequestOptions options, OperationContext operationContext) { return(this.Container.ListBlobsSegmented(this.Prefix, useFlatBlobListing, blobListingDetails, maxResults, currentToken, options, operationContext)); }
public Task <BlobResultSegment> ListBlobsSegmentedAsync(bool useFlatBlobListing, BlobListingDetails blobListingDetails, int?maxResults, BlobContinuationToken currentToken, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) { return(AsyncExtensions.TaskFromApm(this.BeginListBlobsSegmented, this.EndListBlobsSegmented, useFlatBlobListing, blobListingDetails, maxResults, currentToken, options, operationContext, cancellationToken)); }
public virtual ICancellableAsyncResult BeginListBlobsSegmented(BlobContinuationToken currentToken, AsyncCallback callback, object state) { return(this.BeginListBlobsSegmented(false, BlobListingDetails.None, null /* maxResults */, currentToken, null /* options */, null /* operationContext */, callback, state)); }
public ContainerResultSegment ListContainersSegmented(BlobContinuationToken currentToken) { return this.ListContainersSegmented(null /* prefix */, ContainerListingDetails.None, null /* maxResults */, currentToken, null /* options */, null /* operationContext */); }
internal ContainerResultSegment(IEnumerable <CloudBlobContainer> containers, BlobContinuationToken continuationToken) { this.Results = containers; this.ContinuationToken = continuationToken; }
/// <summary> /// Returns a result segment containing a collection of containers /// whose names begin with the specified prefix. /// </summary> /// <param name="prefix">The container name prefix.</param> /// <param name="detailsIncluded">A value that indicates whether to return container metadata with the listing.</param> /// <param name="maxResults">A non-negative integer value that indicates the maximum number of results to be returned /// in the result segment, up to the per-operation limit of 5000. If this value is null, the maximum possible number of results will be returned, up to 5000.</param> /// <param name="continuationToken">A continuation token returned by a previous listing operation.</param> /// <param name="options">A <see cref="BlobRequestOptions"/> object that specifies execution options, such as retry policy and timeout settings, for the operation.</param> /// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param> /// <returns>A result segment of containers.</returns> private ResultSegment<CloudBlobContainer> ListContainersSegmentedCore(string prefix, ContainerListingDetails detailsIncluded, int? maxResults, BlobContinuationToken continuationToken, BlobRequestOptions options, OperationContext operationContext) { return Executor.ExecuteSync( this.ListContainersImpl(prefix, detailsIncluded, continuationToken, maxResults, options), options.RetryPolicy, operationContext); }
public async Task CloudBlobClientListBlobsSegmentedWithPrefixAsync() { string name = "bb" + GetRandomContainerName(); CloudBlobClient blobClient = GenerateCloudBlobClient(); CloudBlobContainer rootContainer = blobClient.GetRootContainerReference(); CloudBlobContainer container = blobClient.GetContainerReference(name); try { await rootContainer.CreateIfNotExistsAsync(); await container.CreateAsync(); List <string> blobNames = await CreateBlobsAsync(container, 3, BlobType.BlockBlob); List <string> rootBlobNames = await CreateBlobsAsync(rootContainer, 2, BlobType.BlockBlob); BlobResultSegment results; BlobContinuationToken token = null; do { results = await blobClient.ListBlobsSegmentedAsync("bb", token); token = results.ContinuationToken; foreach (CloudBlockBlob blob in results.Results) { await blob.DeleteAsync(); rootBlobNames.Remove(blob.Name); } }while (token != null); Assert.AreEqual(0, rootBlobNames.Count); results = await blobClient.ListBlobsSegmentedAsync("bb", token); Assert.AreEqual(0, results.Results.Count()); Assert.IsNull(results.ContinuationToken); results = await blobClient.ListBlobsSegmentedAsync(name, token); Assert.AreEqual(0, results.Results.Count()); Assert.IsNull(results.ContinuationToken); token = null; do { results = await blobClient.ListBlobsSegmentedAsync(name + "/", token); token = results.ContinuationToken; foreach (CloudBlockBlob blob in results.Results) { Assert.IsTrue(blobNames.Remove(blob.Name)); } }while (token != null); Assert.AreEqual(0, blobNames.Count); } finally { container.DeleteIfExistsAsync().Wait(); } }
public ICancellableAsyncResult BeginListContainersSegmented(string prefix, ContainerListingDetails detailsIncluded, int? maxResults, BlobContinuationToken continuationToken, BlobRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state) { BlobRequestOptions modifiedOptions = BlobRequestOptions.ApplyDefaults(options, BlobType.Unspecified, this); return Executor.BeginExecuteAsync( this.ListContainersImpl(prefix, detailsIncluded, continuationToken, maxResults, modifiedOptions), modifiedOptions.RetryPolicy, operationContext, callback, state); }
public ContainerResultSegment ListContainersSegmented(string prefix, ContainerListingDetails detailsIncluded, int?maxResults, BlobContinuationToken currentToken, BlobRequestOptions options = null, OperationContext operationContext = null) { BlobRequestOptions modifiedOptions = BlobRequestOptions.ApplyDefaults(options, BlobType.Unspecified, this); ResultSegment <CloudBlobContainer> resultSegment = this.ListContainersSegmentedCore(prefix, detailsIncluded, maxResults, currentToken, modifiedOptions, operationContext); return(new ContainerResultSegment(resultSegment.Results, (BlobContinuationToken)resultSegment.ContinuationToken)); }
public BlobResultSegment ListBlobsSegmented(string prefix, bool useFlatBlobListing, BlobListingDetails blobListingDetails, int? maxResults, BlobContinuationToken currentToken, BlobRequestOptions options, OperationContext operationContext) { string containerName; string listingPrefix; CloudBlobClient.ParseUserPrefix(prefix, out containerName, out listingPrefix); CloudBlobContainer container = this.GetContainerReference(containerName); return container.ListBlobsSegmented(listingPrefix, useFlatBlobListing, blobListingDetails, maxResults, currentToken, options, operationContext); }
public void CloudBlobSoftDeleteSnapshotTask() { CloudBlobContainer container = GetRandomContainerReference(); try { //Enables a delete retention policy on the blob with 1 day of default retention days container.ServiceClient.EnableSoftDelete(); container.Create(); // Upload some data to the blob. MemoryStream originalData = new MemoryStream(GetRandomBuffer(1024)); CloudAppendBlob appendBlob = container.GetAppendBlobReference(BlobName); appendBlob.UploadFromStream(originalData); CloudBlob blob = container.GetBlobReference(BlobName); //create snapshot via api CloudBlob snapshot = blob.Snapshot(); //create snapshot via write protection appendBlob.UploadFromStream(originalData); //we should have 2 snapshots 1 regular and 1 deleted: there is no way to get only the deleted snapshots but the below listing will get both snapshot types int blobCount = 0; int deletedSnapshotCount = 0; int snapShotCount = 0; BlobContinuationToken ct = null; do { var resultSegments = container.ListBlobsSegmentedAsync (null, true, BlobListingDetails.Snapshots | BlobListingDetails.Deleted, null, ct, null, null); var blobs = resultSegments.Result .Results .ToList(); ct = resultSegments.Result.ContinuationToken; foreach (IListBlobItem item in blobs) { CloudAppendBlob blobItem = (CloudAppendBlob)item; Assert.AreEqual(blobItem.Name, BlobName); if (blobItem.IsSnapshot) { snapShotCount++; } if (blobItem.IsDeleted) { Assert.IsNotNull(blobItem.Properties.DeletedTime); Assert.AreEqual(blobItem.Properties.RemainingDaysBeforePermanentDelete, 0); deletedSnapshotCount++; } blobCount++; } } while (ct != null); Assert.AreEqual(3, blobCount); Assert.AreEqual(deletedSnapshotCount, 1); Assert.AreEqual(snapShotCount, 2); blobCount = 0; ct = null; do { foreach (IListBlobItem item in container.ListBlobsSegmentedAsync (null, true, BlobListingDetails.Snapshots, null, ct, null, null) .Result .Results .ToList()) { CloudAppendBlob blobItem = (CloudAppendBlob)item; Assert.AreEqual(blobItem.Name, BlobName); Assert.IsFalse(blobItem.IsDeleted); Assert.IsNull(blobItem.Properties.DeletedTime); Assert.IsNull(blobItem.Properties.RemainingDaysBeforePermanentDelete); blobCount++; } } while (ct != null); Assert.AreEqual(blobCount, 2); //Delete Blob and snapshots blob.Delete(DeleteSnapshotsOption.IncludeSnapshots); Assert.IsFalse(blob.Exists()); Assert.IsFalse(snapshot.Exists()); blobCount = 0; ct = null; do { foreach (IListBlobItem item in container.ListBlobsSegmentedAsync (null, true, BlobListingDetails.All, null, ct, null, null) .Result .Results .ToList()) { CloudAppendBlob blobItem = (CloudAppendBlob)item; Assert.AreEqual(blobItem.Name, BlobName); Assert.IsTrue(blobItem.IsDeleted); Assert.IsNotNull(blobItem.Properties.DeletedTime); Assert.AreEqual(blobItem.Properties.RemainingDaysBeforePermanentDelete, 0); blobCount++; } }while(ct != null); Assert.AreEqual(blobCount, 3); blob.Undelete(); blob.FetchAttributes(); Assert.IsFalse(blob.IsDeleted); Assert.IsNull(blob.Properties.DeletedTime); Assert.IsNull(blob.Properties.RemainingDaysBeforePermanentDelete); blobCount = 0; ct = null; do { foreach (IListBlobItem item in container.ListBlobsSegmentedAsync (null, true, BlobListingDetails.All, null, ct, null, null) .Result .Results .ToList()) { CloudAppendBlob blobItem = (CloudAppendBlob)item; Assert.AreEqual(blobItem.Name, BlobName); Assert.IsFalse(blobItem.IsDeleted); Assert.IsNull(blobItem.Properties.DeletedTime); Assert.IsNull(blobItem.Properties.RemainingDaysBeforePermanentDelete); blobCount++; } }while(ct != null); Assert.AreEqual(blobCount, 3); } finally { container.ServiceClient.DisableSoftDelete(); container.DeleteIfExists(); } }
public ICancellableAsyncResult BeginListBlobsSegmented(string prefix, bool useFlatBlobListing, BlobListingDetails blobListingDetails, int? maxResults, BlobContinuationToken currentToken, BlobRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state) { string containerName; string listingPrefix; CloudBlobClient.ParseUserPrefix(prefix, out containerName, out listingPrefix); CloudBlobContainer container = this.GetContainerReference(containerName); ChainedAsyncResult<BlobResultSegment> result = new ChainedAsyncResult<BlobResultSegment>(callback, state); ICancellableAsyncResult asyncResult = container.BeginListBlobsSegmented( listingPrefix, useFlatBlobListing, blobListingDetails, maxResults, currentToken, options, operationContext, ar => { result.UpdateCompletedSynchronously(ar.CompletedSynchronously); try { result.Result = container.EndListBlobsSegmented(ar); result.OnComplete(); } catch (Exception e) { result.OnComplete(e); } }, null /* state */); result.CancelDelegate = asyncResult.Cancel; return result; }
public virtual async Task <ContainerResultSegment> ListContainersSegmentedAsync(string prefix, ContainerListingDetails detailsIncluded, int?maxResults, BlobContinuationToken currentToken, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) { BlobRequestOptions modifiedOptions = BlobRequestOptions.ApplyDefaults(options, BlobType.Unspecified, this); ResultSegment <CloudBlobContainer> resultSegment = await Executor.ExecuteAsync( this.ListContainersImpl(prefix, detailsIncluded, currentToken, maxResults, modifiedOptions), modifiedOptions.RetryPolicy, operationContext, cancellationToken).ConfigureAwait(false); return(new ContainerResultSegment(resultSegment.Results, (BlobContinuationToken)resultSegment.ContinuationToken)); }
public virtual ICancellableAsyncResult BeginListBlobsSegmented(bool useFlatBlobListing, BlobListingDetails blobListingDetails, int?maxResults, BlobContinuationToken currentToken, BlobRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state) { return(CancellableAsyncResultTaskWrapper.Create(token => this.ListBlobsSegmentedAsync(useFlatBlobListing, blobListingDetails, maxResults, currentToken, options, operationContext, token), callback, state)); }
public ICancellableAsyncResult BeginListBlobsSegmented(string prefix, bool useFlatBlobListing, BlobListingDetails blobListingDetails, int?maxResults, BlobContinuationToken currentToken, BlobRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state) { string containerName; string listingPrefix; CloudBlobClient.ParseUserPrefix(prefix, out containerName, out listingPrefix); CloudBlobContainer container = this.GetContainerReference(containerName); ChainedAsyncResult <BlobResultSegment> result = new ChainedAsyncResult <BlobResultSegment>(callback, state); ICancellableAsyncResult asyncResult = container.BeginListBlobsSegmented( listingPrefix, useFlatBlobListing, blobListingDetails, maxResults, currentToken, options, operationContext, ar => { result.UpdateCompletedSynchronously(ar.CompletedSynchronously); try { result.Result = container.EndListBlobsSegmented(ar); result.OnComplete(); } catch (Exception e) { result.OnComplete(e); } }, null /* state */); result.CancelDelegate = asyncResult.Cancel; return(result); }