diff --git a/src/GameCult.Caching/CultCache.cs b/src/GameCult.Caching/CultCache.cs index 47c2beea..a722d965 100644 --- a/src/GameCult.Caching/CultCache.cs +++ b/src/GameCult.Caching/CultCache.cs @@ -1380,20 +1380,6 @@ namespace GameCult.Caching /// public CultDocumentRegistry Registry => _registry; - /// - /// Opens a reactive POCO presentation for one cache-managed document. - /// - public CultManagedDocument Document(CultRecordKey key) where T : class - { - return new CultManagedDocument( - key, - () => Get(key), - async value => { await UpsertAsync(value, new CultRecordHandle(key)).ConfigureAwait(false); }, - WatchRecord(key) - .Where(change => change.Document != null) - .Select(change => change.Document!)); - } - /// /// Watches all local cache changes assignable to the requested document type. /// diff --git a/src/GameCult.Caching/CultManagedDocument.cs b/src/GameCult.Caching/CultManagedDocument.cs index 96f021bd..ce86871b 100644 --- a/src/GameCult.Caching/CultManagedDocument.cs +++ b/src/GameCult.Caching/CultManagedDocument.cs @@ -68,65 +68,4 @@ namespace GameCult.Caching /// public T? PreviousDocument { get; } } - - /// - /// Reactive POCO presentation for one CultCache-managed document. - /// - public sealed class CultManagedDocument where T : class - { - private readonly Func _read; - private readonly Func _commit; - private readonly Observable _watch; - - /// - /// Creates a managed document presentation. - /// - public CultManagedDocument( - CultRecordKey key, - Func read, - Func commit, - Observable watch) - { - Key = key; - _read = read ?? throw new ArgumentNullException(nameof(read)); - _commit = commit ?? throw new ArgumentNullException(nameof(commit)); - _watch = watch ?? throw new ArgumentNullException(nameof(watch)); - } - - /// - /// Gets the document record key. - /// - public CultRecordKey Key { get; } - - /// - /// Gets the current POCO presentation. - /// - public T? Value => _read(); - - /// - /// Watches committed values for this document. - /// - public Observable Watch() - { - return _watch; - } - - /// - /// Commits the current POCO value through the owner-supplied commit path. - /// - public Task CommitAsync() - { - var value = Value ?? throw new InvalidOperationException($"Document '{Key.Value}' is not present."); - return _commit(value); - } - - /// - /// Replaces the current value through the owner-supplied commit path. - /// - public Task ReplaceAsync(T value) - { - if (value == null) throw new ArgumentNullException(nameof(value)); - return _commit(value); - } - } } diff --git a/src/GameCult.Networking/CultNetDatabase.cs b/src/GameCult.Networking/CultNetDatabase.cs index 9c1d1480..c5221359 100644 --- a/src/GameCult.Networking/CultNetDatabase.cs +++ b/src/GameCult.Networking/CultNetDatabase.cs @@ -848,21 +848,6 @@ namespace GameCult.Networking return _cache.GetByIndex(alias, value); } - /// - /// Opens a reactive POCO presentation for one distributed CultCache document. - /// - public CultManagedDocument Document(CultRecordKey key) where T : class - { - ThrowIfDisposed(); - return new CultManagedDocument( - key, - () => _cache.Get(key), - async value => { await PutAsync(key, value).ConfigureAwait(false); }, - WatchRecord(key) - .Where(change => change.Document != null) - .Select(change => change.Document!)); - } - /// /// Adds or replaces a document at a specific key. ///