Soft flush: the reader's own answer decides (no second stat, protocol default included); pin the readable-empty store, spy the flag through Mesh and host, changelog the breaking PushAll
Some checks failed
CultMesh portability and performance / ubuntu-latest reactive semantics and leases (pull_request) Has been cancelled
Some checks failed
CultMesh portability and performance / ubuntu-latest reactive semantics and leases (pull_request) Has been cancelled
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
fb80e32749
commit
80eed16c0d
9 changed files with 170 additions and 19 deletions
|
|
@ -243,6 +243,24 @@ namespace GameCult.Caching.Tests
|
|||
Assert.That(reader.Get<Page>(second)?.Text, Is.EqualTo("two"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task SoftFlushOverReadableEmptyManifestLeavesIt()
|
||||
{
|
||||
using var cache = Open(out var store);
|
||||
var key = await cache.UpsertAsync(typeof(Page), new Page { Name = "a", Text = "one" });
|
||||
cache.FlushAllBackingStores();
|
||||
cache.Remove(key);
|
||||
cache.FlushAllBackingStores();
|
||||
var before = File.ReadAllBytes(_manifest);
|
||||
using (var reader = Open(out _)) Assert.That(reader.AllEntries, Is.Empty, "the store is not readable-empty");
|
||||
await cache.UpsertAsync(typeof(Page), new Page { Name = "b", Text = "two" });
|
||||
|
||||
cache.FlushAllBackingStores(soft: true);
|
||||
|
||||
Assert.That(File.ReadAllBytes(_manifest), Is.EqualTo(before), "a soft flush wrote over a readable store that holds no records");
|
||||
Assert.That(store.IsDirty, Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task SoftFlushOverUnreadableManifestRefusesAndLeavesIt()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue