Skip to content

Commit

Permalink
Merge pull request #49 from VioletaStepanyan/main
Browse files Browse the repository at this point in the history
Code refactoring, add test.
  • Loading branch information
VioletaStepanyan authored Sep 5, 2022
2 parents 129a5eb + 9704974 commit 34bc2f5
Show file tree
Hide file tree
Showing 10 changed files with 354 additions and 148 deletions.
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"showDisplayString": true,
"stopAtEntry": false,
"externalConsole": false,
"preLaunchTask": "Build Native: Debug",
"preLaunchTask": "Build Native: Debug RocksDB Test",
"MIMode": "gdb",
"miDebuggerPath": "/usr/bin/gdb"
},
Expand All @@ -54,7 +54,7 @@
"showDisplayString": true,
"stopAtEntry": false,
"externalConsole": false,
"preLaunchTask": "Build Native: Debug",
"preLaunchTask": "Build Native: Debug LevelDB Test",
"MIMode": "gdb",
"miDebuggerPath": "/usr/bin/gdb"
},
Expand Down
12 changes: 12 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@
"args": [],
"type": "shell"
},
{
"label": "Build Native: Debug RocksDB Test",
"command": "cmake -DCMAKE_BUILD_TYPE=Debug . && make ukv_rocksdb_test",
"args": [],
"type": "shell"
},
{
"label": "Build Native: Debug LevelDB Test",
"command": "cmake -DCMAKE_BUILD_TYPE=Debug . && make ukv_leveldb_test",
"args": [],
"type": "shell"
},
{
"label": "Build Native: Debug Arrow Test",
// Both must pass builds
Expand Down
12 changes: 12 additions & 0 deletions include/ukv/cpp/db.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,18 @@ class col_t {
return (maybe->min + maybe->max) / 2;
}

status_t clear() noexcept {
status_t status;
ukv_col_drop(db_, nullptr, col_, ukv_col_drop_keys_vals_k, status.member_ptr());
return status;
}

status_t clear_values() noexcept {
status_t status;
ukv_col_drop(db_, nullptr, col_, ukv_col_drop_vals_k, status.member_ptr());
return status;
}

inline members_ref_gt<places_arg_t> operator[](std::initializer_list<ukv_key_t> keys) noexcept { return at(keys); }
inline members_ref_gt<places_arg_t> at(std::initializer_list<ukv_key_t> keys) noexcept { //
return at(strided_range(keys));
Expand Down
12 changes: 12 additions & 0 deletions include/ukv/cpp/graph_ref.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,18 @@ class graph_ref_t {
return status;
}

status_t clear_edges() noexcept {
status_t status;
ukv_col_drop(db_, nullptr, col_, ukv_col_drop_vals_k, status.member_ptr());
return status;
}

status_t clear() noexcept {
status_t status;
ukv_col_drop(db_, nullptr, col_, ukv_col_drop_keys_vals_k, status.member_ptr());
return status;
}

expected_gt<ukv_vertex_degree_t> degree( //
ukv_key_t vertex,
ukv_vertex_role_t role = ukv_vertex_role_any_k,
Expand Down
4 changes: 3 additions & 1 deletion src/arrow_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -566,10 +566,12 @@ void ukv_col_upsert(
std::memcpy(c_col, id_ptr->body->data(), sizeof(ukv_col_t));
}

void ukv_col_remove(
void ukv_col_drop(
// Inputs:
ukv_t const c_db,
ukv_str_view_t c_col_name,
ukv_col_t c_col_id,
ukv_col_drop_mode_t c_mode,
// Outputs:
ukv_error_t* c_error) {

Expand Down
Loading

0 comments on commit 34bc2f5

Please sign in to comment.