diff --git a/lib/clixon/clixon_data.h b/lib/clixon/clixon_data.h index 5ee4392e..320d2c98 100644 --- a/lib/clixon/clixon_data.h +++ b/lib/clixon/clixon_data.h @@ -43,25 +43,6 @@ #ifndef _CLIXON_DATA_H_ #define _CLIXON_DATA_H_ -/* - * Types - */ -/* Struct per database in hash - * Semantics of de_modified is to implement this from RFC 6241 Sec 7.5: - * The target configuration is , it has already been - * modified, and these changes have not been committed or rolled back. - */ -typedef struct { - uint32_t de_id; /* If set, locked by this client/session id */ - struct timeval de_tv; /* Timevalue, set by lock/unlock */ - cxobj *de_xml; /* cache */ - int de_modified; /* Dirty since loaded/copied/committed/etc Used by lock - * This set by NETCONF edit-config, copy, delete, - * reset by commit, discard - */ - int de_empty; /* Empty on read from file, xmldb_readfile and xmldb_put sets it */ -} db_elmnt; - /* * Prototypes */ @@ -108,9 +89,6 @@ int clicon_conf_xml_set(clixon_handle h, cxobj *x); cxobj *clicon_conf_restconf(clixon_handle h); cxobj *clicon_conf_autocli(clixon_handle h); -db_elmnt *clicon_db_elmnt_get(clixon_handle h, const char *db); -int clicon_db_elmnt_set(clixon_handle h, const char *db, db_elmnt *xc); - /**/ /* Set and get authorized user name */ char *clicon_username_get(clixon_handle h); diff --git a/lib/clixon/clixon_datastore.h b/lib/clixon/clixon_datastore.h index 1f5cf94c..e5562adc 100644 --- a/lib/clixon/clixon_datastore.h +++ b/lib/clixon/clixon_datastore.h @@ -39,10 +39,32 @@ #define _CLIXON_DATASTORE_H /* - * Prototypes - * API + * Types */ -/* Internal functions */ +/* Struct per database in hash + * Semantics of de_modified is to implement this from RFC 6241 Sec 7.5: + * The target configuration is , it has already been + * modified, and these changes have not been committed or rolled back. + */ +struct db_elmnt { + uint32_t de_id; /* If set, locked by this client/session id */ + struct timeval de_tv; /* Timevalue, set by lock/unlock */ + cxobj *de_xml; /* cache */ + int de_modified; /* Dirty since loaded/copied/committed/etc + * For NETCONF lock. Set by edit-config, copy, delete, + * reset by commit, discard + */ + int de_empty; /* Empty on read from file, xmldb_readfile and xmldb_put sets it */ + int de_volatile; /* Do not sync to disk on every update (ie xmldb_put) */ +}; +typedef struct db_elmnt db_elmnt; + +/* + * Prototypes + */ + +db_elmnt *clicon_db_elmnt_get(clixon_handle h, const char *db); +int clicon_db_elmnt_set(clixon_handle h, const char *db, db_elmnt *xc); int xmldb_db2file(clixon_handle h, const char *db, char **filename); /* API */ @@ -70,6 +92,9 @@ cxobj *xmldb_cache_get(clixon_handle h, const char *db); int xmldb_modified_get(clixon_handle h, const char *db); int xmldb_modified_set(clixon_handle h, const char *db, int value); int xmldb_empty_get(clixon_handle h, const char *db); +int xmldb_empty_set(clixon_handle h, const char *db, int value); +int xmldb_volatile_get(clixon_handle h, const char *db); +int xmldb_volatile_set(clixon_handle h, const char *db, int value); int xmldb_print(clixon_handle h, FILE *f); int xmldb_rename(clixon_handle h, const char *db, const char *newdb, const char *suffix); int xmldb_populate(clixon_handle h, const char *db);