Loading...
Searching...
No Matches
plugins_datastore.h
Go to the documentation of this file.
#ifndef _SYSREPO_PLUGINS_DATASTORE_H
#define _SYSREPO_PLUGINS_DATASTORE_H
#include <stdint.h>
#include <sys/types.h>
#include <libyang/libyang.h>
#include "sysrepo_types.h"
#ifdef __cplusplus
extern "C" {
#endif
// Datastore Plugin API
#define SRPLG_DS_API_VERSION 13
typedef sr_error_info_t *(*srds_install)(const struct lys_module *mod, sr_datastore_t ds, const char *owner,
const char *group, mode_t perm, void *plg_data);
typedef sr_error_info_t *(*srds_uninstall)(const struct lys_module *mod, sr_datastore_t ds, void *plg_data);
typedef sr_error_info_t *(*srds_init)(const struct lys_module *mod, sr_datastore_t ds, void *plg_data);
typedef sr_error_info_t *(*srds_conn_init)(sr_conn_ctx_t *conn, void **plg_data);
typedef void (*srds_conn_destroy)(sr_conn_ctx_t *conn, void *plg_data);
typedef sr_error_info_t *(*srds_store_prepare)(const struct lys_module *mod, sr_datastore_t ds, sr_cid_t cid, uint32_t sid,
const struct lyd_node *mod_diff, const struct lyd_node *mod_data, void *plg_data);
typedef sr_error_info_t *(*srds_store_commit)(const struct lys_module *mod, sr_datastore_t ds, sr_cid_t cid, uint32_t sid,
const struct lyd_node *mod_diff, const struct lyd_node *mod_data, void *plg_data);
typedef sr_error_info_t *(*srds_load)(const struct lys_module *mod, sr_datastore_t ds, sr_cid_t cid, uint32_t sid,
const char **xpaths, uint32_t xpath_count, void *plg_data, struct lyd_node **mod_data);
typedef sr_error_info_t *(*srds_copy)(const struct lys_module *mod, sr_datastore_t trg_ds, sr_datastore_t src_ds,
void *plg_data);
typedef sr_error_info_t *(*srds_candidate_modified)(const struct lys_module *mod, void *plg_data, int *modified);
typedef sr_error_info_t *(*srds_candidate_reset)(const struct lys_module *mod, void *plg_data);
typedef sr_error_info_t *(*srds_access_set)(const struct lys_module *mod, sr_datastore_t ds, const char *owner,
const char *group, mode_t perm, void *plg_data);
typedef sr_error_info_t *(*srds_access_get)(const struct lys_module *mod, sr_datastore_t ds, void *plg_data, char **owner,
char **group, mode_t *perm);
typedef sr_error_info_t *(*srds_access_check)(const struct lys_module *mod, sr_datastore_t ds, void *plg_data, int *read,
int *write);
typedef sr_error_info_t *(*srds_last_modif)(const struct lys_module *mod, sr_datastore_t ds, void *plg_data,
struct timespec *mtime);
typedef sr_error_info_t *(*srds_data_version)(const struct lys_module *mod, sr_datastore_t ds, void *plg_data,
uint32_t *version);
struct srplg_ds_s {
const char *name;
srds_install install_cb;
srds_uninstall uninstall_cb;
srds_init init_cb;
srds_conn_init conn_init_cb;
srds_conn_destroy conn_destroy_cb;
srds_store_prepare store_prepare_cb;
srds_store_commit store_commit_cb;
srds_load load_cb;
srds_copy copy_cb;
srds_candidate_modified candidate_modified_cb;
srds_candidate_reset candidate_reset_cb;
srds_access_set access_set_cb;
srds_access_get access_get_cb;
srds_access_check access_check_cb;
srds_last_modif last_modif_cb;
srds_data_version data_version_cb;
};
#define SRPLG_DATASTORE \
uint32_t srpds_apiver__ = SRPLG_DS_API_VERSION; \
const struct srplg_ds_s srpds__
#ifdef __cplusplus
}
#endif
#endif /* _SYSREPO_PLUGINS_DATASTORE_H */
sr_conn_ctx_t
struct sr_conn_ctx_s sr_conn_ctx_t
Sysrepo connection.
Definition sysrepo_types.h:89
srplg_ds_s::access_check_cb
srds_access_check access_check_cb
Definition plugins_datastore.h:327
srplg_ds_s::store_prepare_cb
srds_store_prepare store_prepare_cb
Definition plugins_datastore.h:319
srplg_ds_s::name
const char * name
Definition plugins_datastore.h:313
srplg_ds_s::conn_init_cb
srds_conn_init conn_init_cb
Definition plugins_datastore.h:317
srplg_ds_s::init_cb
srds_init init_cb
Definition plugins_datastore.h:316
srplg_ds_s::last_modif_cb
srds_last_modif last_modif_cb
Definition plugins_datastore.h:328
srplg_ds_s::candidate_reset_cb
srds_candidate_reset candidate_reset_cb
Definition plugins_datastore.h:324
srplg_ds_s::candidate_modified_cb
srds_candidate_modified candidate_modified_cb
Definition plugins_datastore.h:323
srplg_ds_s::access_get_cb
srds_access_get access_get_cb
Definition plugins_datastore.h:326
srplg_ds_s::access_set_cb
srds_access_set access_set_cb
Definition plugins_datastore.h:325
srplg_ds_s::copy_cb
srds_copy copy_cb
Definition plugins_datastore.h:322
srplg_ds_s::data_version_cb
srds_data_version data_version_cb
Definition plugins_datastore.h:329
srplg_ds_s::install_cb
srds_install install_cb
Definition plugins_datastore.h:314
srplg_ds_s::conn_destroy_cb
srds_conn_destroy conn_destroy_cb
Definition plugins_datastore.h:318
srplg_ds_s::uninstall_cb
srds_uninstall uninstall_cb
Definition plugins_datastore.h:315
srplg_ds_s::load_cb
srds_load load_cb
Definition plugins_datastore.h:321
srplg_ds_s::store_commit_cb
srds_store_commit store_commit_cb
Definition plugins_datastore.h:320
srplg_ds_s
Datastore plugin structure.
Definition plugins_datastore.h:312
srds_last_modif
sr_error_info_t *(* srds_last_modif)(const struct lys_module *mod, sr_datastore_t ds, void *plg_data, struct timespec *mtime)
Get the time when the datastore data of the module were last modified or 0 if the datastore data are ...
Definition plugins_datastore.h:284
srds_access_get
sr_error_info_t *(* srds_access_get)(const struct lys_module *mod, sr_datastore_t ds, void *plg_data, char **owner, char **group, mode_t *perm)
Get access permissions for datastore data of a module. This function is also used for sysrepo access ...
Definition plugins_datastore.h:255
srds_conn_init
sr_error_info_t *(* srds_conn_init)(sr_conn_ctx_t *conn, void **plg_data)
Initialize per-connection plugin data.
Definition plugins_datastore.h:101
srds_uninstall
sr_error_info_t *(* srds_uninstall)(const struct lys_module *mod, sr_datastore_t ds, void *plg_data)
Destroy data of an uninstalled module.
Definition plugins_datastore.h:72
srds_init
sr_error_info_t *(* srds_init)(const struct lys_module *mod, sr_datastore_t ds, void *plg_data)
Initialize data of a newly installed module.
Definition plugins_datastore.h:87
srds_access_set
sr_error_info_t *(* srds_access_set)(const struct lys_module *mod, sr_datastore_t ds, const char *owner, const char *group, mode_t perm, void *plg_data)
Set access permissions for datastore data of a module.
Definition plugins_datastore.h:239
srds_access_check
sr_error_info_t *(* srds_access_check)(const struct lys_module *mod, sr_datastore_t ds, void *plg_data, int *read, int *write)
Check whether the current user has the required access to datastore data.
Definition plugins_datastore.h:269
srds_data_version
sr_error_info_t *(* srds_data_version)(const struct lys_module *mod, sr_datastore_t ds, void *plg_data, uint32_t *version)
Get the current datastore data version, optional callback.
Definition plugins_datastore.h:306
srds_store_prepare
sr_error_info_t *(* srds_store_prepare)(const struct lys_module *mod, sr_datastore_t ds, sr_cid_t cid, uint32_t sid, const struct lyd_node *mod_diff, const struct lyd_node *mod_data, void *plg_data)
Prepare to store data for a module. Either a diff can be applied manually (if available) or full new ...
Definition plugins_datastore.h:138
srds_store_commit
sr_error_info_t *(* srds_store_commit)(const struct lys_module *mod, sr_datastore_t ds, sr_cid_t cid, uint32_t sid, const struct lyd_node *mod_diff, const struct lyd_node *mod_data, void *plg_data)
Store data for a module. Either a diff can be applied manually (if available) or full new data tree s...
Definition plugins_datastore.h:164
srds_conn_destroy
void(* srds_conn_destroy)(sr_conn_ctx_t *conn, void *plg_data)
Destroy (free) per-connection plugin data.
Definition plugins_datastore.h:111
srds_candidate_reset
sr_error_info_t *(* srds_candidate_reset)(const struct lys_module *mod, void *plg_data)
Reset candidate datastore to "no changes" - mirroring running.
Definition plugins_datastore.h:225
srds_copy
sr_error_info_t *(* srds_copy)(const struct lys_module *mod, sr_datastore_t trg_ds, sr_datastore_t src_ds, void *plg_data)
Copy data of a module from source datastore to the target datastore.
Definition plugins_datastore.h:203
srds_candidate_modified
sr_error_info_t *(* srds_candidate_modified)(const struct lys_module *mod, void *plg_data, int *modified)
Learn whether the candidate datastore was modified and is different from running.
Definition plugins_datastore.h:215
srds_install
sr_error_info_t *(* srds_install)(const struct lys_module *mod, sr_datastore_t ds, const char *owner, const char *group, mode_t perm, void *plg_data)
Setup datastore of a newly installed module.
Definition plugins_datastore.h:60
srds_load
sr_error_info_t *(* srds_load)(const struct lys_module *mod, sr_datastore_t ds, sr_cid_t cid, uint32_t sid, const char **xpaths, uint32_t xpath_count, void *plg_data, struct lyd_node **mod_data)
Load data of a module.
Definition plugins_datastore.h:186
sysrepo_types.h
public sysrepo types header
sr_cid_t
uint32_t sr_cid_t
Connection ID.
Definition sysrepo_types.h:94
sr_datastore_t
sr_datastore_t
Datastores that sysrepo supports. To change which datastore a session operates on,...
Definition sysrepo_types.h:121
sr_error_info_t
Detailed sysrepo session error information.
Definition sysrepo_types.h:169