diff options
| -rw-r--r-- | py_bindings/example.py | 7 | ||||
| -rw-r--r-- | py_bindings/log_db.pyi | 16 | ||||
| -rw-r--r-- | py_bindings/src/lib.rs | 14 |
3 files changed, 19 insertions, 18 deletions
diff --git a/py_bindings/example.py b/py_bindings/example.py index d002a8a..233d111 100644 --- a/py_bindings/example.py +++ b/py_bindings/example.py @@ -1,6 +1,6 @@ import tempfile from pprint import pformat, pprint -from log_db import Value, Type, Bound, DB +from log_db import Value, Bound, DB # TODO: This should be imported from the log_db module # but exporting type aliases does not work automatically @@ -33,10 +33,7 @@ temp_dir = tempfile.TemporaryDirectory() db = DB \ .configure() \ .data_dir(temp_dir.name) \ - .schema([ - ("id", Type.int()), - ("name", Type.string()), - ]) \ + .fields(["id", "name"]) \ .primary_key("id") \ .secondary_keys(["name"]) \ .initialize() diff --git a/py_bindings/log_db.pyi b/py_bindings/log_db.pyi index 49c10f2..53aa118 100644 --- a/py_bindings/log_db.pyi +++ b/py_bindings/log_db.pyi @@ -16,7 +16,7 @@ class Config: def segment_size(self, segment_size: int) -> "Config": ... def write_durability(self, write_durability: int) -> "Config": ... def read_consistency(self, read_consistency: int) -> "Config": ... - def schema(self, schema: list[tuple[str, "Type"]]) -> "Config": ... + def fields(self, fields: list[str]) -> "Config": ... def primary_key(self, primary_key: str) -> "Config": ... def secondary_keys(self, secondary_keys: list[str]) -> "Config": ... def initialize(self) -> "DB": ... @@ -34,6 +34,8 @@ class DB: def tx_begin(self) -> None: ... def tx_commit(self) -> None: ... def tx_rollback(self) -> None: ... + def do_maintenance_tasks(self) -> None: ... + def refresh_indexes(self) -> None: ... class Value: @staticmethod @@ -55,18 +57,6 @@ class Value: def as_bytes(self) -> bytes: ... def as_null(self) -> None: ... -class Type: - @staticmethod - def int() -> "Type": ... - @staticmethod - def decimal() -> "Type": ... - @staticmethod - def string() -> "Type": ... - @staticmethod - def bytes() -> "Type": ... - - def nullable(self) -> "Type": ... - class Bound: @staticmethod def unbounded() -> "Bound": ... diff --git a/py_bindings/src/lib.rs b/py_bindings/src/lib.rs index 53544e2..9a14d19 100644 --- a/py_bindings/src/lib.rs +++ b/py_bindings/src/lib.rs @@ -374,6 +374,20 @@ impl DB { .map_err(|e| PyException::new_err(e.to_string()))?; Ok(()) } + + pub fn do_maintenance_tasks(&mut self) -> PyResult<()> { + self.db + .do_maintenance_tasks() + .map_err(|e| PyException::new_err(e.to_string()))?; + Ok(()) + } + + pub fn refresh_indexes(&mut self) -> PyResult<()> { + self.db + .refresh_indexes() + .map_err(|e| PyException::new_err(e.to_string()))?; + Ok(()) + } } #[pyclass(name = "Bound", eq)] |
