Skip to content

Commit

Permalink
Update fdb_c.cc
Browse files Browse the repository at this point in the history
Initial direct config implementation
  • Loading branch information
TomHodson committed Sep 30, 2024
1 parent 713b678 commit 39f2db9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
9 changes: 5 additions & 4 deletions src/fdb5/api/fdb_c.cc
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,11 @@ int fdb_new_handle(fdb_handle_t** fdb) {
});
}

int fdb_new_handle_from_yaml(fdb_handle_t** fdb, const char* yaml) {
return wrapApiFunction([fdb, yaml] {
std::string s(yaml);
Config cfg = Config().expandConfig(s);
int fdb_new_handle_from_yaml(fdb_handle_t** fdb, const char* system_config, const char* user_config) {
return wrapApiFunction([fdb, system_config, user_config] {
Config cfg{YAMLConfiguration(std::string(system_config)), YAMLConfiguration(std::string(user_config))};
cfg.set("configSource", "yaml");
cfg.expandConfig();
*fdb = new fdb_handle_t(cfg);
});

Expand Down
5 changes: 3 additions & 2 deletions src/fdb5/api/fdb_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,11 @@ int fdb_new_handle(fdb_handle_t** fdb);

/** Creates a FDB instance from a YAML configuration.
* \param fdb FDB instance. Returned instance must be deleted using #fdb_delete_handle.
* \param yaml YAML configuration string
* \param system_config Override the system config with this YAML string
* \param user_config Supply user level config with this YAML string
* \returns Return code (#FdbErrorValues)
*/
int fdb_new_handle_from_yaml(fdb_handle_t** fdb, const char* yaml);
int fdb_new_handle_from_yaml(fdb_handle_t** fdb, const char* system_config, const char* user_config);

/** Archives binary data to a FDB instance.
* \warning this is a low-level API. The provided key and the corresponding data are not checked for consistency
Expand Down

0 comments on commit 39f2db9

Please sign in to comment.