Public Access
Sync: mirror a pulled page in one write and read the outbox once per page, not twice per change
This commit is contained in:
1 parent
f997e87c5f
commit
873405e591
4 files changed
+173
-13
No files matched your search
@@ -128,6 +128,42 @@ public sealed class CacheStoreTests : IAsyncLifetime
|
||||
items.ShouldHaveSingleItem().Version.ShouldBe(2);
|
||||
}
|
||||
|
||||
/// <remarks>
|
||||
/// A pull's page in one write. What it leaves has to be exactly what the same items saved one at a time
|
||||
/// would have left: rows that existed replaced, new ones created, and an item given twice ending at the
|
||||
/// later of the two — a page can carry several changes to the same item.
|
||||
/// </remarks>
|
||||
[Fact]
|
||||
public async Task SavingMany_LeavesWhatSavingThemOneAtATimeWould()
|
||||
{
|
||||
var existing = Guid.CreateVersion7();
|
||||
var fresh = Guid.CreateVersion7();
|
||||
var twice = Guid.CreateVersion7();
|
||||
|
||||
await harness.Items.SaveAsync(Item(existing, version: 1, seed: 1), Token);
|
||||
|
||||
await harness.Items.SaveManyAsync(
|
||||
[
|
||||
Item(existing, version: 2, changeSequence: 2, seed: 2),
|
||||
Item(fresh, version: 1, changeSequence: 3, seed: 3),
|
||||
Item(twice, version: 1, changeSequence: 4, seed: 4),
|
||||
Item(twice, version: 2, changeSequence: 5, deleted: true),
|
||||
],
|
||||
Token);
|
||||
|
||||
(await harness.Items.FindAsync(VaultId, SyncEntityType.Host, existing, Token))
|
||||
.ShouldNotBeNull().Version.ShouldBe(2);
|
||||
|
||||
(await harness.Items.FindAsync(VaultId, SyncEntityType.Host, fresh, Token))
|
||||
.ShouldNotBeNull().Version.ShouldBe(1);
|
||||
|
||||
var last = (await harness.Items.FindAsync(VaultId, SyncEntityType.Host, twice, Token)).ShouldNotBeNull();
|
||||
last.Version.ShouldBe(2);
|
||||
last.IsDeleted.ShouldBeTrue();
|
||||
|
||||
(await harness.Items.ListAsync(VaultId, SyncEntityType.Host, true, Token)).Count.ShouldBe(3);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ATombstone_IsHiddenFromTheListButStillFindable()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user