Skip to content

Commit 5e5a79d

Browse files
authored
Merge pull request #34 from tidesdb/tdb742
#33 update python db configurations to align with latest patch in regards…
2 parents bed0269 + b80985a commit 5e5a79d

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "tidesdb"
7-
version = "0.6.0"
7+
version = "0.7.0"
88
description = "Official Python bindings for TidesDB - A high-performance embedded key-value storage engine"
99
readme = "README.md"
1010
requires-python = ">=3.10"

src/tidesdb/tidesdb.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,8 @@ class _CConfig(Structure):
207207
("log_level", c_int),
208208
("block_cache_size", c_size_t),
209209
("max_open_sstables", c_size_t),
210+
("log_to_file", c_int),
211+
("log_truncation_at", c_size_t),
210212
]
211213

212214

@@ -399,6 +401,8 @@ class Config:
399401
log_level: LogLevel = LogLevel.LOG_INFO
400402
block_cache_size: int = 64 * 1024 * 1024
401403
max_open_sstables: int = 256
404+
log_to_file: bool = False
405+
log_truncation_at: int = 24 * 1024 * 1024
402406

403407

404408
@dataclass
@@ -995,6 +999,8 @@ def __init__(self, config: Config) -> None:
995999
log_level=int(config.log_level),
9961000
block_cache_size=config.block_cache_size,
9971001
max_open_sstables=config.max_open_sstables,
1002+
log_to_file=1 if config.log_to_file else 0,
1003+
log_truncation_at=config.log_truncation_at,
9981004
)
9991005

10001006
db_ptr = c_void_p()
@@ -1014,6 +1020,8 @@ def open(
10141020
log_level: LogLevel = LogLevel.LOG_INFO,
10151021
block_cache_size: int = 64 * 1024 * 1024,
10161022
max_open_sstables: int = 256,
1023+
log_to_file: bool = False,
1024+
log_truncation_at: int = 24 * 1024 * 1024,
10171025
) -> TidesDB:
10181026
"""
10191027
Convenience method to open a database with individual parameters.
@@ -1025,6 +1033,8 @@ def open(
10251033
log_level: Logging level
10261034
block_cache_size: Size of block cache in bytes
10271035
max_open_sstables: Maximum number of open SSTables
1036+
log_to_file: Write logs to file instead of stderr
1037+
log_truncation_at: Log file truncation size in bytes (0 = no truncation)
10281038
10291039
Returns:
10301040
TidesDB instance
@@ -1036,6 +1046,8 @@ def open(
10361046
log_level=log_level,
10371047
block_cache_size=block_cache_size,
10381048
max_open_sstables=max_open_sstables,
1049+
log_to_file=log_to_file,
1050+
log_truncation_at=log_truncation_at,
10391051
)
10401052
return cls(config)
10411053

0 commit comments

Comments
 (0)