Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<Compile Include="$(AzureStorageDataMovementSharedSources)JobPlanExtensions.cs" LinkBase="Shared\DataMovement" />
<Compile Include="$(AzureStorageDataMovementSharedSources)ResponseExtensions.cs" LinkBase="Shared\DataMovement" />
<Compile Include="$(AzureStorageDataMovementSharedSources)LocalTransferCheckpointer.cs" LinkBase="Shared\DataMovement" />
<Compile Include="$(AzureStorageDataMovementSharedSources)StorageResourceContainerInternal.cs" LinkBase="Shared\DataMovement" />
<Compile Include="$(AzureStorageDataMovementSharedSources)TransferCheckpointer.cs" LinkBase="Shared\DataMovement" />
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Azure.Storage.DataMovement.Blobs
/// <summary>
/// The Storage Resource class for the Blob Client. Supports blob prefix directories as well as the root container.
/// </summary>
internal class BlobStorageResourceContainer : StorageResourceContainer
internal class BlobStorageResourceContainer : StorageResourceContainerInternal
{
internal BlobContainerClient BlobContainerClient { get; }
internal string DirectoryPrefix { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
<Compile Include="$(AzureCoreSharedSources)CancellationHelper.cs" LinkBase="SharedCore" />
<Compile Include="$(AzureCoreSharedSources)SyncAsyncEventHandlerExtensions.cs" LinkBase="Shared\Core" />
</ItemGroup>
<ItemGroup>
<Compile Include="$(AzureStorageDataMovementSharedSources)StorageResourceContainerInternal.cs" LinkBase="Shared\DataMovement" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Azure.Core" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace Azure.Storage.DataMovement.Files.Shares
{
internal class ShareDirectoryStorageResourceContainer : StorageResourceContainer
internal class ShareDirectoryStorageResourceContainer : StorageResourceContainerInternal
{
internal ShareFileStorageResourceOptions ResourceOptions { get; set; }
internal PathScanner PathScanner { get; set; }
Expand Down Expand Up @@ -47,20 +47,5 @@ protected override async IAsyncEnumerable<StorageResource> GetStorageResourcesAs
yield return new ShareFileStorageResourceItem(client, ResourceOptions);
}
}

#region Protected Hooks
// Internal func to access protected member for testing.
internal async IAsyncEnumerable<StorageResource> GetStorageResourcesInternal(
[EnumeratorCancellation] CancellationToken cancellationToken = default)
{
await foreach (StorageResource resource in GetStorageResourcesAsync(cancellationToken).ConfigureAwait(false))
{
yield return resource;
}
}

internal StorageResourceItem GetStorageResourceReferenceInternal(string path)
=> GetStorageResourceReference(path);
#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public async Task GetStorageResourcesCallsPathScannerCorrectly()

// Verify StorageResourceContainer correctly invokes path scanner and returns the given files
List<ShareFileClient> results = new();
await foreach (StorageResource res in resource.GetStorageResourcesInternal())
await foreach (StorageResource res in resource.GetStorageResourcesInternalAsync())
{
Assert.That(res, Is.TypeOf(typeof(ShareFileStorageResourceItem)));
results.Add((res as ShareFileStorageResourceItem).ShareFileClient);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System.Collections.Generic;
using System.Threading;

namespace Azure.Storage.DataMovement
{
/// <summary>
/// Middle class between the public type and implementation class.
/// Gives internal hook methods to protected methods of
/// <see cref="StorageResourceContainer"/>, allowing for internal
/// package use as well as testing access.
/// </summary>
internal abstract class StorageResourceContainerInternal : StorageResourceContainer
Comment thread
jaschrep-msft marked this conversation as resolved.
{
internal IAsyncEnumerable<StorageResource> GetStorageResourcesInternalAsync(
CancellationToken cancellationToken = default)
=> GetStorageResourcesAsync(cancellationToken);

internal StorageResourceItem GetStorageResourceReferenceInternal(string path)
=> GetStorageResourceReference(path);
}
}