Skip to content

Commit 0a9068e

Browse files
authored
Expose GetLatestSnapshots on DataModel (#53)
1 parent 399406c commit 0a9068e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/SIL.Harmony/DataModel.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,15 @@ public async Task<ObjectSnapshot> GetLatestSnapshotByObjectId(Guid entityId)
251251
throw new ArgumentException($"unable to find snapshot for entity {entityId}");
252252
}
253253

254+
public async IAsyncEnumerable<ObjectSnapshot> GetLatestSnapshots()
255+
{
256+
await using var repo = await _crdtRepositoryFactory.CreateRepository();
257+
await foreach (var snapshot in repo.CurrentSnapshots().AsAsyncEnumerable())
258+
{
259+
yield return snapshot;
260+
}
261+
}
262+
254263
public async Task<T?> GetLatest<T>(Guid objectId) where T : class
255264
{
256265
return await _crdtRepositoryFactory.Execute(repo => repo.GetCurrent<T>(objectId));

0 commit comments

Comments
 (0)