aboutsummaryrefslogtreecommitdiffstats
path: root/py_bindings/log_db.pyi
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2025-02-05 17:50:02 +0200
committerJan Tuomi <jan@jantuomi.fi>2025-02-09 23:52:26 +0200
commitd422ffe3d48d2061b4d3ddeb0c08796e4d71a5fa (patch)
tree0b6820b060bf0cbeb2686a53a23c9ebee5654334 /py_bindings/log_db.pyi
parentd4c953dc4bbd190dae4b5be69941f5c42c59af34 (diff)
Remove Recordable trait, implement Python bindings, fixes
Diffstat (limited to 'py_bindings/log_db.pyi')
-rw-r--r--py_bindings/log_db.pyi76
1 files changed, 76 insertions, 0 deletions
diff --git a/py_bindings/log_db.pyi b/py_bindings/log_db.pyi
new file mode 100644
index 0000000..49c10f2
--- /dev/null
+++ b/py_bindings/log_db.pyi
@@ -0,0 +1,76 @@
+WRITE_DURABILITY_FLUSH: int
+WRITE_DURABILITY_FLUSH_SYNC: int
+READ_CONSISTENCY_EVENTUAL: int
+READ_CONSISTENCY_STRONG: int
+
+VALUE_INT: int
+VALUE_DECIMAL: int
+VALUE_STRING: int
+VALUE_BYTES: int
+VALUE_NULL: int
+
+Record = list["Value"]
+
+class Config:
+ def data_dir(self, data_dir: str) -> "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 primary_key(self, primary_key: str) -> "Config": ...
+ def secondary_keys(self, secondary_keys: list[str]) -> "Config": ...
+ def initialize(self) -> "DB": ...
+
+class DB:
+ @staticmethod
+ def configure() -> Config: ...
+ def upsert(self, record: Record) -> None: ...
+ def get(self, key: str) -> Record: ...
+ def find_by(self, key: str, value: "Value") -> list[Record]: ...
+ def batch_find_by(self, key: str, values: list["Value"]) -> list[tuple[int, Record]]: ...
+ def delete(self, key: str) -> list[Record]: ...
+ def delete_by(self, key: str, value: "Value") -> list[Record]: ...
+ def range_by(self, key: str, start: "Bound", end: "Bound") -> list[Record]: ...
+ def tx_begin(self) -> None: ...
+ def tx_commit(self) -> None: ...
+ def tx_rollback(self) -> None: ...
+
+class Value:
+ @staticmethod
+ def int(v: int) -> "Value": ...
+ @staticmethod
+ def decimal(v: str) -> "Value": ...
+ @staticmethod
+ def string(v: str) -> "Value": ...
+ @staticmethod
+ def bytes(v: bytes) -> "Value": ...
+ @staticmethod
+ def null() -> "Value": ...
+
+ def kind(self) -> int: ...
+
+ def as_int(self) -> int: ...
+ def as_decimal(self) -> str: ...
+ def as_string(self) -> str: ...
+ 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": ...
+ @staticmethod
+ def included(v: "Value") -> "Bound": ...
+ @staticmethod
+ def excluded(v: "Value") -> "Bound": ...