mirror of
https://github.com/Caraxi/mare.server.git
synced 2025-12-14 07:04:16 +01:00
reimplment ReadAsync for BlockFileDataStream/SubStream
This commit is contained in:
parent
7acd36bb79
commit
c80848fa2e
5 changed files with 128 additions and 77 deletions
|
|
@ -167,7 +167,7 @@ public sealed class CachedFileProvider : IDisposable
|
|||
_downloadSemaphore.Release();
|
||||
}
|
||||
|
||||
public FileStream? GetLocalFileStream(string hash)
|
||||
public FileInfo? GetLocalFilePath(string hash)
|
||||
{
|
||||
var fi = FilePathUtil.GetFileInfoForHash(_hotStoragePath, hash);
|
||||
if (fi == null) return null;
|
||||
|
|
@ -176,10 +176,10 @@ public sealed class CachedFileProvider : IDisposable
|
|||
|
||||
_fileStatisticsService.LogFile(hash, fi.Length);
|
||||
|
||||
return new FileStream(fi.FullName, FileMode.Open, FileAccess.Read, FileShare.Inheritable | FileShare.Read);
|
||||
return new FileInfo(fi.FullName);
|
||||
}
|
||||
|
||||
public async Task<FileStream?> GetAndDownloadFileStream(string hash)
|
||||
public async Task<FileInfo?> DownloadAndGetLocalFileInfo(string hash)
|
||||
{
|
||||
await DownloadFileWhenRequired(hash).ConfigureAwait(false);
|
||||
|
||||
|
|
@ -203,7 +203,7 @@ public sealed class CachedFileProvider : IDisposable
|
|||
}
|
||||
}
|
||||
|
||||
return GetLocalFileStream(hash);
|
||||
return GetLocalFilePath(hash);
|
||||
}
|
||||
|
||||
public bool AnyFilesDownloading(List<string> hashes)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue