Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for SR_SUBSCR_UPDATE flag in change callbacks: Patch changed data before calling subscriptions #72

Open
rbu9fe opened this issue Sep 27, 2024 · 0 comments

Comments

@rbu9fe
Copy link

rbu9fe commented Sep 27, 2024

Sysrepo supports modifying data that is about to be committed by setting the SR_SUBSCR_UPDATE flag when registering the callback using sr_module_change_subscribe. That way, when someone commits something to the observed nodes, the registered callback will run with with the SR_EV_UPDATE event before all other callbacks are triggered. In that you are allowed to modify the data behind the incoming session using regular sysrepo functions.

This is not possible with the Python wrapper because the callback session is not provided.

Here somebody else also asked for access to the callback session but his use case was different and it was solved only for this specific use case, unfortunately.

Note that this is not the only use case for accessing the callback session. Imagine there's an atomic commit to different Yang modules. In general they may depend on each other and in order to validate or apply the changes you may require the entire running datastore, the way it would look like after the commit. This data superset can only be acquired by querying the data from the callback's session. In fact we have such a use case but implemented that using the C++ wrapper instead.

Is there a chance to add support for the providing the callback-specific session?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant