Add Explorer Workbench with hierarchical, off-UI Storage analysis.

Storage queries run in the background with cancellation and covering indexes so switching views no longer freezes the UI.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-22 12:43:05 +02:00
commit e9aba73552
130 changed files with 15110 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
namespace Explorer.Analysis;
internal sealed class AnalysisResultCache
{
private const int MaxEntries = 32;
private static readonly TimeSpan Ttl = TimeSpan.FromSeconds(20);
private readonly object _gate = new();
private readonly Dictionary<string, Entry> _items = new(StringComparer.Ordinal);
public bool TryGet<T>(string key, long stamp, out T value)
{
lock (_gate)
{
if (_items.TryGetValue(key, out var entry)
&& entry.Stamp == stamp
&& entry.Utc + Ttl > DateTime.UtcNow
&& entry.Value is T typed)
{
value = typed;
return true;
}
}
value = default!;
return false;
}
public void Set<T>(string key, long stamp, T value)
{
lock (_gate)
{
_items[key] = new Entry(stamp, value!, DateTime.UtcNow);
if (_items.Count <= MaxEntries)
{
return;
}
var oldest = _items.OrderBy(p => p.Value.Utc).First().Key;
_items.Remove(oldest);
}
}
private readonly record struct Entry(long Stamp, object Value, DateTime Utc);
}