sysrepo / sysrepo-cpp

C++ bindings for the sysrepo library
BSD 3-Clause "New" or "Revised" License
6 stars 5 forks source link

Session::deleteItem for operational datastore #7

Closed gotthardp closed 2 years ago

gotthardp commented 2 years ago

The sysrepo documentation says the sr_delete_item cannot be used for the operational store-- the sr_oper_delete_item_str should be used instead. The Session::deleteItem doesn't say that, which could suggest it can be used for any store, but I didn't find the sr_oper_delete_item_str in the implementation. I believe the Session::deleteItem should either call sr_session_get_ds to check the datastore and call sr_oper_delete_item_str in case of an operational store, or there should be another method for deleting items from the operational store, right? The first option may be more user-friendly, the second just wraps whatever sysrepo offers.

syyyr commented 2 years ago

Hi.

You're right, sr_oper_delete_item_str has not been wrapped yet.

I believe the Session::deleteItem should either call sr_session_get_ds to check the datastore and call sr_oper_delete_item_str in case of an operational store, or there should be another method for deleting items from the operational store, right? The first option may be more user-friendly, the second just wraps whatever sysrepo offers.

I think sysrepo (oper DS) API is confusing enough, so I'll just go with the second approach. The patch can be found here https://gerrit.cesnet.cz/c/CzechLight/sysrepo-cpp/+/5590, There is a test that shows the usage of the method. Let me know, if you have any more questions.