skipruntime: add updateAll to write several input collections atomically - #1509
Open
skiplabsdaniel wants to merge 1 commit into
Open
skiplabsdaniel wants to merge 1 commit into
skiplabsdaniel wants to merge 1 commit into
Conversation
Updating N input collections required N calls to `update`, each triggering its own recomputation and its own round of subscriber notifications. Beyond the cost, subscribers observed intermediate states in which only part of the collections had been written, and a failure midway left the earlier writes applied. Add `updateAll`, which writes a whole batch in one shot: - `writeInCollection` (Runtime.sk) gains an `update` flag so several collections can be written before a single `context.update()` and a single `getSubscriptions()` drain -- one recomputation, one notification. - `SkipRuntime_Runtime__updateAll` is exported from the FFI and wired through both the native addon and the wasm bindings, mirroring `update`. - `ServiceInstance.updateAll` runs the batch in a fork, merged on success and aborted on failure, so the update is all-or-nothing. - `SkipServiceBroker.updateAll` and the `PATCH /v1/inputs` control route expose it over HTTP, the batch counterpart of `PATCH /v1/inputs/:collection`. Tests cover the batch on two services, assert that a batch produces exactly one subscriber notification where two sequential updates produce two, and check that a batch naming an unknown collection throws and leaves none of the collections written.
This branch has not been deployed
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.
Updating N input collections required N calls to
update, each triggering its own recomputation and its own round of subscriber notifications. Beyond the cost, subscribers observed intermediate states in which only part of the collections had been written, and a failure midway left the earlier writes applied.Add
updateAll, which writes a whole batch in one shot:writeInCollection(Runtime.sk) gains anupdateflag so several collections can be written before a singlecontext.update()and a singlegetSubscriptions()drain -- one recomputation, one notification.SkipRuntime_Runtime__updateAllis exported from the FFI and wired through both the native addon and the wasm bindings, mirroringupdate.ServiceInstance.updateAllruns the batch in a fork, merged on success and aborted on failure, so the update is all-or-nothing.SkipServiceBroker.updateAlland thePATCH /v1/inputscontrol route expose it over HTTP, the batch counterpart ofPATCH /v1/inputs/:collection.Tests cover the batch on two services, assert that a batch produces exactly one subscriber notification where two sequential updates produce two, and check that a batch naming an unknown collection throws and leaves none of the collections written.