| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | using System.Linq; |
| | 5 | | using System.Threading; |
| | 6 | | using System.Threading.Tasks; |
| | 7 | |
|
| | 8 | | namespace Azure.Storage.Files.DataLake.Models |
| | 9 | | { |
| | 10 | | internal class GetPathsAsyncCollection : StorageCollectionEnumerator<PathItem> |
| | 11 | | { |
| | 12 | | private readonly DataLakeFileSystemClient _client; |
| | 13 | | private readonly string _path; |
| | 14 | | private readonly bool _recursive; |
| | 15 | | private readonly bool _upn; |
| | 16 | |
|
| 154 | 17 | | public GetPathsAsyncCollection( |
| 154 | 18 | | DataLakeFileSystemClient client, |
| 154 | 19 | | string path, |
| 154 | 20 | | bool recursive, |
| 154 | 21 | | bool upn) |
| | 22 | | { |
| 154 | 23 | | _client = client; |
| 154 | 24 | | _path = path; |
| 154 | 25 | | _recursive = recursive; |
| 154 | 26 | | _upn = upn; |
| 154 | 27 | | } |
| | 28 | |
|
| | 29 | | public override async ValueTask<Page<PathItem>> GetNextPageAsync( |
| | 30 | | string continuationToken, |
| | 31 | | int? pageSizeHint, |
| | 32 | | bool async, |
| | 33 | | CancellationToken cancellationToken) |
| | 34 | | { |
| 154 | 35 | | Response<PathSegment> response = await _client.GetPathsInternal( |
| 154 | 36 | | _path, |
| 154 | 37 | | _recursive, |
| 154 | 38 | | _upn, |
| 154 | 39 | | continuationToken, |
| 154 | 40 | | pageSizeHint, |
| 154 | 41 | | async, |
| 154 | 42 | | cancellationToken).ConfigureAwait(false); |
| | 43 | |
|
| 150 | 44 | | return Page<PathItem>.FromValues( |
| 150 | 45 | | response.Value.Paths.ToArray(), |
| 150 | 46 | | response.Value.Continuation, |
| 150 | 47 | | response.GetRawResponse()); |
| 150 | 48 | | } |
| | 49 | | } |
| | 50 | | } |