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
plugins_datastore.h
Go to the documentation of this file.
1 
17 #ifndef _SYSREPO_PLUGINS_DATASTORE_H
18 #define _SYSREPO_PLUGINS_DATASTORE_H
19 
20 #include <stdint.h>
21 #include <sys/types.h>
22 
23 #include <libyang/libyang.h>
24 
25 #include "sysrepo_types.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
32 // Datastore Plugin API
34 
43 #define SRPLG_DS_API_VERSION 12
44 
60 typedef sr_error_info_t *(*srds_install)(const struct lys_module *mod, sr_datastore_t ds, const char *owner,
61  const char *group, mode_t perm, void *plg_data);
62 
72 typedef sr_error_info_t *(*srds_uninstall)(const struct lys_module *mod, sr_datastore_t ds, void *plg_data);
73 
87 typedef sr_error_info_t *(*srds_init)(const struct lys_module *mod, sr_datastore_t ds, void *plg_data);
88 
101 typedef sr_error_info_t *(*srds_conn_init)(sr_conn_ctx_t *conn, void **plg_data);
102 
111 typedef void (*srds_conn_destroy)(sr_conn_ctx_t *conn, void *plg_data);
112 
134 typedef sr_error_info_t *(*srds_store)(const struct lys_module *mod, sr_datastore_t ds, sr_cid_t cid, uint32_t sid,
135  const struct lyd_node *mod_diff, const struct lyd_node *mod_data, void *plg_data);
136 
156 typedef sr_error_info_t *(*srds_load)(const struct lys_module *mod, sr_datastore_t ds, sr_cid_t cid, uint32_t sid,
157  const char **xpaths, uint32_t xpath_count, void *plg_data, struct lyd_node **mod_data);
158 
173 typedef sr_error_info_t *(*srds_copy)(const struct lys_module *mod, sr_datastore_t trg_ds, sr_datastore_t src_ds,
174  void *plg_data);
175 
185 typedef sr_error_info_t *(*srds_candidate_modified)(const struct lys_module *mod, void *plg_data, int *modified);
186 
195 typedef sr_error_info_t *(*srds_candidate_reset)(const struct lys_module *mod, void *plg_data);
196 
209 typedef sr_error_info_t *(*srds_access_set)(const struct lys_module *mod, sr_datastore_t ds, const char *owner,
210  const char *group, mode_t perm, void *plg_data);
211 
225 typedef sr_error_info_t *(*srds_access_get)(const struct lys_module *mod, sr_datastore_t ds, void *plg_data, char **owner,
226  char **group, mode_t *perm);
227 
239 typedef sr_error_info_t *(*srds_access_check)(const struct lys_module *mod, sr_datastore_t ds, void *plg_data, int *read,
240  int *write);
241 
254 typedef sr_error_info_t *(*srds_last_modif)(const struct lys_module *mod, sr_datastore_t ds, void *plg_data,
255  struct timespec *mtime);
256 
276 typedef sr_error_info_t *(*srds_data_version)(const struct lys_module *mod, sr_datastore_t ds, void *plg_data,
277  uint32_t *version);
278 
282 struct srplg_ds_s {
283  const char *name;
299 };
300 
307 #define SRPLG_DATASTORE \
308  uint32_t srpds_apiver__ = SRPLG_DS_API_VERSION; \
309  const struct srplg_ds_s srpds__
310 
313 #ifdef __cplusplus
314 }
315 #endif
316 
317 #endif /* _SYSREPO_PLUGINS_DATASTORE_H */
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.
Datastore plugin structure.
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.
sr_error_info_t *(* srds_candidate_reset)(const struct lys_module *mod, void *plg_data)
Reset candidate datastore to &quot;no changes&quot; - mirroring running.
sr_datastore_t
Datastores that sysrepo supports. To change which datastore a session operates on, use sr_session_switch_ds.
srds_data_version data_version_cb
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.
sr_error_info_t *(* srds_conn_init)(sr_conn_ctx_t *conn, void **plg_data)
Initialize per-connection plugin data.
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.
srds_store store_cb
srds_load load_cb
srds_last_modif last_modif_cb
srds_access_get access_get_cb
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 ...
public sysrepo types header
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.
Detailed sysrepo session error information.
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 ...
uint32_t sr_cid_t
Connection ID.
Definition: sysrepo_types.h:94
srds_access_set access_set_cb
srds_access_check access_check_cb
struct sr_conn_ctx_s sr_conn_ctx_t
Sysrepo connection.
Definition: sysrepo_types.h:89
srds_candidate_modified candidate_modified_cb
void(* srds_conn_destroy)(sr_conn_ctx_t *conn, void *plg_data)
Destroy (free) per-connection plugin data.
sr_error_info_t *(* srds_store)(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...
srds_conn_destroy conn_destroy_cb
srds_candidate_reset candidate_reset_cb
srds_init init_cb
const char * name
srds_uninstall uninstall_cb
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. ...
srds_conn_init conn_init_cb
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.
srds_install install_cb
srds_copy copy_cb
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.
sr_error_info_t *(* srds_uninstall)(const struct lys_module *mod, sr_datastore_t ds, void *plg_data)
Destroy data of an uninstalled module.