Hi Michal, On Wed, 2019-07-10 at 09:52 +0200, Michał Lowas-Rzechonek wrote: > On 07/09, Inga Stotland wrote: > > This adds the following generic APIs to mesh-config.h > > void *mesh_config_create_config(void); > > void mesh_config_release_config(void *config); > > void *mesh_config_get_config(const char *dir); > > void *mesh_config_get_config_backup(const char *dir); > > bool mesh_config_restore_backup(const char *dir); > > bool mesh_config_save_config(const char *dir, void *cfg); > > > > The implementation of these API routines depends on the > > underlying storage directory structure and can be specific to > > a chosen configuration file format. > > I don't like the assumption that each node is stored in a separate > file, > and there needs to be a backup file. > > One of the storage formats I had in mind is a single transactional > database (some flavor of berkeley db, or maybe even sqlite) that > would > hold all the nodes. > > With this in mind, how about: > > union mesh_config *mesh_config_create_config(const uint8_t > uuid[16]); > bool mesh_config_save(union mesh_config *cfg); > > and to iterate over saved nodes: > typedef struct mesh_node *(*mesh_node_load_cb)(union mesh_config > *cfg, > const uint8_t > uuid[16], > void *user_data); > > void mesh_config_load_nodes(mesh_node_load_cb cb, void > *user_data); > > and move file/directory handling from storage.c to mesh-config- > json.c? > > > regards If we do away with the notion that each node has its own directory, this means that entire node parsing procedure needs to be pushed into the corresponding mesh-config-<specific> implementation and storage.c becomes obsolete.
Attachment:
smime.p7s
Description: S/MIME cryptographic signature