sysrepo  3.0.0
YANG-based system repository for all-around configuration management.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Locking API

Functions

int sr_get_lock (sr_conn_ctx_t *conn, sr_datastore_t datastore, const char *module_name, int *is_locked, uint32_t *id, struct timespec *timestamp)
 Check whether the data of the specified module or the whole datastore are locked. More...
 
int sr_lock (sr_session_ctx_t *session, const char *module_name, uint32_t timeout_ms)
 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...
 

Detailed Description

Function Documentation

int sr_get_lock ( sr_conn_ctx_t conn,
sr_datastore_t  datastore,
const char *  module_name,
int *  is_locked,
uint32_t *  id,
struct timespec *  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]timestampOptional timestamp of the lock.
Returns
Error code (SR_ERR_OK on success).
int sr_lock ( sr_session_ctx_t session,
const char *  module_name,
uint32_t  timeout_ms 
)

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.
[in]timeout_msTimeout in milliseconds for waiting for the lock(s). If 0, no waiting is performed.
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).