Skip to content

Introduce abstract storage layer #9544

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Aug 11, 2022
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
77 changes: 61 additions & 16 deletions Files.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31911.196
# Visual Studio Version 17
VisualStudioVersion = 17.1.32421.90
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Files.FullTrust", "src\Files.FullTrust\Files.FullTrust.csproj", "{533F9E86-EE0A-4FCB-B70C-F29532C1B787}"
ProjectSection(ProjectDependencies) = postProject
Expand All @@ -26,12 +26,18 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{A74DCE98-A74
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{481DE2EA-E6CE-4A9C-A220-3B543B95AAA1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Files.UI", "Files.UI", "{A188C26B-E731-4E0B-9D17-D21CEBD9B43F}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Platforms", "Platforms", "{A188C26B-E731-4E0B-9D17-D21CEBD9B43F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Files.Backend", "src\Files.Backend\Files.Backend.csproj", "{4CFE0BBC-8D07-49A0-8B10-4EDD61ABCF57}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FilesLauncher", "src\Files.OpenDialog\FilesLauncher\FilesLauncher.vcxproj", "{25FD5045-6D4C-4DD0-B3AC-613AB59CBB07}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sdk", "Sdk", "{9F36C2AD-005D-4EA5-A1F1-6BC42773FC85}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Files.Sdk.Storage", "src\Files.Sdk.Storage\Files.Sdk.Storage.csproj", "{93B7A21C-A6CA-4A21-A69C-B5BD26BDDB79}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Files.Uwp.Storage", "src\Files.Uwp.Storage\Files.Uwp.Storage.csproj", "{DEDFB63C-7A8D-4E1F-A143-7B61CAC1F2A7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|arm64 = Debug|arm64
Expand Down Expand Up @@ -156,12 +162,12 @@ Global
{A2FF3F3B-8EBC-4108-B99D-1476B7876656}.Release|x64.Build.0 = Release|x64
{A2FF3F3B-8EBC-4108-B99D-1476B7876656}.Release|x86.ActiveCfg = Release|Win32
{A2FF3F3B-8EBC-4108-B99D-1476B7876656}.Release|x86.Build.0 = Release|Win32
{A2FF3F3B-8EBC-4108-B99D-1476B7876656}.Sideload|arm64.ActiveCfg = Release|arm64
{A2FF3F3B-8EBC-4108-B99D-1476B7876656}.Sideload|arm64.Build.0 = Release|arm64
{A2FF3F3B-8EBC-4108-B99D-1476B7876656}.Sideload|x64.ActiveCfg = Release|x64
{A2FF3F3B-8EBC-4108-B99D-1476B7876656}.Sideload|x64.Build.0 = Release|x64
{A2FF3F3B-8EBC-4108-B99D-1476B7876656}.Sideload|x86.ActiveCfg = Release|Win32
{A2FF3F3B-8EBC-4108-B99D-1476B7876656}.Sideload|x86.Build.0 = Release|Win32
{A2FF3F3B-8EBC-4108-B99D-1476B7876656}.Sideload|arm64.ActiveCfg = Sideload|arm64
{A2FF3F3B-8EBC-4108-B99D-1476B7876656}.Sideload|arm64.Build.0 = Sideload|arm64
{A2FF3F3B-8EBC-4108-B99D-1476B7876656}.Sideload|x64.ActiveCfg = Sideload|x64
{A2FF3F3B-8EBC-4108-B99D-1476B7876656}.Sideload|x64.Build.0 = Sideload|x64
{A2FF3F3B-8EBC-4108-B99D-1476B7876656}.Sideload|x86.ActiveCfg = Sideload|Win32
{A2FF3F3B-8EBC-4108-B99D-1476B7876656}.Sideload|x86.Build.0 = Sideload|Win32
{B7E43D1F-AC8B-4958-95D5-A06CDD1FEACD}.Debug|arm64.ActiveCfg = Debug|Any CPU
{B7E43D1F-AC8B-4958-95D5-A06CDD1FEACD}.Debug|arm64.Build.0 = Debug|Any CPU
{B7E43D1F-AC8B-4958-95D5-A06CDD1FEACD}.Debug|x64.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -210,12 +216,48 @@ Global
{25FD5045-6D4C-4DD0-B3AC-613AB59CBB07}.Release|x64.Build.0 = Release|x64
{25FD5045-6D4C-4DD0-B3AC-613AB59CBB07}.Release|x86.ActiveCfg = Release|Win32
{25FD5045-6D4C-4DD0-B3AC-613AB59CBB07}.Release|x86.Build.0 = Release|Win32
{25FD5045-6D4C-4DD0-B3AC-613AB59CBB07}.Sideload|arm64.ActiveCfg = Release|arm64
{25FD5045-6D4C-4DD0-B3AC-613AB59CBB07}.Sideload|arm64.Build.0 = Release|arm64
{25FD5045-6D4C-4DD0-B3AC-613AB59CBB07}.Sideload|x64.ActiveCfg = Debug|x64
{25FD5045-6D4C-4DD0-B3AC-613AB59CBB07}.Sideload|x64.Build.0 = Debug|x64
{25FD5045-6D4C-4DD0-B3AC-613AB59CBB07}.Sideload|x86.ActiveCfg = Release|Win32
{25FD5045-6D4C-4DD0-B3AC-613AB59CBB07}.Sideload|x86.Build.0 = Release|Win32
{25FD5045-6D4C-4DD0-B3AC-613AB59CBB07}.Sideload|arm64.ActiveCfg = Sideload|arm64
{25FD5045-6D4C-4DD0-B3AC-613AB59CBB07}.Sideload|arm64.Build.0 = Sideload|arm64
{25FD5045-6D4C-4DD0-B3AC-613AB59CBB07}.Sideload|x64.ActiveCfg = Sideload|x64
{25FD5045-6D4C-4DD0-B3AC-613AB59CBB07}.Sideload|x64.Build.0 = Sideload|x64
{25FD5045-6D4C-4DD0-B3AC-613AB59CBB07}.Sideload|x86.ActiveCfg = Sideload|Win32
{25FD5045-6D4C-4DD0-B3AC-613AB59CBB07}.Sideload|x86.Build.0 = Sideload|Win32
{93B7A21C-A6CA-4A21-A69C-B5BD26BDDB79}.Debug|arm64.ActiveCfg = Debug|arm64
{93B7A21C-A6CA-4A21-A69C-B5BD26BDDB79}.Debug|arm64.Build.0 = Debug|arm64
{93B7A21C-A6CA-4A21-A69C-B5BD26BDDB79}.Debug|x64.ActiveCfg = Debug|x64
{93B7A21C-A6CA-4A21-A69C-B5BD26BDDB79}.Debug|x64.Build.0 = Debug|x64
{93B7A21C-A6CA-4A21-A69C-B5BD26BDDB79}.Debug|x86.ActiveCfg = Debug|x86
{93B7A21C-A6CA-4A21-A69C-B5BD26BDDB79}.Debug|x86.Build.0 = Debug|x86
{93B7A21C-A6CA-4A21-A69C-B5BD26BDDB79}.Release|arm64.ActiveCfg = Release|arm64
{93B7A21C-A6CA-4A21-A69C-B5BD26BDDB79}.Release|arm64.Build.0 = Release|arm64
{93B7A21C-A6CA-4A21-A69C-B5BD26BDDB79}.Release|x64.ActiveCfg = Release|x64
{93B7A21C-A6CA-4A21-A69C-B5BD26BDDB79}.Release|x64.Build.0 = Release|x64
{93B7A21C-A6CA-4A21-A69C-B5BD26BDDB79}.Release|x86.ActiveCfg = Release|x86
{93B7A21C-A6CA-4A21-A69C-B5BD26BDDB79}.Release|x86.Build.0 = Release|x86
{93B7A21C-A6CA-4A21-A69C-B5BD26BDDB79}.Sideload|arm64.ActiveCfg = Sideload|arm64
{93B7A21C-A6CA-4A21-A69C-B5BD26BDDB79}.Sideload|arm64.Build.0 = Sideload|arm64
{93B7A21C-A6CA-4A21-A69C-B5BD26BDDB79}.Sideload|x64.ActiveCfg = Sideload|x64
{93B7A21C-A6CA-4A21-A69C-B5BD26BDDB79}.Sideload|x64.Build.0 = Sideload|x64
{93B7A21C-A6CA-4A21-A69C-B5BD26BDDB79}.Sideload|x86.ActiveCfg = Sideload|x86
{93B7A21C-A6CA-4A21-A69C-B5BD26BDDB79}.Sideload|x86.Build.0 = Sideload|x86
{DEDFB63C-7A8D-4E1F-A143-7B61CAC1F2A7}.Debug|arm64.ActiveCfg = Debug|arm64
{DEDFB63C-7A8D-4E1F-A143-7B61CAC1F2A7}.Debug|arm64.Build.0 = Debug|arm64
{DEDFB63C-7A8D-4E1F-A143-7B61CAC1F2A7}.Debug|x64.ActiveCfg = Debug|x64
{DEDFB63C-7A8D-4E1F-A143-7B61CAC1F2A7}.Debug|x64.Build.0 = Debug|x64
{DEDFB63C-7A8D-4E1F-A143-7B61CAC1F2A7}.Debug|x86.ActiveCfg = Debug|x86
{DEDFB63C-7A8D-4E1F-A143-7B61CAC1F2A7}.Debug|x86.Build.0 = Debug|x86
{DEDFB63C-7A8D-4E1F-A143-7B61CAC1F2A7}.Release|arm64.ActiveCfg = Release|arm64
{DEDFB63C-7A8D-4E1F-A143-7B61CAC1F2A7}.Release|arm64.Build.0 = Release|arm64
{DEDFB63C-7A8D-4E1F-A143-7B61CAC1F2A7}.Release|x64.ActiveCfg = Release|x64
{DEDFB63C-7A8D-4E1F-A143-7B61CAC1F2A7}.Release|x64.Build.0 = Release|x64
{DEDFB63C-7A8D-4E1F-A143-7B61CAC1F2A7}.Release|x86.ActiveCfg = Release|x86
{DEDFB63C-7A8D-4E1F-A143-7B61CAC1F2A7}.Release|x86.Build.0 = Release|x86
{DEDFB63C-7A8D-4E1F-A143-7B61CAC1F2A7}.Sideload|arm64.ActiveCfg = Sideload|arm64
{DEDFB63C-7A8D-4E1F-A143-7B61CAC1F2A7}.Sideload|arm64.Build.0 = Sideload|arm64
{DEDFB63C-7A8D-4E1F-A143-7B61CAC1F2A7}.Sideload|x64.ActiveCfg = Sideload|x64
{DEDFB63C-7A8D-4E1F-A143-7B61CAC1F2A7}.Sideload|x64.Build.0 = Sideload|x64
{DEDFB63C-7A8D-4E1F-A143-7B61CAC1F2A7}.Sideload|x86.ActiveCfg = Sideload|x86
{DEDFB63C-7A8D-4E1F-A143-7B61CAC1F2A7}.Sideload|x86.Build.0 = Sideload|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -230,8 +272,11 @@ Global
{A2FF3F3B-8EBC-4108-B99D-1476B7876656} = {0175B70C-1E29-4A3F-AA4F-C2017B040EF0}
{B7E43D1F-AC8B-4958-95D5-A06CDD1FEACD} = {481DE2EA-E6CE-4A9C-A220-3B543B95AAA1}
{A188C26B-E731-4E0B-9D17-D21CEBD9B43F} = {A74DCE98-A744-4D71-A2B1-7EE4FED0936B}
{4CFE0BBC-8D07-49A0-8B10-4EDD61ABCF57} = {A188C26B-E731-4E0B-9D17-D21CEBD9B43F}
{4CFE0BBC-8D07-49A0-8B10-4EDD61ABCF57} = {9F36C2AD-005D-4EA5-A1F1-6BC42773FC85}
{25FD5045-6D4C-4DD0-B3AC-613AB59CBB07} = {0175B70C-1E29-4A3F-AA4F-C2017B040EF0}
{9F36C2AD-005D-4EA5-A1F1-6BC42773FC85} = {A74DCE98-A744-4D71-A2B1-7EE4FED0936B}
{93B7A21C-A6CA-4A21-A69C-B5BD26BDDB79} = {9F36C2AD-005D-4EA5-A1F1-6BC42773FC85}
{DEDFB63C-7A8D-4E1F-A143-7B61CAC1F2A7} = {A188C26B-E731-4E0B-9D17-D21CEBD9B43F}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0E62043C-A7A1-4982-9EC9-4CDB2939B776}
Expand Down
1 change: 1 addition & 0 deletions src/Files.Backend/Files.Backend.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Files.Sdk.Storage\Files.Sdk.Storage.csproj" />
<ProjectReference Include="..\Files.Shared\Files.Shared.csproj" />
</ItemGroup>

Expand Down
43 changes: 43 additions & 0 deletions src/Files.Backend/Services/IFileExplorerService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Files.Sdk.Storage.LocatableStorage;

namespace Files.Backend.Services
{
/// <summary>
/// A service that interacts with the system file explorer.
/// </summary>
public interface IFileExplorerService
{
/// <summary>
/// Opens the app folder.
/// </summary>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> that cancels this action.</param>
/// <returns>A <see cref="Task"/> that represents the asynchronous operation.</returns>
Task OpenAppFolderAsync(CancellationToken cancellationToken = default);

/// <summary>
/// Opens provided <paramref name="folder"/> in file explorer.
/// </summary>
/// <param name="folder">The folder to open file explorer in.</param>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> that cancels this action.</param>
/// <returns>A <see cref="Task"/> that represents the asynchronous operation.</returns>
Task OpenInFileExplorerAsync(ILocatableFolder folder, CancellationToken cancellationToken = default);

/// <summary>
/// Awaits the user input and picks single file from the file explorer dialog.
/// </summary>
/// <param name="filter">The filter to apply when picking files.</param>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> that cancels this action.</param>
/// <returns>A <see cref="Task"/> that represents the asynchronous operation. If successful and a file has been picked, returns <see cref="ILocatableFile"/>, otherwise null.</returns>
Task<ILocatableFile?> PickSingleFileAsync(IEnumerable<string>? filter, CancellationToken cancellationToken = default);

/// <summary>
/// Awaits the user input and picks single folder from the file explorer dialog.
/// </summary>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> that cancels this action.</param>
/// <returns>A <see cref="Task"/> that represents the asynchronous operation. If successful and a folder has been picked, returns <see cref="ILocatableFolder"/>, otherwise null.</returns>
Task<ILocatableFolder?> PickSingleFolderAsync(CancellationToken cancellationToken = default);
}
}
10 changes: 10 additions & 0 deletions src/Files.Sdk.Storage/Enums/CreationCollisionOption.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Files.Sdk.Storage.Enums
{
public enum CreationCollisionOption : byte
{
GenerateUniqueName = 0,
ReplaceExisting = 1,
OpenIfExists = 2,
FailIfExists = 3,
}
}
9 changes: 9 additions & 0 deletions src/Files.Sdk.Storage/Enums/NameCollisionOption.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace Files.Sdk.Storage.Enums
{
public enum NameCollisionOption : byte
{
GenerateUniqueName = 0,
ReplaceExisting = 1,
FailIfExists = 2
}
}
13 changes: 13 additions & 0 deletions src/Files.Sdk.Storage/Enums/StorableKind.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;

namespace Files.Sdk.Storage.Enums
{
[Flags]
public enum StorableKind : byte
{
None = 0,
Files = 1,
Folders = 2,
All = Files | Folders
}
}
20 changes: 20 additions & 0 deletions src/Files.Sdk.Storage/Extensions/StorageExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System.IO;
using System.Threading;
using System.Threading.Tasks;

namespace Files.Sdk.Storage.Extensions
{
public static class StorageExtensions
{
public static async Task CopyContentsToAsync(this IFile source, IFile destination, CancellationToken cancellationToken = default)
{
// Internal Stream.GetCopyBufferSize() - https://github.com/dotnet/runtime/blob/main/src/libraries/System.Private.CoreLib/src/System/IO/Stream.cs
const int DEFAULT_COPY_BUFFER_SIZE = 81920;

using var sourceStream = await source.OpenStreamAsync(FileAccess.Read, FileShare.Read, cancellationToken);
using var destinationStream = await destination.OpenStreamAsync(FileAccess.Read, FileShare.None, cancellationToken);

await sourceStream.CopyToAsync(destinationStream, DEFAULT_COPY_BUFFER_SIZE, cancellationToken);
}
}
}
20 changes: 20 additions & 0 deletions src/Files.Sdk.Storage/Files - Backup.Sdk.Storage.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Platforms>x86;x64;arm64</Platforms>
<RuntimeIdentifiers>win-arm64;win-x86;win-x64</RuntimeIdentifiers>
<LangVersion>9</LangVersion>
<Nullable>enable</Nullable>
<Configurations>Debug;Release;Sideload</Configurations>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="6.0.0" />
</ItemGroup>

<ItemGroup>
<Folder Include="StorageEnumeration\" />
</ItemGroup>

</Project>
16 changes: 16 additions & 0 deletions src/Files.Sdk.Storage/Files.Sdk.Storage.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Platforms>x86;x64;arm64</Platforms>
<RuntimeIdentifiers>win-arm64;win-x86;win-x64</RuntimeIdentifiers>
<LangVersion>9</LangVersion>
<Nullable>enable</Nullable>
<Configurations>Debug;Release;Sideload</Configurations>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="6.0.0" />
</ItemGroup>

</Project>
20 changes: 20 additions & 0 deletions src/Files.Sdk.Storage/IFile.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System.IO;
using System.Threading;
using System.Threading.Tasks;

namespace Files.Sdk.Storage
{
/// <summary>
/// Represents a file on the file system.
/// </summary>
public interface IFile : IStorable
{
/// <summary>
/// Opens and returns a stream to the file.
/// </summary>
/// <param name="access">The file access to open the file with.</param>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> that cancels this action.</param>
/// <returns>A <see cref="Task"/> that represents the asynchronous operation. If successful, returns a <see cref="Stream"/>, otherwise null.</returns>
Task<Stream> OpenStreamAsync(FileAccess access, FileShare share = FileShare.None, CancellationToken cancellationToken = default);
}
}
37 changes: 37 additions & 0 deletions src/Files.Sdk.Storage/IFolder.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Files.Sdk.Storage.Enums;

namespace Files.Sdk.Storage
{
/// <summary>
/// Represents a folder on the file system.
/// </summary>
public interface IFolder : IStorable
{
/// <summary>
/// Gets a file in the current directory by name.
/// </summary>
/// <param name="fileName">The name of the file.</param>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> that cancels this action.</param>
/// <returns>A <see cref="Task"/> that represents the asynchronous operation. If file is found and access is granted, returns <see cref="IFile"/> otherwise null.</returns>
Task<IFile> GetFileAsync(string fileName, CancellationToken cancellationToken = default);

/// <summary>
/// Gets a folder in the current directory by name.
/// </summary>
/// <param name="folderName">The name of the folder.</param>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> that cancels this action.</param>
/// <returns>A <see cref="Task"/> that represents the asynchronous operation. If folder is found and access is granted, returns <see cref="IFolder"/> otherwise null.</returns>
Task<IFolder> GetFolderAsync(string folderName, CancellationToken cancellationToken = default);

/// <summary>
/// Gets all items of this directory.
/// </summary>
/// <param name="kind">The type of items to enumerate.</param>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> that cancels this action.</param>
/// <returns>Returns an async operation represented by <see cref="IAsyncEnumerable{T}"/> of type <see cref="IStorable"/> of items in the directory.</returns>
IAsyncEnumerable<IStorable> GetItemsAsync(StorableKind kind = StorableKind.All, CancellationToken cancellationToken = default);
}
}
18 changes: 18 additions & 0 deletions src/Files.Sdk.Storage/IStorable.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace Files.Sdk.Storage
{
/// <summary>
/// Represents a base storage object on the file system.
/// </summary>
public interface IStorable
{
/// <summary>
/// Gets the unique and consistent identifier for this file or folder.
/// </summary>
public string Id { get; }

/// <summary>
/// Gets the name of the storage object.
/// </summary>
string Name { get; }
}
}
9 changes: 9 additions & 0 deletions src/Files.Sdk.Storage/LocatableStorage/ILocatableFile.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace Files.Sdk.Storage.LocatableStorage
{
/// <summary>
/// Represents a file that resides within a folder structure.
/// </summary>
public interface ILocatableFile : IFile, ILocatableStorable
{
}
}
9 changes: 9 additions & 0 deletions src/Files.Sdk.Storage/LocatableStorage/ILocatableFolder.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace Files.Sdk.Storage.LocatableStorage
{
/// <summary>
/// Represents a folder that resides within a folder structure.
/// </summary>
public interface ILocatableFolder : IFolder, ILocatableStorable
{
}
}
21 changes: 21 additions & 0 deletions src/Files.Sdk.Storage/LocatableStorage/ILocatableStorable.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System.Threading;
using System.Threading.Tasks;

namespace Files.Sdk.Storage.LocatableStorage
{
/// <summary>
/// Represents a file or folder that resides within a folder structure.
/// </summary>
public interface ILocatableStorable : IStorable
{
/// <summary>
/// Gets the path where the item resides.
/// </summary>
string Path { get; }

/// <summary>
/// Gets the containing folder for this item, if any.
/// </summary>
Task<ILocatableFolder?> GetParentAsync(CancellationToken cancellationToken = default);
}
}
9 changes: 9 additions & 0 deletions src/Files.Sdk.Storage/ModifiableStorage/IModifiableFile.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace Files.Sdk.Storage.ModifiableStorage
{
/// <summary>
/// Represents a file that can be modified.
/// </summary>
public interface IModifiableFile : IFile, IModifiableStorable
{
}
}
Loading