Skip to content

Commit

Permalink
Support API change to sdskv_provider_add_database.
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelkgutierrez committed May 3, 2018
1 parent 8499f13 commit 0bbdf41
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/sdsdkv-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ class sdsdkv_iconfig {
//
std::string group_name;
//
std::string db_path;
//
std::string db_name;
//
std::string comm_protocol;
Expand All @@ -87,6 +89,7 @@ class sdsdkv_iconfig {
hash_be = config.hash_be;
db_type = config.db_type;
group_name = string(config.group_name);
db_path = string(config.db_path);
db_name = string(config.db_name);
comm_protocol = string(config.comm_protocol);
//
Expand Down
3 changes: 2 additions & 1 deletion src/sdsdkv-server.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,10 @@ struct sdsdkv_server : public personality {
m_provider,
// TODO(skg) make unique for each server.
m_config->db_name.c_str(),
m_config->db_path.c_str(),
sdsdkv_iconfig::get_real_db_type(m_config->db_type),
// TODO(skg) Make a user param.
SDSKV_COMPARE_DEFAULT, /* sdskv_compare_fn comp_fn */
SDSKV_COMPARE_DEFAULT,
&m_dbid
);
if (rc != SDSKV_SUCCESS) return sdskv2irc(rc);
Expand Down
2 changes: 2 additions & 0 deletions src/sdsdkv.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ typedef struct sdsdkv_config {
sdsdkv_config_db db_type;
/** Group name. */
char *group_name;
/** If applicable, the path where database files will be written. */
char *db_path;
/** Database name. */
char *db_name;
/** Communication protocol. */
Expand Down
5 changes: 5 additions & 0 deletions tests/trivial.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ main(int argc, char **argv)
erc = MPI_Comm_size(MPI_COMM_WORLD, &numpe);
if (erc != MPI_SUCCESS) ABORT(rank, erc);

char *db_path = getenv("PWD");
if (!db_path) db_path = (char *)"/tmp";

sdsdkv_config dkv_config = {
/* .init_comm = */
MPI_COMM_WORLD,
Expand All @@ -58,6 +61,8 @@ main(int argc, char **argv)
SDSDKV_DB_LEVELDB,
/* .group_name = */
(char *)"groupname",
/* .db_path = */
db_path,
/* .db_name = */
(char *)"TEST-DB",
/* .comm_protocol */
Expand Down

0 comments on commit 0bbdf41

Please sign in to comment.