Repository navigation
feat: expose pending update and pending delete set from transactions - #129
Open
jcannon98188 wants to merge 1 commit into
Open
jcannon98188 wants to merge 1 commit into
jcannon98188 wants to merge 1 commit into
Conversation
SebastianStehle
requested changes
Oct 9, 2026
|
|
||
| public uint UpdateLength { get; } | ||
|
|
||
| public byte[] Update() |
Collaborator
There was a problem hiding this comment.
This is weirdly named. It should e ReadUpdate or so
Contributor
Author
There was a problem hiding this comment.
I'm happy to make this change, but Update() is more in line with the DeleteSetNative that this pairs with. Which exposes Clients() and Ranges(). Your call though. Let me know.
Collaborator
There was a problem hiding this comment.
perhaps their are all named badly, but Update sounds like an action.
Contributor
Author
There was a problem hiding this comment.
Would you prefer PendingUpdate() instead? Seems closest to the intended field without being an action?
Bind ytransaction_pending_update and ytransaction_pending_ds, exposed as Transaction.PendingUpdate() and Transaction.PendingDeleteSet(). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
jcannon98188
force-pushed
the
feature/pending-update-bindings
branch
from
October 11, 2026 16:29
2a568d4 to
4d4a1f8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds C# bindings for the pending update and pending delete set that yffi exposes through
ytransaction_pending_updateandytransaction_pending_ds.When an update arrives before the updates it depends on, yrs holds it back instead of integrating it. These bindings let callers see what is waiting and what is missing, for example to request the missing data from a peer.
Changes
New public API on
Transaction:PendingUpdate()returns aPendingUpdate?, ornullif nothing is pending.Missingis aStateVectorwith the minimum client clocks that must arrive before the update can be applied.Updateis the pending update as lib0 v1 encoded bytes.PendingDeleteSet()returns aDeleteSet?, ornullif all deletions have been applied. It reuses the existingDeleteSettype.Internals:
TransactionChannelgains the P/Invoke entry pointsytransaction_pending_update,ytransaction_pending_ds,ypending_update_destroyandydelete_set_destroy.PendingUpdateNativestruct mirrors yffi'sYPendingUpdate.finallyblock, so the native structs are released even if reading fails.The signatures and struct layouts come from
libyrs.hatrelease-v0.19.1, the version pinned inbuild-binaries.yml.Tests
New
PendingTests:nullfor both methods.UpdateandMissingvector. Applying the dependency afterwards clears it.I ran the unit suite against a
yrs.dllbuilt locally fromrelease-v0.19.1, and all of it passes.Notes
PendingUpdate.Missingdepends onStateVectorreading its clocks correctly. That bug is fixed separately onfix/state-vector-clocksand is not part of this PR. Until it merges, the clock values inMissingare wrong. The tests here only assert that they are non-zero, so they pass either way.🤖 Generated with Claude Code