sysrepo  1.4.58
YANG datastore
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Locking API

Functions

int sr_lock (sr_session_ctx_t *session, const char *module_name)
 Locks the data of the specified module or the whole datastore. More...
 
int sr_unlock (sr_session_ctx_t *session, const char *module_name)
 Unlocks the data of the specified module or the whole datastore. More...
 
int sr_get_lock (sr_conn_ctx_t *conn, sr_datastore_t datastore, const char *module_name, int *is_locked, uint32_t *id, uint32_t *nc_id, time_t *timestamp)
 Check whether the data of the specified module or the whole datastore are locked. More...
 

Detailed Description

Function Documentation

int sr_lock ( sr_session_ctx_t session,
const char *  module_name 
)

Locks the data of the specified module or the whole datastore.

Note
Note that locking candidate datastore after it has already been modified is not allowed. Session needs to acquire this lock before it or any other session performs any changes.
This lock will be automatically released when the session is stopped.

Required READ access.

Parameters
[in]sessionSession (DS-specific) to use.
[in]module_nameOptional name of the module to be locked.
Returns
Error code (SR_ERR_OK on success).
int sr_unlock ( sr_session_ctx_t session,
const char *  module_name 
)

Unlocks the data of the specified module or the whole datastore.

Required READ access.

Parameters
[in]sessionSession (DS-specific) to use.
[in]module_nameOptional name of the module to be unlocked.
Returns
Error code (SR_ERR_OK on success).
int sr_get_lock ( sr_conn_ctx_t conn,
sr_datastore_t  datastore,
const char *  module_name,
int *  is_locked,
uint32_t *  id,
uint32_t *  nc_id,
time_t *  timestamp 
)

Check whether the data of the specified module or the whole datastore are locked.

Note that if whole datastore is checked, is_locked will be set only if all the modules are locked by the same Sysrepo session. If a module is not locked or locked by another Sysrepo session, is_locked will be false.

Parameters
[in]connConnection to use.
[in]datastoreDatastore of the lock.
[in]module_nameOptional name of the module to check.
[out]is_lockedTrue is the module or whole datastore is locked.
[out]idOptional Sysrepo SID of the session if the module/datastore is locked.
[out]nc_idOptional NETCONF SID of the session if the module/datatsore is locked.
[out]timestampOptional timestamp of the lock.
Returns
Error code (SR_ERR_OK on success).