opral / lix-sdk

1 stars 0 forks source link

re-consider `ChangeWithSnapshot` (at least for plugin api) #99

Closed samuelstroschein closed 2 weeks ago

samuelstroschein commented 4 weeks ago

Context

We introduced ChangeWithSnapshot to ease migration during the LIXDK-166. However, the substantial performance benefit of separating the snapshot table is mostly voided if the snapshot is provided in most places.

Example plugin.detectConflicts

Lix queries leaf changes with their snapshots even though it's unclear if a plugin needs the snapshot. Yes, chances are high that a plugin needs the snapshot. But, does it need every snapshot? We don't know.

By naively providing every change with a snapshot, lazily querying snapshots on demand is out of question.

CleanShot 2024-10-16 at 14.15.06@2x.png

Proposal

  1. Consider only exposing changes to plugins. Plugin can query the snapshot as needed.
  2. Find more places where ChangeWithSnapshot is used where it might not be needed.
samuelstroschein commented 3 weeks ago

Yep, remove change with snapshot.

The csv plugin takes the changes with snapshots and then calls getLeafChange in plugin.applyChanges(). The result is that the snapshot is queried twice.