@@ -212,7 +212,7 @@ class _CColumnFamilyConfig(Structure):
212212 ("use_btree" , c_int ),
213213 ("commit_hook_fn" , c_void_p ),
214214 ("commit_hook_ctx" , c_void_p ),
215- ("object_target_file_size " , c_size_t ),
215+ ("_object_target_file_size_reserved " , c_size_t ),
216216 ("object_lazy_compaction" , c_int ),
217217 ("object_prefetch_compaction" , c_int ),
218218 ]
@@ -411,6 +411,9 @@ class _CDbStats(Structure):
411411_lib .tidesdb_txn_delete .argtypes = [c_void_p , c_void_p , POINTER (c_uint8 ), c_size_t ]
412412_lib .tidesdb_txn_delete .restype = c_int
413413
414+ _lib .tidesdb_txn_single_delete .argtypes = [c_void_p , c_void_p , POINTER (c_uint8 ), c_size_t ]
415+ _lib .tidesdb_txn_single_delete .restype = c_int
416+
414417_lib .tidesdb_txn_commit .argtypes = [c_void_p ]
415418_lib .tidesdb_txn_commit .restype = c_int
416419
@@ -657,7 +660,6 @@ class ColumnFamilyConfig:
657660 l1_file_count_trigger : int = 4
658661 l0_queue_stall_threshold : int = 20
659662 use_btree : bool = False
660- object_target_file_size : int = 0
661663 object_lazy_compaction : bool = False
662664 object_prefetch_compaction : bool = True
663665
@@ -690,7 +692,6 @@ def _to_c_struct(self, name: str = "") -> _CColumnFamilyConfig:
690692 c_config .l1_file_count_trigger = self .l1_file_count_trigger
691693 c_config .l0_queue_stall_threshold = self .l0_queue_stall_threshold
692694 c_config .use_btree = 1 if self .use_btree else 0
693- c_config .object_target_file_size = self .object_target_file_size
694695 c_config .object_lazy_compaction = 1 if self .object_lazy_compaction else 0
695696 c_config .object_prefetch_compaction = 1 if self .object_prefetch_compaction else 0
696697
@@ -864,7 +865,6 @@ def default_column_family_config() -> ColumnFamilyConfig:
864865 l1_file_count_trigger = c_config .l1_file_count_trigger ,
865866 l0_queue_stall_threshold = c_config .l0_queue_stall_threshold ,
866867 use_btree = bool (c_config .use_btree ),
867- object_target_file_size = c_config .object_target_file_size ,
868868 object_lazy_compaction = bool (c_config .object_lazy_compaction ),
869869 object_prefetch_compaction = bool (c_config .object_prefetch_compaction ),
870870 )
@@ -927,7 +927,6 @@ def load_config_from_ini(file_path: str, cf_name: str) -> ColumnFamilyConfig:
927927 l1_file_count_trigger = c_config .l1_file_count_trigger ,
928928 l0_queue_stall_threshold = c_config .l0_queue_stall_threshold ,
929929 use_btree = bool (c_config .use_btree ),
930- object_target_file_size = c_config .object_target_file_size ,
931930 object_lazy_compaction = bool (c_config .object_lazy_compaction ),
932931 object_prefetch_compaction = bool (c_config .object_prefetch_compaction ),
933932 )
@@ -1304,7 +1303,6 @@ def get_stats(self) -> Stats:
13041303 l1_file_count_trigger = c_cfg .l1_file_count_trigger ,
13051304 l0_queue_stall_threshold = c_cfg .l0_queue_stall_threshold ,
13061305 use_btree = bool (c_cfg .use_btree ),
1307- object_target_file_size = c_cfg .object_target_file_size ,
13081306 object_lazy_compaction = bool (c_cfg .object_lazy_compaction ),
13091307 object_prefetch_compaction = bool (c_cfg .object_prefetch_compaction ),
13101308 )
@@ -1424,6 +1422,36 @@ def delete(self, cf: ColumnFamily, key: bytes) -> None:
14241422 if result != TDB_SUCCESS :
14251423 raise TidesDBError .from_code (result , "failed to delete key" )
14261424
1425+ def single_delete (self , cf : ColumnFamily , key : bytes ) -> None :
1426+ """
1427+ Write a tombstone carrying a caller-provided promise that the key has been
1428+ put at most once since its previous single-delete (or since the start of
1429+ history). This lets compaction drop the put and the tombstone together as
1430+ soon as both appear in the same merge input, rather than carrying the
1431+ tombstone forward to the largest active level. Read semantics match delete().
1432+
1433+ The engine does not verify the promise at runtime; violating it can leave
1434+ older puts visible and is a bug in the caller. Use only for insert-once-
1435+ then-delete patterns (classic insert benchmarks, secondary indexes on
1436+ never-updated columns, log tables with scheduled purges). Not safe for
1437+ repeated updates to the same key. When in doubt, prefer delete().
1438+
1439+ Args:
1440+ cf: Column family handle
1441+ key: Key as bytes
1442+ """
1443+ if self ._closed :
1444+ raise TidesDBError ("Transaction is closed" )
1445+ if self ._committed :
1446+ raise TidesDBError ("Transaction already committed" )
1447+
1448+ key_buf = (c_uint8 * len (key )).from_buffer_copy (key ) if key else None
1449+
1450+ result = _lib .tidesdb_txn_single_delete (self ._txn , cf ._cf , key_buf , len (key ))
1451+
1452+ if result != TDB_SUCCESS :
1453+ raise TidesDBError .from_code (result , "failed to single-delete key" )
1454+
14271455 def commit (self ) -> None :
14281456 """Commit the transaction."""
14291457 if self ._closed :
0 commit comments