sysrepo  5.2.34
YANG-based system repository for all-around configuration management.
private_candidate.h
Go to the documentation of this file.
1 
17 #ifndef SYSREPO_PRIVATE_CANDIDATE_H_
18 #define SYSREPO_PRIVATE_CANDIDATE_H_
19 
20 #include <libyang/libyang.h>
21 
22 #include "sysrepo.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
34 typedef enum {
39 
45 typedef enum {
57 
66 typedef struct {
67  struct lyd_node *run_diff;
68  struct lyd_node *pc_diff;
71 
75 typedef struct {
77  uint32_t conflict_count;
79 
102 int sr_pc_create_ds(sr_session_ctx_t *session, uint32_t subscription_opts, sr_subscription_ctx_t **subscription,
103  sr_priv_cand_t **private_candidate_ds);
104 
114 
121 
137 int sr_pc_update(sr_session_ctx_t *session, sr_priv_cand_t *private_candidate_ds, sr_pc_conflict_resolution_t conflict_resolution,
138  sr_pc_conflict_set_t **conflict_set);
139 
154 int sr_pc_commit(sr_session_ctx_t *session, sr_priv_cand_t *private_candidate_ds, sr_pc_conflict_set_t **conflict_set);
155 
168 int sr_pc_edit_config(sr_session_ctx_t *session, sr_priv_cand_t *private_candidate_ds, const struct lyd_node *edit,
169  const char *default_operation);
170 
186 int sr_pc_get_data(sr_session_ctx_t *session, const char *xpath, uint32_t max_depth, const uint32_t opts,
187  const sr_priv_cand_t *private_candidate_ds, sr_data_t **data);
188 
199 void sr_pc_discard_changes(sr_priv_cand_t *private_candidate_ds);
200 
211 int sr_pc_backup_privcand(sr_session_ctx_t *session, sr_priv_cand_t *privcand, sr_priv_cand_t **privcand_backup);
212 
221 void sr_pc_restore_privcand(sr_priv_cand_t *privcand_target, sr_priv_cand_t *privcand_backup);
222 
231 int sr_pc_validate(sr_session_ctx_t *session, const char *module_name, const sr_priv_cand_t *privcand);
232 
244 int sr_pc_replace_trg_config(sr_session_ctx_t *session, sr_priv_cand_t *privcand, const char *module_name,
245  const struct lyd_node *src_config);
246 
247 #ifdef __cplusplus
248 }
249 #endif
250 
251 #endif /* SYSREPO_PRIVATE_CANDIDATE_H_ */
Structure that safely wraps libyang data and prevents unexpected context changes.
struct sr_subscription_ctx_s sr_subscription_ctx_t
Sysrepo subscription context returned from sr_*_subscribe calls, it is supposed to be released by the...
int sr_pc_backup_privcand(sr_session_ctx_t *session, sr_priv_cand_t *privcand, sr_priv_cand_t **privcand_backup)
Make a backup copy of the private candidate datastore structure.
int sr_pc_create_ds(sr_session_ctx_t *session, uint32_t subscription_opts, sr_subscription_ctx_t **subscription, sr_priv_cand_t **private_candidate_ds)
Creates a private candidate datastore structure.
struct lyd_node * pc_diff
int sr_pc_replace_trg_config(sr_session_ctx_t *session, sr_priv_cand_t *privcand, const char *module_name, const struct lyd_node *src_config)
Replaces private candidate datastore with the contents of another conventional datastore.
void sr_pc_restore_privcand(sr_priv_cand_t *privcand_target, sr_priv_cand_t *privcand_backup)
Replaces the content of private candidate structure with the content of another private candidate str...
sr_pc_conflict_type_t type
int sr_pc_commit(sr_session_ctx_t *session, sr_priv_cand_t *private_candidate_ds, sr_pc_conflict_set_t **conflict_set)
Performs <commit> operation on private candidate datastore.
void sr_pc_free_conflicts(sr_pc_conflict_set_t *conflict_set)
Remove and free all conflict data.
void sr_pc_discard_changes(sr_priv_cand_t *private_candidate_ds)
Performs <discard-changes> operation on private candidate datastore.
sr_pc_conflict_type_t
Types of conflicts that may occur during private candidate datastore <update>.
@ SR_PC_CONFLICT_LEAFLIST_ORDER
@ SR_PC_CONFLICT_VALUE_CHANGE
@ SR_PC_CONFLICT_LIST_ENTRY
@ SR_PC_CONFLICT_LEAFLIST_ITEM
@ SR_PC_CONFLICT_LEAF_EXISTENCE
@ SR_PC_CONFLICT_PRESENCE_CONTAINER
@ SR_PC_CONFLICT_LIST_ORDER
struct lyd_node * run_diff
sr_pc_conflict_resolution_t
Strategies for resolving configuration conflicts when merging candidate and running datastores.
@ SR_PC_REVERT_ON_CONFLICT
@ SR_PC_PREFER_CANDIDATE
@ SR_PC_PREFER_RUNNING
int sr_pc_get_data(sr_session_ctx_t *session, const char *xpath, uint32_t max_depth, const uint32_t opts, const sr_priv_cand_t *private_candidate_ds, sr_data_t **data)
Retrieve a tree whose root nodes match the provided XPath. Data are represented as libyang subtrees.
sr_pc_conflict_info_t * conflicts
int sr_pc_destroy_ds(sr_session_ctx_t *session, sr_priv_cand_t *privcand)
Destroys the private candidate datastore structure.
int sr_pc_edit_config(sr_session_ctx_t *session, sr_priv_cand_t *private_candidate_ds, const struct lyd_node *edit, const char *default_operation)
Performs <edit-config> operation on private candidate datastore.
int sr_pc_update(sr_session_ctx_t *session, sr_priv_cand_t *private_candidate_ds, sr_pc_conflict_resolution_t conflict_resolution, sr_pc_conflict_set_t **conflict_set)
Performs <update> operation on private candidate datastore.
int sr_pc_validate(sr_session_ctx_t *session, const char *module_name, const sr_priv_cand_t *privcand)
Perform the validation of private candidate datastore.
Structure representing a set of detected conflicts between the running and private candidate datastor...
Stores information about conflicts.
public API sysrepo header
struct sr_session_ctx_s sr_session_ctx_t
Sysrepo session on a connection.
struct sr_priv_cand_s sr_priv_cand_t
Private candidate datastore context.