sysrepo  2.11.7
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 11
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 
135 typedef sr_error_info_t *(*srds_store)(const struct lys_module *mod, sr_datastore_t ds, const struct lyd_node *mod_diff,
136  const struct lyd_node *mod_data, void *plg_data);
137 
145 typedef void (*srds_recover)(const struct lys_module *mod, sr_datastore_t ds, void *plg_data);
146 
164 typedef sr_error_info_t *(*srds_load)(const struct lys_module *mod, sr_datastore_t ds, const char **xpaths,
165  uint32_t xpath_count, void *plg_data, struct lyd_node **mod_data);
166 
181 typedef sr_error_info_t *(*srds_copy)(const struct lys_module *mod, sr_datastore_t trg_ds, sr_datastore_t src_ds,
182  void *plg_data);
183 
193 typedef sr_error_info_t *(*srds_candidate_modified)(const struct lys_module *mod, void *plg_data, int *modified);
194 
203 typedef sr_error_info_t *(*srds_candidate_reset)(const struct lys_module *mod, void *plg_data);
204 
217 typedef sr_error_info_t *(*srds_access_set)(const struct lys_module *mod, sr_datastore_t ds, const char *owner,
218  const char *group, mode_t perm, void *plg_data);
219 
233 typedef sr_error_info_t *(*srds_access_get)(const struct lys_module *mod, sr_datastore_t ds, void *plg_data, char **owner,
234  char **group, mode_t *perm);
235 
247 typedef sr_error_info_t *(*srds_access_check)(const struct lys_module *mod, sr_datastore_t ds, void *plg_data, int *read,
248  int *write);
249 
262 typedef sr_error_info_t *(*srds_last_modif)(const struct lys_module *mod, sr_datastore_t ds, void *plg_data,
263  struct timespec *mtime);
264 
284 typedef sr_error_info_t *(*srds_data_version)(const struct lys_module *mod, sr_datastore_t ds, void *plg_data,
285  uint32_t *version);
286 
290 struct srplg_ds_s {
291  const char *name;
308 };
309 
316 #define SRPLG_DATASTORE \
317  uint32_t srpds_apiver__ = SRPLG_DS_API_VERSION; \
318  const struct srplg_ds_s srpds__
319 
322 #ifdef __cplusplus
323 }
324 #endif
325 
326 #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.
srds_recover recover_cb
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 ...
sr_error_info_t *(* srds_load)(const struct lys_module *mod, sr_datastore_t ds, const char **xpaths, uint32_t xpath_count, void *plg_data, struct lyd_node **mod_data)
Load data of a module.
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_recover)(const struct lys_module *mod, sr_datastore_t ds, void *plg_data)
Recover module data when a crash occurred while they were being written.
void(* srds_conn_destroy)(sr_conn_ctx_t *conn, void *plg_data)
Destroy (free) per-connection plugin data.
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_store)(const struct lys_module *mod, sr_datastore_t ds, 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 or full new data tree stored...
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
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.