in Core/src/Impl/Storages/AwsS3Storage.cs [234:264]
public async IAsyncEnumerable<ChildrenItem> GetChildrenAsync(ChildrenMode mode, SymbolStoragePath? prefixDir = null)
{
var request = new ListObjectsV2Request()
{
BucketName = myBucketName,
Prefix = prefixDir.HasValue ? SymbolPathToAwsKey(prefixDir.Value) + "/" : null
};
bool isCompleted = false;
while (!isCompleted)
{
var response = await myS3Client.ListObjectsV2Async(request);
// According to the tests, `ListObjectsV2Async` returns null in `response.S3Objects` when no keys found
if (response.S3Objects == null)
break;
foreach (var s3Object in response.S3Objects.Where(IsUserFile))
{
yield return new ChildrenItem
{
FileName = AwsKeyToSymbolPath(s3Object.Key),
Size = (mode & ChildrenMode.WithSize) != 0 ? s3Object.Size : null
};
}
request.ContinuationToken = response.NextContinuationToken;
Debug.Assert(response.IsTruncated.HasValue, "Unexpected null value of IsTruncated property. It should always be specified");
isCompleted = !(response.IsTruncated ?? false);
Debug.Assert(isCompleted || response.NextContinuationToken != null, "Continuation token should be provided when there is more data in the storage");
}
}