summary refs log tree commit diff
path: root/Rhea/StoreMetaService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Rhea/StoreMetaService.cs')
-rw-r--r--Rhea/StoreMetaService.cs22
1 files changed, 22 insertions, 0 deletions
diff --git a/Rhea/StoreMetaService.cs b/Rhea/StoreMetaService.cs
new file mode 100644

index 0000000..6b92cd6 --- /dev/null +++ b/Rhea/StoreMetaService.cs
@@ -0,0 +1,22 @@ +using ArcaneLibs.Collections; + +namespace Rhea; + +public class StoreMetaService(RheaConfiguration cfg) +{ + private LruCache<string> _storePathsByBaseName = new(10000); + + public async Task<string?> GetStorePathByBaseName(string baseName) + { + return await _storePathsByBaseName.GetOrAddAsync(baseName, async () => + { + foreach (var path in Directory.EnumerateFileSystemEntries(cfg.StorePath)) + { + Console.WriteLine(path[(cfg.StorePath.Length + 1)..]); + if (path.StartsWith(baseName + '-')) return path; + } + + return ""; + }); + } +} \ No newline at end of file