Skip to content

Updating library for TidesDB 1 changes. #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ code, message = db.create_column_family(
true, -- Enable compression
db.COMPRESS_SNAPPY, -- Compression algorithm can be NO_COMPRESSION, COMPRESS_SNAPPY, COMPRESS_LZ4, COMPRESS_ZSTD
true, -- Enable bloom filter
db.TDB_MEMTABLE_SKIP_LIST, -- Use skip list for memtable
)

-- Put key-value pair into the database
Expand Down
19 changes: 6 additions & 13 deletions spec/tidesdb_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ local prob_skip_list = 0.24
local enable_compression = true
local compression_algo = lib.COMPRESS_SNAPPY
local enable_bloom_filter = true
local db_data_struct = lib.TDB_MEMTABLE_SKIP_LIST

local key = "key"
local key_size = string.len(key)
Expand Down Expand Up @@ -70,8 +69,7 @@ describe("create and drop column", function()
prob_skip_list,
enable_compression,
compression_algo,
enable_bloom_filter,
db_data_struct)
enable_bloom_filter)
assert.is_equal(0, code)

code, message = db:drop_column_family(name)
Expand All @@ -95,8 +93,7 @@ describe("put and get", function()
prob_skip_list,
enable_compression,
compression_algo,
enable_bloom_filter,
db_data_struct)
enable_bloom_filter)
assert.is_equal(0, code)

code, message = db:put(name, key, value, ttl)
Expand Down Expand Up @@ -127,8 +124,7 @@ describe("put and delete", function()
prob_skip_list,
enable_compression,
compression_algo,
enable_bloom_filter,
db_data_struct)
enable_bloom_filter)
assert.is_equal(0, code)

code, message = db:put(name, key, value, ttl)
Expand Down Expand Up @@ -158,8 +154,7 @@ describe("list column families", function()
prob_skip_list,
enable_compression,
compression_algo,
enable_bloom_filter,
db_data_struct)
enable_bloom_filter)
assert.is_equal(0, code)

code, message, list = db:list_column_families()
Expand All @@ -186,8 +181,7 @@ describe("transactions begin and free", function()
prob_skip_list,
enable_compression,
compression_algo,
enable_bloom_filter,
db_data_struct)
enable_bloom_filter)
assert.is_equal(0, code)

code, message, txn = lib.txn_begin(db, name)
Expand Down Expand Up @@ -217,8 +211,7 @@ describe("transactions put and delete", function()
prob_skip_list,
enable_compression,
compression_algo,
enable_bloom_filter,
db_data_struct)
enable_bloom_filter)
assert.is_equal(0, code)

code, message, txn = lib.txn_begin(db, name)
Expand Down
4 changes: 2 additions & 2 deletions src/tidesdb-lua.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ static int create_column_family(lua_State *L)
const tidesdb_compression_algo_t compression_algo =
(tidesdb_compression_algo_t)luaL_checkinteger(L, 7);
const bool enable_bloom_filter = lua_toboolean(L, 8);
const tidesdb_memtable_ds_t db_data_struct = (tidesdb_memtable_ds_t)luaL_checkinteger(L, 9);

tidesdb_err_t *ret = tidesdb_create_column_family(
db, column_family, flush_threshold, max_skip_level, prob_skip_level, enable_compression,
compression_algo, enable_bloom_filter, db_data_struct);
compression_algo, enable_bloom_filter);
LUA_RET_CODE()
}
static int drop_column_family(lua_State *L)
Expand Down
22 changes: 7 additions & 15 deletions test_lua.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ local prob_skip_list = 0.24
local enable_compression = true
local compression_algo = lib.COMPRESS_SNAPPY
local enable_bloom_filter = true
local db_data_struct = lib.TDB_MEMTABLE_SKIP_LIST

local key = "key"
local key_size = string.len(key)
Expand All @@ -54,8 +53,7 @@ function test_create_and_drop_column()
prob_skip_list,
enable_compression,
compression_algo,
enable_bloom_filter,
db_data_struct)
enable_bloom_filter)
assert(code == 0, message)

code, message = db:drop_column_family(name)
Expand All @@ -75,8 +73,7 @@ function test_put_and_get()
prob_skip_list,
enable_compression,
compression_algo,
enable_bloom_filter,
db_data_struct)
enable_bloom_filter)
assert(code == 0, message)

code, message = db:put(name, key, value, ttl)
Expand All @@ -103,8 +100,7 @@ function test_put_and_delete()
prob_skip_list,
enable_compression,
compression_algo,
enable_bloom_filter,
db_data_struct)
enable_bloom_filter)
assert(code == 0, message)

code, message = db:put(name, key, value, ttl)
Expand All @@ -130,8 +126,7 @@ function test_put_and_compact()
prob_skip_list,
enable_compression,
compression_algo,
enable_bloom_filter,
db_data_struct)
enable_bloom_filter)
assert(code == 0, message)

for i=1,20 do
Expand All @@ -158,8 +153,7 @@ function test_list_column_families()
prob_skip_list,
enable_compression,
compression_algo,
enable_bloom_filter,
db_data_struct)
enable_bloom_filter)
assert(code == 0, message)
assert(code == 0, message)

Expand All @@ -185,8 +179,7 @@ function test_txn_begin_and_free()
prob_skip_list,
enable_compression,
compression_algo,
enable_bloom_filter,
db_data_struct)
enable_bloom_filter)
assert(code == 0, message)

code, message, txn = lib.txn_begin(db, name)
Expand All @@ -211,8 +204,7 @@ function test_txn_put_and_delete()
prob_skip_list,
enable_compression,
compression_algo,
enable_bloom_filter,
db_data_struct)
enable_bloom_filter)
assert(code == 0, message)

code, message, txn = lib.txn_begin(db, name)
Expand Down