Delete CultManagedDocument and both Document<T> openers

CultManagedDocument<T>, CultCache.Document<T> and CultNetDatabase.Document<T>
had no consumer outside the tests removed with the SoA table.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-13 16:23:55 +02:00
commit d26f357f3e
3 changed files with 0 additions and 90 deletions

View file

@ -1380,20 +1380,6 @@ namespace GameCult.Caching
/// </summary>
public CultDocumentRegistry Registry => _registry;
/// <summary>
/// Opens a reactive POCO presentation for one cache-managed document.
/// </summary>
public CultManagedDocument<T> Document<T>(CultRecordKey key) where T : class
{
return new CultManagedDocument<T>(
key,
() => Get<T>(key),
async value => { await UpsertAsync(value, new CultRecordHandle<T>(key)).ConfigureAwait(false); },
WatchRecord<T>(key)
.Where(change => change.Document != null)
.Select(change => change.Document!));
}
/// <summary>
/// Watches all local cache changes assignable to the requested document type.
/// </summary>

View file

@ -68,65 +68,4 @@ namespace GameCult.Caching
/// </summary>
public T? PreviousDocument { get; }
}
/// <summary>
/// Reactive POCO presentation for one CultCache-managed document.
/// </summary>
public sealed class CultManagedDocument<T> where T : class
{
private readonly Func<T?> _read;
private readonly Func<T, Task> _commit;
private readonly Observable<T> _watch;
/// <summary>
/// Creates a managed document presentation.
/// </summary>
public CultManagedDocument(
CultRecordKey key,
Func<T?> read,
Func<T, Task> commit,
Observable<T> watch)
{
Key = key;
_read = read ?? throw new ArgumentNullException(nameof(read));
_commit = commit ?? throw new ArgumentNullException(nameof(commit));
_watch = watch ?? throw new ArgumentNullException(nameof(watch));
}
/// <summary>
/// Gets the document record key.
/// </summary>
public CultRecordKey Key { get; }
/// <summary>
/// Gets the current POCO presentation.
/// </summary>
public T? Value => _read();
/// <summary>
/// Watches committed values for this document.
/// </summary>
public Observable<T> Watch()
{
return _watch;
}
/// <summary>
/// Commits the current POCO value through the owner-supplied commit path.
/// </summary>
public Task CommitAsync()
{
var value = Value ?? throw new InvalidOperationException($"Document '{Key.Value}' is not present.");
return _commit(value);
}
/// <summary>
/// Replaces the current value through the owner-supplied commit path.
/// </summary>
public Task ReplaceAsync(T value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
return _commit(value);
}
}
}

View file

@ -848,21 +848,6 @@ namespace GameCult.Networking
return _cache.GetByIndex<T>(alias, value);
}
/// <summary>
/// Opens a reactive POCO presentation for one distributed CultCache document.
/// </summary>
public CultManagedDocument<T> Document<T>(CultRecordKey key) where T : class
{
ThrowIfDisposed();
return new CultManagedDocument<T>(
key,
() => _cache.Get<T>(key),
async value => { await PutAsync(key, value).ConfigureAwait(false); },
WatchRecord<T>(key)
.Where(change => change.Document != null)
.Select(change => change.Document!));
}
/// <summary>
/// Adds or replaces a document at a specific key.
/// </summary>