本文整理汇总了C#中BlobListingDetails类的典型用法代码示例。如果您正苦于以下问题:C# BlobListingDetails类的具体用法?C# BlobListingDetails怎么用?C# BlobListingDetails使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BlobListingDetails类属于命名空间,在下文中一共展示了BlobListingDetails类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ListBlobsImplAsync
/// <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);
});
}
示例2: ListBlobsAsync
public static async Task<IEnumerable<IStorageListBlobItem>> ListBlobsAsync(this IStorageBlobClient client,
string prefix, bool useFlatBlobListing, BlobListingDetails blobListingDetails,
CancellationToken cancellationToken)
{
if (client == null)
{
throw new ArgumentNullException("client");
}
List<IStorageListBlobItem> allResults = new List<IStorageListBlobItem>();
BlobContinuationToken continuationToken = null;
IStorageBlobResultSegment result;
do
{
result = await client.ListBlobsSegmentedAsync(prefix, useFlatBlobListing, blobListingDetails,
maxResults: null, currentToken: continuationToken, options: null, operationContext: null,
cancellationToken: cancellationToken);
if (result != null)
{
IEnumerable<IStorageListBlobItem> currentResults = result.Results;
if (currentResults != null)
{
allResults.AddRange(currentResults);
}
continuationToken = result.ContinuationToken;
}
}
while (result != null && continuationToken != null);
return allResults;
}
示例3: ListBlobsSegmented
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);
}
示例4: ListBlobsSegmentedAsync
public static async Task<ReadOnlyCollection<IListBlobItem>> ListBlobsSegmentedAsync(
this CloudBlobDirectory container,
bool useFlatBlobListing,
int pageSize,
BlobListingDetails details,
BlobRequestOptions options,
OperationContext operationContext,
IProgress<IEnumerable<IListBlobItem>> progress = null,
CancellationToken cancellationToken = default(CancellationToken)) {
options = options ?? new BlobRequestOptions();
var results = new List<IListBlobItem>();
BlobContinuationToken continuation = null;
BlobResultSegment segment;
do {
segment = await Task.Factory.FromAsync(
(cb, state) => container.BeginListBlobsSegmented(useFlatBlobListing, details, pageSize, continuation, options, operationContext, cb, state).WithCancellation(cancellationToken),
ar => container.EndListBlobsSegmented(ar),
null);
if (progress != null) {
progress.Report(segment.Results);
}
results.AddRange(segment.Results);
continuation = segment.ContinuationToken;
} while (continuation != null);
return new ReadOnlyCollection<IListBlobItem>(results);
}
开发者ID:AArnott,项目名称:Microsoft.WindowsAzure.StorageClient.Async,代码行数:27,代码来源:AzureBlobStorageExtensions.cs
示例5: ListBlobsSegmentedAsync
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;
}
示例6: ListBlobsSegmented
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);
}
示例7: ListBlobsSegmentedAsync
/// <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);
}
示例8: AllowsSnapshotsOnlyInFlatMode
public void AllowsSnapshotsOnlyInFlatMode(BlobListingDetails blobListingDetails)
{
var container = new StandaloneAzureBlobContainer(BasePath);
Assert.Throws<ArgumentException>(() => container.ListBlobsSegmentedAsync(
"",
BlobListing.Hierarchical,
blobListingDetails,
500,
null));
}
示例9: ListBlobsSegmentedAsync
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));
}
示例10: ListBlobsSegmentedAsync
public Task<IAzureBlobResultSegment> ListBlobsSegmentedAsync(BlobListing blobListing, BlobListingDetails blobListingDetails, int? maxResults, BlobContinuationToken currentToken)
{
return Task.FromResult(StandaloneList.ListBlobsSegmentedAsync(
_containerDirectory,
_directoryPath,
"",
blobListing,
blobListingDetails,
maxResults,
currentToken));
}
示例11: ContainerWillNotLoadMetadataIfNotSpecifiedForFlatListing
public async Task ContainerWillNotLoadMetadataIfNotSpecifiedForFlatListing(BlobListingDetails blobListingDetails)
{
var results = await new StandaloneAzureBlobContainer(BasePath)
.ListBlobsSegmentedAsync(
"",
BlobListing.Flat,
blobListingDetails,
null,
null);
Assert.Empty(results.Results.OfType<IAzureBlockBlob>().First(r => r.Name == "flat").Metadata);
}
示例12: ListBlobsAsync
public static async Task<List<IListBlobItem>> ListBlobsAsync(this CloudBlobContainer container, string prefix, BlobListingDetails details)
{
BlobContinuationToken continuationToken = null;
List<IListBlobItem> results = new List<IListBlobItem>();
do
{
var response = await container.ListBlobsSegmentedAsync(prefix, true, details, null, continuationToken, new BlobRequestOptions(), new OperationContext());
continuationToken = response.ContinuationToken;
results.AddRange(response.Results);
}
while (continuationToken != null);
return results;
}
示例13: ListBlobsSegmentedAsync
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);
}
示例14: ListBlobs
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;
}
});
}
示例15: ListBlobsSegmentedAsync
/// <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);
});
}