summary refs log tree commit diff
path: root/Rhea/StoreMetaService.cs
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2026-08-14 05:21:15 +0200
committerRory& <root@rory.gay>2026-08-14 05:21:15 +0200
commitf3d4f84fde24bb92e7cf6a22d94a703c753f3cbe (patch)
treed50b915a252fdb2e5d96b8ff9c6607a9cf9b78a2 /Rhea/StoreMetaService.cs
downloadRhea-f3d4f84fde24bb92e7cf6a22d94a703c753f3cbe.tar.xz
Working files and symlinks?
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