Skip to content
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

Rework storage modules #152

Merged
merged 3 commits into from
Dec 18, 2020
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
15 changes: 0 additions & 15 deletions Sitko.Core.sln
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sitko.Core.Repository.Entit
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sitko.Core.Repository.Search", "src\Sitko.Core.Repository.Search\Sitko.Core.Repository.Search.csproj", "{F5530B6B-B1E4-4829-A0ED-486E2269C1BC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sitko.Core.Storage.Proxy", "src\Sitko.Core.Storage.Proxy\Sitko.Core.Storage.Proxy.csproj", "{7DB70746-EF0B-4B42-B022-67B0B8F31350}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sitko.Core.Caching", "src\Sitko.Core.Caching\Sitko.Core.Caching.csproj", "{9BC6D2DE-1EBC-47A5-8137-495548793D4B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sitko.Core.ElasticStack", "src\Sitko.Core.ElasticStack\Sitko.Core.ElasticStack.csproj", "{BC09505A-1735-4E3C-9CB7-F4CF54684F55}"
Expand Down Expand Up @@ -649,18 +647,6 @@ Global
{F5530B6B-B1E4-4829-A0ED-486E2269C1BC}.Release|x64.Build.0 = Release|Any CPU
{F5530B6B-B1E4-4829-A0ED-486E2269C1BC}.Release|x86.ActiveCfg = Release|Any CPU
{F5530B6B-B1E4-4829-A0ED-486E2269C1BC}.Release|x86.Build.0 = Release|Any CPU
{7DB70746-EF0B-4B42-B022-67B0B8F31350}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7DB70746-EF0B-4B42-B022-67B0B8F31350}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7DB70746-EF0B-4B42-B022-67B0B8F31350}.Debug|x64.ActiveCfg = Debug|Any CPU
{7DB70746-EF0B-4B42-B022-67B0B8F31350}.Debug|x64.Build.0 = Debug|Any CPU
{7DB70746-EF0B-4B42-B022-67B0B8F31350}.Debug|x86.ActiveCfg = Debug|Any CPU
{7DB70746-EF0B-4B42-B022-67B0B8F31350}.Debug|x86.Build.0 = Debug|Any CPU
{7DB70746-EF0B-4B42-B022-67B0B8F31350}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7DB70746-EF0B-4B42-B022-67B0B8F31350}.Release|Any CPU.Build.0 = Release|Any CPU
{7DB70746-EF0B-4B42-B022-67B0B8F31350}.Release|x64.ActiveCfg = Release|Any CPU
{7DB70746-EF0B-4B42-B022-67B0B8F31350}.Release|x64.Build.0 = Release|Any CPU
{7DB70746-EF0B-4B42-B022-67B0B8F31350}.Release|x86.ActiveCfg = Release|Any CPU
{7DB70746-EF0B-4B42-B022-67B0B8F31350}.Release|x86.Build.0 = Release|Any CPU
{9BC6D2DE-1EBC-47A5-8137-495548793D4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9BC6D2DE-1EBC-47A5-8137-495548793D4B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9BC6D2DE-1EBC-47A5-8137-495548793D4B}.Debug|x64.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -943,7 +929,6 @@ Global
{8D0A84B9-249A-4A18-9321-43A1B26ABE3C} = {109B331E-71B9-483C-8FC1-13B10C92A7F1}
{AC57B296-8861-4D67-B64C-3B2EDFF6BA9B} = {109B331E-71B9-483C-8FC1-13B10C92A7F1}
{F5530B6B-B1E4-4829-A0ED-486E2269C1BC} = {109B331E-71B9-483C-8FC1-13B10C92A7F1}
{7DB70746-EF0B-4B42-B022-67B0B8F31350} = {109B331E-71B9-483C-8FC1-13B10C92A7F1}
{9BC6D2DE-1EBC-47A5-8137-495548793D4B} = {109B331E-71B9-483C-8FC1-13B10C92A7F1}
{BC09505A-1735-4E3C-9CB7-F4CF54684F55} = {109B331E-71B9-483C-8FC1-13B10C92A7F1}
{DE7A5982-CFCA-4DBA-B446-5FBD22F406F5} = {109B331E-71B9-483C-8FC1-13B10C92A7F1}
Expand Down
20 changes: 9 additions & 11 deletions src/Sitko.Core.Storage.FileSystem/FileSystemStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ protected override Task DoDeleteAllAsync()
return Task.CompletedTask;
}

protected override async Task<FileDownloadResult?> DoGetFileAsync(string path)
internal override async Task<StorageItemInfo?> DoGetFileAsync(string path)
{
FileDownloadResult? result = null;
StorageItemInfo? result = null;
var fullPath = Path.Combine(_storagePath, path);
var metaDataPath = GetMetaDataPath(fullPath);
var fileInfo = new FileInfo(fullPath);
Expand All @@ -99,21 +99,20 @@ protected override Task DoDeleteAllAsync()
metadata = await File.ReadAllTextAsync(metaDataPath);
}


result = new FileDownloadResult(metadata, fileInfo.Length, fileInfo.LastWriteTimeUtc,
fileInfo.OpenRead());
result = new StorageItemInfo(metadata, fileInfo.Length, fileInfo.LastWriteTimeUtc,
() => new FileStream(fullPath, FileMode.Open));
}


return result;
}

protected override Task<StorageFolder?> DoBuildStorageTreeAsync()
protected override Task<StorageNode?> DoBuildStorageTreeAsync()
{
return ListFolderAsync("/");
}

private async Task<StorageFolder> ListFolderAsync(string path)
private async Task<StorageNode?> ListFolderAsync(string path)
{
var fullPath = path == "/" ? _storagePath : Path.Combine(_storagePath, path.Trim('/'));
List<StorageNode>? children = null;
Expand Down Expand Up @@ -145,15 +144,14 @@ private async Task<StorageFolder> ListFolderAsync(string path)
var item = CreateStorageItem(PreparePath(Path.Combine(path, file.Name))!.Trim('/'),
file.LastWriteTimeUtc,
file.Length,
metadata,
physicalPath: file.FullName);
metadata);

children.Add(item);
children.Add(StorageNode.CreateStorageItem(item));
}
}
}

return new StorageFolder(path == "/" ? "/" : Path.GetFileNameWithoutExtension(path),
return StorageNode.CreateDirectory(path == "/" ? "/" : Path.GetFileNameWithoutExtension(path),
PreparePath(Path.Combine(_storagePath, path)),
children);
}
Expand Down
96 changes: 0 additions & 96 deletions src/Sitko.Core.Storage.Proxy/ImageSharp/ImageSharpProvider.cs

This file was deleted.

36 changes: 0 additions & 36 deletions src/Sitko.Core.Storage.Proxy/Sitko.Core.Storage.Proxy.csproj

This file was deleted.

131 changes: 0 additions & 131 deletions src/Sitko.Core.Storage.Proxy/StaticFiles/RangeHelper.cs

This file was deleted.

Loading