@@ -40,7 +40,10 @@ ffi.cdef[[
4040 static const int TDB_ERR_LOCKED = -12 ;
4141
4242 // Structures
43+ static const int TDB_MAX_CF_NAME_LEN = 128 ;
44+
4345 typedef struct {
46+ char name [128 ];
4447 size_t write_buffer_size ;
4548 size_t level_size_ratio ;
4649 int min_levels ;
@@ -371,8 +374,16 @@ function tidesdb.default_column_family_config()
371374end
372375
373376-- Convert Lua config to C struct
374- local function config_to_c_struct (config )
377+ local function config_to_c_struct (config , cf_name )
375378 local c_config = ffi .new (" tidesdb_column_family_config_t" )
379+
380+ -- Set the name field if provided
381+ if cf_name then
382+ local name_len = math.min (# cf_name , 127 )
383+ ffi .copy (c_config .name , cf_name , name_len )
384+ c_config .name [name_len ] = 0
385+ end
386+
376387 c_config .write_buffer_size = config .write_buffer_size or 64 * 1024 * 1024
377388 c_config .level_size_ratio = config .level_size_ratio or 10
378389 c_config .min_levels = config .min_levels or 5
@@ -845,7 +856,7 @@ function TidesDB:create_column_family(name, config)
845856 config = tidesdb .default_column_family_config ()
846857 end
847858
848- local c_config = config_to_c_struct (config )
859+ local c_config = config_to_c_struct (config , name )
849860 local result = lib .tidesdb_create_column_family (self ._db , name , c_config )
850861 check_result (result , " failed to create column family" )
851862end
@@ -1042,6 +1053,6 @@ function tidesdb.save_config_to_ini(ini_file, section_name, config)
10421053end
10431054
10441055-- Version
1045- tidesdb ._VERSION = " 0.5.1 "
1056+ tidesdb ._VERSION = " 0.5.2 "
10461057
10471058return tidesdb
0 commit comments