BangDB Environment API – BangDB = NoSQL + AI + Stream

BangDB Environment API


BangDB Environment





To get started with BangDB Server, we need to follow following two steps process using client of BangDB Initialize and get bangdb env instance

bangdbEnv *getInstance(const char *host = NULL,const char *port = NULL,const char * clientConfigPath = NULL,const char *userid = NULL,const char *password = NULL,bool init_sock_conns = true,bool tls = false); It returns NULL for error else the envirnment reference
Get the db reference
bangdb_database *openDatabase(const char *dbname, db_param *dpm = NULL); The db_param is structure which defines the parameters for database. You may leave it NULL for defualt to be used or initialize it for overriding the param values This returns NULL for error You may combine above two steps into single step by calling; bangdb_database *getBangDB(const char *dbname, bangdbEnv **dbenv, db_param *dbp = NULL);
Note: i. bangdbEnv is singleton and getInstance returns same reference for a given host. port combination. Therefore, we should not close it until the end of the program or before exit ii. bangdb_database could be closed or opened as needed during the program iii. client can have bangdbEnv for different hosts at a time for a given set of pairs of the host, port. And for each of these environment, user should get the database accordingly and maintain it properly
To verify the database (instead of opening)
db_param *verifyDatabase(const char *dbname); It will return NULL for error else the dp_param for the database. User will need to delete the reference as required
To get the database reference
db_param *verifyDatabase(const char *dbname); Note that this the reference of the database already created or opened. Hence user should not delete this