MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / lbug_database_init

Function lbug_database_init

src/c_api/database.cpp:10–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8using namespace lbug::common;
9
10lbug_state lbug_database_init(const char* database_path, lbug_system_config config,
11 lbug_database* out_database) {
12 try {
13 clearLastCAPIErrorMessage();
14 std::string database_path_str = database_path;
15 auto systemConfig = SystemConfig(config.buffer_pool_size, config.max_num_threads,
16 config.enable_compression, config.read_only, config.max_db_size, config.auto_checkpoint,
17 config.checkpoint_threshold, true, config.throw_on_wal_replay_failure,
18 config.enable_checksums, config.enable_multi_writes, config.enable_default_hash_index);
19
20#if defined(__APPLE__)
21 systemConfig.threadQos = config.thread_qos;
22#endif
23 out_database->_database = new Database(database_path_str, systemConfig);
24 } catch (Exception& e) {
25 out_database->_database = nullptr;
26 setLastCAPIErrorMessage(e.what());
27 return LbugError;
28 }
29 return LbugSuccess;
30}
31
32void lbug_database_destroy(lbug_database* database) {
33 if (database == nullptr) {

Callers 2

TEST_FFunction · 0.85
mainFunction · 0.85

Calls 4

SystemConfigClass · 0.85
setLastCAPIErrorMessageFunction · 0.85
whatMethod · 0.80

Tested by 1

TEST_FFunction · 0.68