kitedb 0.2.6__cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- kitedb/__init__.py +273 -0
- kitedb/_kitedb.cpython-312-aarch64-linux-gnu.so +0 -0
- kitedb/_kitedb.pyi +677 -0
- kitedb/builders.py +901 -0
- kitedb/fluent.py +850 -0
- kitedb/schema.py +327 -0
- kitedb/traversal.py +1523 -0
- kitedb/vector_index.py +472 -0
- kitedb-0.2.6.dist-info/METADATA +216 -0
- kitedb-0.2.6.dist-info/RECORD +12 -0
- kitedb-0.2.6.dist-info/WHEEL +5 -0
- kitedb-0.2.6.dist-info/licenses/LICENSE +21 -0
kitedb/_kitedb.pyi
ADDED
|
@@ -0,0 +1,677 @@
|
|
|
1
|
+
"""Type stubs for kitedb._kitedb native module."""
|
|
2
|
+
|
|
3
|
+
from typing import Optional, List, Any, Tuple
|
|
4
|
+
|
|
5
|
+
# ============================================================================
|
|
6
|
+
# Core Database Types
|
|
7
|
+
# ============================================================================
|
|
8
|
+
|
|
9
|
+
class OpenOptions:
|
|
10
|
+
"""Options for opening a database."""
|
|
11
|
+
read_only: Optional[bool]
|
|
12
|
+
create_if_missing: Optional[bool]
|
|
13
|
+
lock_file: Optional[bool]
|
|
14
|
+
require_locking: Optional[bool]
|
|
15
|
+
mvcc: Optional[bool]
|
|
16
|
+
mvcc_gc_interval_ms: Optional[int]
|
|
17
|
+
mvcc_retention_ms: Optional[int]
|
|
18
|
+
mvcc_max_chain_depth: Optional[int]
|
|
19
|
+
page_size: Optional[int]
|
|
20
|
+
wal_size: Optional[int]
|
|
21
|
+
auto_checkpoint: Optional[bool]
|
|
22
|
+
checkpoint_threshold: Optional[float]
|
|
23
|
+
background_checkpoint: Optional[bool]
|
|
24
|
+
cache_snapshot: Optional[bool]
|
|
25
|
+
cache_enabled: Optional[bool]
|
|
26
|
+
cache_max_node_props: Optional[int]
|
|
27
|
+
cache_max_edge_props: Optional[int]
|
|
28
|
+
cache_max_traversal_entries: Optional[int]
|
|
29
|
+
cache_max_query_entries: Optional[int]
|
|
30
|
+
cache_query_ttl_ms: Optional[int]
|
|
31
|
+
sync_mode: Optional["SyncMode"]
|
|
32
|
+
|
|
33
|
+
def __init__(
|
|
34
|
+
self,
|
|
35
|
+
read_only: Optional[bool] = None,
|
|
36
|
+
create_if_missing: Optional[bool] = None,
|
|
37
|
+
lock_file: Optional[bool] = None,
|
|
38
|
+
require_locking: Optional[bool] = None,
|
|
39
|
+
mvcc: Optional[bool] = None,
|
|
40
|
+
mvcc_gc_interval_ms: Optional[int] = None,
|
|
41
|
+
mvcc_retention_ms: Optional[int] = None,
|
|
42
|
+
mvcc_max_chain_depth: Optional[int] = None,
|
|
43
|
+
page_size: Optional[int] = None,
|
|
44
|
+
wal_size: Optional[int] = None,
|
|
45
|
+
auto_checkpoint: Optional[bool] = None,
|
|
46
|
+
checkpoint_threshold: Optional[float] = None,
|
|
47
|
+
background_checkpoint: Optional[bool] = None,
|
|
48
|
+
cache_snapshot: Optional[bool] = None,
|
|
49
|
+
cache_enabled: Optional[bool] = None,
|
|
50
|
+
cache_max_node_props: Optional[int] = None,
|
|
51
|
+
cache_max_edge_props: Optional[int] = None,
|
|
52
|
+
cache_max_traversal_entries: Optional[int] = None,
|
|
53
|
+
cache_max_query_entries: Optional[int] = None,
|
|
54
|
+
cache_query_ttl_ms: Optional[int] = None,
|
|
55
|
+
sync_mode: Optional["SyncMode"] = None,
|
|
56
|
+
) -> None: ...
|
|
57
|
+
|
|
58
|
+
class SyncMode:
|
|
59
|
+
"""Synchronization mode for WAL writes."""
|
|
60
|
+
@staticmethod
|
|
61
|
+
def full() -> SyncMode: ...
|
|
62
|
+
@staticmethod
|
|
63
|
+
def normal() -> SyncMode: ...
|
|
64
|
+
@staticmethod
|
|
65
|
+
def off() -> SyncMode: ...
|
|
66
|
+
|
|
67
|
+
class DbStats:
|
|
68
|
+
"""Database statistics."""
|
|
69
|
+
snapshot_gen: int
|
|
70
|
+
snapshot_nodes: int
|
|
71
|
+
snapshot_edges: int
|
|
72
|
+
snapshot_max_node_id: int
|
|
73
|
+
delta_nodes_created: int
|
|
74
|
+
delta_nodes_deleted: int
|
|
75
|
+
delta_edges_added: int
|
|
76
|
+
delta_edges_deleted: int
|
|
77
|
+
wal_segment: int
|
|
78
|
+
wal_bytes: int
|
|
79
|
+
recommend_compact: bool
|
|
80
|
+
mvcc_stats: Optional[MvccStats]
|
|
81
|
+
|
|
82
|
+
class MvccStats:
|
|
83
|
+
"""MVCC stats."""
|
|
84
|
+
active_transactions: int
|
|
85
|
+
min_active_ts: int
|
|
86
|
+
versions_pruned: int
|
|
87
|
+
gc_runs: int
|
|
88
|
+
last_gc_time: int
|
|
89
|
+
committed_writes_size: int
|
|
90
|
+
committed_writes_pruned: int
|
|
91
|
+
|
|
92
|
+
class CheckResult:
|
|
93
|
+
"""Database integrity check result."""
|
|
94
|
+
valid: bool
|
|
95
|
+
errors: List[str]
|
|
96
|
+
warnings: List[str]
|
|
97
|
+
|
|
98
|
+
class CacheStats:
|
|
99
|
+
"""Cache statistics."""
|
|
100
|
+
property_cache_hits: int
|
|
101
|
+
property_cache_misses: int
|
|
102
|
+
property_cache_size: int
|
|
103
|
+
traversal_cache_hits: int
|
|
104
|
+
traversal_cache_misses: int
|
|
105
|
+
traversal_cache_size: int
|
|
106
|
+
query_cache_hits: int
|
|
107
|
+
query_cache_misses: int
|
|
108
|
+
query_cache_size: int
|
|
109
|
+
|
|
110
|
+
class ExportOptions:
|
|
111
|
+
"""Options for export."""
|
|
112
|
+
include_nodes: Optional[bool]
|
|
113
|
+
include_edges: Optional[bool]
|
|
114
|
+
include_schema: Optional[bool]
|
|
115
|
+
pretty: Optional[bool]
|
|
116
|
+
def __init__(
|
|
117
|
+
self,
|
|
118
|
+
include_nodes: Optional[bool] = None,
|
|
119
|
+
include_edges: Optional[bool] = None,
|
|
120
|
+
include_schema: Optional[bool] = None,
|
|
121
|
+
pretty: Optional[bool] = None,
|
|
122
|
+
) -> None: ...
|
|
123
|
+
|
|
124
|
+
class ImportOptions:
|
|
125
|
+
"""Options for import."""
|
|
126
|
+
skip_existing: Optional[bool]
|
|
127
|
+
batch_size: Optional[int]
|
|
128
|
+
def __init__(
|
|
129
|
+
self,
|
|
130
|
+
skip_existing: Optional[bool] = None,
|
|
131
|
+
batch_size: Optional[int] = None,
|
|
132
|
+
) -> None: ...
|
|
133
|
+
|
|
134
|
+
class ExportResult:
|
|
135
|
+
"""Export result."""
|
|
136
|
+
node_count: int
|
|
137
|
+
edge_count: int
|
|
138
|
+
|
|
139
|
+
class ImportResult:
|
|
140
|
+
"""Import result."""
|
|
141
|
+
node_count: int
|
|
142
|
+
edge_count: int
|
|
143
|
+
skipped: int
|
|
144
|
+
|
|
145
|
+
class StreamOptions:
|
|
146
|
+
"""Options for streaming node/edge batches."""
|
|
147
|
+
batch_size: Optional[int]
|
|
148
|
+
def __init__(self, batch_size: Optional[int] = None) -> None: ...
|
|
149
|
+
|
|
150
|
+
class PaginationOptions:
|
|
151
|
+
"""Options for cursor-based pagination."""
|
|
152
|
+
limit: Optional[int]
|
|
153
|
+
cursor: Optional[str]
|
|
154
|
+
def __init__(self, limit: Optional[int] = None, cursor: Optional[str] = None) -> None: ...
|
|
155
|
+
|
|
156
|
+
class NodeWithProps:
|
|
157
|
+
"""Node entry with properties."""
|
|
158
|
+
id: int
|
|
159
|
+
key: Optional[str]
|
|
160
|
+
props: List[NodeProp]
|
|
161
|
+
|
|
162
|
+
class EdgeWithProps:
|
|
163
|
+
"""Edge entry with properties."""
|
|
164
|
+
src: int
|
|
165
|
+
etype: int
|
|
166
|
+
dst: int
|
|
167
|
+
props: List[NodeProp]
|
|
168
|
+
|
|
169
|
+
class NodePage:
|
|
170
|
+
"""Page of node IDs."""
|
|
171
|
+
items: List[int]
|
|
172
|
+
next_cursor: Optional[str]
|
|
173
|
+
has_more: bool
|
|
174
|
+
total: Optional[int]
|
|
175
|
+
|
|
176
|
+
class EdgePage:
|
|
177
|
+
"""Page of edges."""
|
|
178
|
+
items: List[FullEdge]
|
|
179
|
+
next_cursor: Optional[str]
|
|
180
|
+
has_more: bool
|
|
181
|
+
total: Optional[int]
|
|
182
|
+
|
|
183
|
+
class CacheLayerMetrics:
|
|
184
|
+
"""Cache layer metrics."""
|
|
185
|
+
hits: int
|
|
186
|
+
misses: int
|
|
187
|
+
hit_rate: float
|
|
188
|
+
size: int
|
|
189
|
+
max_size: int
|
|
190
|
+
utilization_percent: float
|
|
191
|
+
|
|
192
|
+
class CacheMetrics:
|
|
193
|
+
"""Cache metrics."""
|
|
194
|
+
enabled: bool
|
|
195
|
+
property_cache: CacheLayerMetrics
|
|
196
|
+
traversal_cache: CacheLayerMetrics
|
|
197
|
+
query_cache: CacheLayerMetrics
|
|
198
|
+
|
|
199
|
+
class DataMetrics:
|
|
200
|
+
"""Data metrics."""
|
|
201
|
+
node_count: int
|
|
202
|
+
edge_count: int
|
|
203
|
+
delta_nodes_created: int
|
|
204
|
+
delta_nodes_deleted: int
|
|
205
|
+
delta_edges_added: int
|
|
206
|
+
delta_edges_deleted: int
|
|
207
|
+
snapshot_generation: int
|
|
208
|
+
max_node_id: int
|
|
209
|
+
schema_labels: int
|
|
210
|
+
schema_etypes: int
|
|
211
|
+
schema_prop_keys: int
|
|
212
|
+
|
|
213
|
+
class MvccMetrics:
|
|
214
|
+
"""MVCC metrics."""
|
|
215
|
+
enabled: bool
|
|
216
|
+
active_transactions: int
|
|
217
|
+
versions_pruned: int
|
|
218
|
+
gc_runs: int
|
|
219
|
+
min_active_timestamp: int
|
|
220
|
+
committed_writes_size: int
|
|
221
|
+
committed_writes_pruned: int
|
|
222
|
+
|
|
223
|
+
class MemoryMetrics:
|
|
224
|
+
"""Memory metrics."""
|
|
225
|
+
delta_estimate_bytes: int
|
|
226
|
+
cache_estimate_bytes: int
|
|
227
|
+
snapshot_bytes: int
|
|
228
|
+
total_estimate_bytes: int
|
|
229
|
+
|
|
230
|
+
class DatabaseMetrics:
|
|
231
|
+
"""Database metrics."""
|
|
232
|
+
path: str
|
|
233
|
+
is_single_file: bool
|
|
234
|
+
read_only: bool
|
|
235
|
+
data: DataMetrics
|
|
236
|
+
cache: CacheMetrics
|
|
237
|
+
mvcc: Optional[MvccMetrics]
|
|
238
|
+
memory: MemoryMetrics
|
|
239
|
+
collected_at: int
|
|
240
|
+
|
|
241
|
+
class HealthCheckEntry:
|
|
242
|
+
"""Health check entry."""
|
|
243
|
+
name: str
|
|
244
|
+
passed: bool
|
|
245
|
+
message: str
|
|
246
|
+
|
|
247
|
+
class HealthCheckResult:
|
|
248
|
+
"""Health check result."""
|
|
249
|
+
healthy: bool
|
|
250
|
+
checks: List[HealthCheckEntry]
|
|
251
|
+
|
|
252
|
+
class BackupOptions:
|
|
253
|
+
"""Options for creating a backup."""
|
|
254
|
+
checkpoint: Optional[bool]
|
|
255
|
+
overwrite: Optional[bool]
|
|
256
|
+
def __init__(self, checkpoint: Optional[bool] = None, overwrite: Optional[bool] = None) -> None: ...
|
|
257
|
+
|
|
258
|
+
class RestoreOptions:
|
|
259
|
+
"""Options for restoring a backup."""
|
|
260
|
+
overwrite: Optional[bool]
|
|
261
|
+
def __init__(self, overwrite: Optional[bool] = None) -> None: ...
|
|
262
|
+
|
|
263
|
+
class OfflineBackupOptions:
|
|
264
|
+
"""Options for offline backup."""
|
|
265
|
+
overwrite: Optional[bool]
|
|
266
|
+
def __init__(self, overwrite: Optional[bool] = None) -> None: ...
|
|
267
|
+
|
|
268
|
+
class BackupResult:
|
|
269
|
+
"""Backup result."""
|
|
270
|
+
path: str
|
|
271
|
+
size: int
|
|
272
|
+
timestamp: int
|
|
273
|
+
type: str
|
|
274
|
+
|
|
275
|
+
class PropValue:
|
|
276
|
+
"""Property value wrapper."""
|
|
277
|
+
prop_type: str
|
|
278
|
+
bool_value: Optional[bool]
|
|
279
|
+
int_value: Optional[int]
|
|
280
|
+
float_value: Optional[float]
|
|
281
|
+
string_value: Optional[str]
|
|
282
|
+
vector_value: Optional[List[float]]
|
|
283
|
+
|
|
284
|
+
@staticmethod
|
|
285
|
+
def null() -> PropValue: ...
|
|
286
|
+
@staticmethod
|
|
287
|
+
def bool(value: bool) -> PropValue: ...
|
|
288
|
+
@staticmethod
|
|
289
|
+
def int(value: int) -> PropValue: ...
|
|
290
|
+
@staticmethod
|
|
291
|
+
def float(value: float) -> PropValue: ...
|
|
292
|
+
@staticmethod
|
|
293
|
+
def string(value: str) -> PropValue: ...
|
|
294
|
+
@staticmethod
|
|
295
|
+
def vector(value: List[float]) -> PropValue: ...
|
|
296
|
+
def value(self) -> Any: ...
|
|
297
|
+
|
|
298
|
+
class Edge:
|
|
299
|
+
"""Edge representation (neighbor style)."""
|
|
300
|
+
etype: int
|
|
301
|
+
node_id: int
|
|
302
|
+
|
|
303
|
+
class FullEdge:
|
|
304
|
+
"""Full edge representation."""
|
|
305
|
+
src: int
|
|
306
|
+
etype: int
|
|
307
|
+
dst: int
|
|
308
|
+
|
|
309
|
+
class NodeProp:
|
|
310
|
+
"""Node property key-value pair."""
|
|
311
|
+
key_id: int
|
|
312
|
+
value: PropValue
|
|
313
|
+
|
|
314
|
+
# ============================================================================
|
|
315
|
+
# Traversal Result Types
|
|
316
|
+
# ============================================================================
|
|
317
|
+
|
|
318
|
+
class TraversalResult:
|
|
319
|
+
"""A single result from a traversal."""
|
|
320
|
+
node_id: int
|
|
321
|
+
depth: int
|
|
322
|
+
edge_src: Optional[int]
|
|
323
|
+
edge_dst: Optional[int]
|
|
324
|
+
edge_type: Optional[int]
|
|
325
|
+
|
|
326
|
+
class PathResult:
|
|
327
|
+
"""Result of a pathfinding query."""
|
|
328
|
+
path: List[int]
|
|
329
|
+
edges: List[PathEdge]
|
|
330
|
+
total_weight: float
|
|
331
|
+
found: bool
|
|
332
|
+
|
|
333
|
+
def __len__(self) -> int: ...
|
|
334
|
+
def __bool__(self) -> bool: ...
|
|
335
|
+
|
|
336
|
+
class PathEdge:
|
|
337
|
+
"""An edge in a path result."""
|
|
338
|
+
src: int
|
|
339
|
+
etype: int
|
|
340
|
+
dst: int
|
|
341
|
+
|
|
342
|
+
# ============================================================================
|
|
343
|
+
# Database Class
|
|
344
|
+
# ============================================================================
|
|
345
|
+
|
|
346
|
+
class Database:
|
|
347
|
+
"""Single-file graph database."""
|
|
348
|
+
|
|
349
|
+
is_open: bool
|
|
350
|
+
path: str
|
|
351
|
+
read_only: bool
|
|
352
|
+
|
|
353
|
+
def __init__(self, path: str, options: Optional[OpenOptions] = None) -> None: ...
|
|
354
|
+
def close(self) -> None: ...
|
|
355
|
+
def __enter__(self) -> Database: ...
|
|
356
|
+
def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> bool: ...
|
|
357
|
+
|
|
358
|
+
# Transaction methods
|
|
359
|
+
def begin(self, read_only: Optional[bool] = None) -> int: ...
|
|
360
|
+
def commit(self) -> None: ...
|
|
361
|
+
def rollback(self) -> None: ...
|
|
362
|
+
def has_transaction(self) -> bool: ...
|
|
363
|
+
|
|
364
|
+
# Node operations
|
|
365
|
+
def create_node(self, key: Optional[str] = None) -> int: ...
|
|
366
|
+
def delete_node(self, node_id: int) -> None: ...
|
|
367
|
+
def node_exists(self, node_id: int) -> bool: ...
|
|
368
|
+
def get_node_by_key(self, key: str) -> Optional[int]: ...
|
|
369
|
+
def get_node_key(self, node_id: int) -> Optional[str]: ...
|
|
370
|
+
def list_nodes(self) -> List[int]: ...
|
|
371
|
+
def count_nodes(self) -> int: ...
|
|
372
|
+
def list_nodes_with_prefix(self, prefix: str) -> List[int]: ...
|
|
373
|
+
def count_nodes_with_prefix(self, prefix: str) -> int: ...
|
|
374
|
+
def batch_create_nodes(self, nodes: List[Tuple[str, List[Tuple[int, PropValue]]]]) -> List[int]: ...
|
|
375
|
+
|
|
376
|
+
# Edge operations
|
|
377
|
+
def add_edge(self, src: int, etype: int, dst: int) -> None: ...
|
|
378
|
+
def add_edge_by_name(self, src: int, etype_name: str, dst: int) -> None: ...
|
|
379
|
+
def delete_edge(self, src: int, etype: int, dst: int) -> None: ...
|
|
380
|
+
def edge_exists(self, src: int, etype: int, dst: int) -> bool: ...
|
|
381
|
+
def get_out_edges(self, node_id: int) -> List[Edge]: ...
|
|
382
|
+
def get_in_edges(self, node_id: int) -> List[Edge]: ...
|
|
383
|
+
def get_out_degree(self, node_id: int) -> int: ...
|
|
384
|
+
def get_in_degree(self, node_id: int) -> int: ...
|
|
385
|
+
def count_edges(self) -> int: ...
|
|
386
|
+
def list_edges(self, etype: Optional[int] = None) -> List[FullEdge]: ...
|
|
387
|
+
def list_edges_by_name(self, etype_name: str) -> List[FullEdge]: ...
|
|
388
|
+
def count_edges_by_type(self, etype: int) -> int: ...
|
|
389
|
+
def count_edges_by_name(self, etype_name: str) -> int: ...
|
|
390
|
+
|
|
391
|
+
# Property operations
|
|
392
|
+
def set_node_prop(self, node_id: int, key_id: int, value: PropValue) -> None: ...
|
|
393
|
+
def set_node_prop_by_name(self, node_id: int, key_name: str, value: PropValue) -> None: ...
|
|
394
|
+
def delete_node_prop(self, node_id: int, key_id: int) -> None: ...
|
|
395
|
+
def get_node_prop(self, node_id: int, key_id: int) -> Optional[PropValue]: ...
|
|
396
|
+
def get_node_prop_string(self, node_id: int, key_id: int) -> Optional[str]: ...
|
|
397
|
+
def get_node_prop_int(self, node_id: int, key_id: int) -> Optional[int]: ...
|
|
398
|
+
def get_node_prop_float(self, node_id: int, key_id: int) -> Optional[float]: ...
|
|
399
|
+
def get_node_prop_bool(self, node_id: int, key_id: int) -> Optional[bool]: ...
|
|
400
|
+
def set_node_prop_string(self, node_id: int, key_id: int, value: str) -> None: ...
|
|
401
|
+
def set_node_prop_int(self, node_id: int, key_id: int, value: int) -> None: ...
|
|
402
|
+
def set_node_prop_float(self, node_id: int, key_id: int, value: float) -> None: ...
|
|
403
|
+
def set_node_prop_bool(self, node_id: int, key_id: int, value: bool) -> None: ...
|
|
404
|
+
def get_node_props(self, node_id: int) -> Optional[List[NodeProp]]: ...
|
|
405
|
+
|
|
406
|
+
# Edge property operations
|
|
407
|
+
def set_edge_prop(self, src: int, etype: int, dst: int, key_id: int, value: PropValue) -> None: ...
|
|
408
|
+
def set_edge_prop_by_name(self, src: int, etype: int, dst: int, key_name: str, value: PropValue) -> None: ...
|
|
409
|
+
def delete_edge_prop(self, src: int, etype: int, dst: int, key_id: int) -> None: ...
|
|
410
|
+
def get_edge_prop(self, src: int, etype: int, dst: int, key_id: int) -> Optional[PropValue]: ...
|
|
411
|
+
def get_edge_props(self, src: int, etype: int, dst: int) -> Optional[List[NodeProp]]: ...
|
|
412
|
+
|
|
413
|
+
# Vector operations
|
|
414
|
+
def set_node_vector(self, node_id: int, prop_key_id: int, vector: List[float]) -> None: ...
|
|
415
|
+
def get_node_vector(self, node_id: int, prop_key_id: int) -> Optional[List[float]]: ...
|
|
416
|
+
def delete_node_vector(self, node_id: int, prop_key_id: int) -> None: ...
|
|
417
|
+
def has_node_vector(self, node_id: int, prop_key_id: int) -> bool: ...
|
|
418
|
+
|
|
419
|
+
# Schema operations
|
|
420
|
+
def get_or_create_label(self, name: str) -> int: ...
|
|
421
|
+
def get_label_id(self, name: str) -> Optional[int]: ...
|
|
422
|
+
def get_label_name(self, id: int) -> Optional[str]: ...
|
|
423
|
+
def get_or_create_etype(self, name: str) -> int: ...
|
|
424
|
+
def get_etype_id(self, name: str) -> Optional[int]: ...
|
|
425
|
+
def get_etype_name(self, id: int) -> Optional[str]: ...
|
|
426
|
+
def get_or_create_propkey(self, name: str) -> int: ...
|
|
427
|
+
def get_propkey_id(self, name: str) -> Optional[int]: ...
|
|
428
|
+
def get_propkey_name(self, id: int) -> Optional[str]: ...
|
|
429
|
+
|
|
430
|
+
# Label operations
|
|
431
|
+
def define_label(self, name: str) -> int: ...
|
|
432
|
+
def add_node_label(self, node_id: int, label_id: int) -> None: ...
|
|
433
|
+
def add_node_label_by_name(self, node_id: int, label_name: str) -> None: ...
|
|
434
|
+
def remove_node_label(self, node_id: int, label_id: int) -> None: ...
|
|
435
|
+
def node_has_label(self, node_id: int, label_id: int) -> bool: ...
|
|
436
|
+
def get_node_labels(self, node_id: int) -> List[int]: ...
|
|
437
|
+
|
|
438
|
+
# Maintenance
|
|
439
|
+
def checkpoint(self) -> None: ...
|
|
440
|
+
def background_checkpoint(self) -> None: ...
|
|
441
|
+
def should_checkpoint(self, threshold: Optional[float] = None) -> bool: ...
|
|
442
|
+
def optimize(self) -> None: ...
|
|
443
|
+
def stats(self) -> DbStats: ...
|
|
444
|
+
def check(self) -> CheckResult: ...
|
|
445
|
+
|
|
446
|
+
# Export / Import
|
|
447
|
+
def export_to_object(self, options: Optional[ExportOptions] = None) -> Any: ...
|
|
448
|
+
def export_to_json(self, path: str, options: Optional[ExportOptions] = None) -> ExportResult: ...
|
|
449
|
+
def export_to_jsonl(self, path: str, options: Optional[ExportOptions] = None) -> ExportResult: ...
|
|
450
|
+
def import_from_object(self, data: Any, options: Optional[ImportOptions] = None) -> ImportResult: ...
|
|
451
|
+
def import_from_json(self, path: str, options: Optional[ImportOptions] = None) -> ImportResult: ...
|
|
452
|
+
|
|
453
|
+
# Streaming / Pagination
|
|
454
|
+
def stream_nodes(self, options: Optional[StreamOptions] = None) -> List[List[int]]: ...
|
|
455
|
+
def stream_nodes_with_props(self, options: Optional[StreamOptions] = None) -> List[List[NodeWithProps]]: ...
|
|
456
|
+
def stream_edges(self, options: Optional[StreamOptions] = None) -> List[List[FullEdge]]: ...
|
|
457
|
+
def stream_edges_with_props(self, options: Optional[StreamOptions] = None) -> List[List[EdgeWithProps]]: ...
|
|
458
|
+
def get_nodes_page(self, options: Optional[PaginationOptions] = None) -> NodePage: ...
|
|
459
|
+
def get_edges_page(self, options: Optional[PaginationOptions] = None) -> EdgePage: ...
|
|
460
|
+
|
|
461
|
+
# Cache operations
|
|
462
|
+
def cache_is_enabled(self) -> bool: ...
|
|
463
|
+
def cache_invalidate_node(self, node_id: int) -> None: ...
|
|
464
|
+
def cache_invalidate_edge(self, src: int, etype: int, dst: int) -> None: ...
|
|
465
|
+
def cache_invalidate_key(self, key: str) -> None: ...
|
|
466
|
+
def cache_clear(self) -> None: ...
|
|
467
|
+
def cache_clear_query(self) -> None: ...
|
|
468
|
+
def cache_clear_key(self) -> None: ...
|
|
469
|
+
def cache_clear_property(self) -> None: ...
|
|
470
|
+
def cache_clear_traversal(self) -> None: ...
|
|
471
|
+
def cache_stats(self) -> Optional[CacheStats]: ...
|
|
472
|
+
def cache_reset_stats(self) -> None: ...
|
|
473
|
+
|
|
474
|
+
# Graph Traversal
|
|
475
|
+
def traverse_out(self, node_id: int, etype: Optional[int] = None) -> List[int]: ...
|
|
476
|
+
def traverse_out_with_keys(self, node_id: int, etype: Optional[int] = None) -> List[Tuple[int, Optional[str]]]: ...
|
|
477
|
+
def traverse_out_count(self, node_id: int, etype: Optional[int] = None) -> int: ...
|
|
478
|
+
def traverse_in(self, node_id: int, etype: Optional[int] = None) -> List[int]: ...
|
|
479
|
+
def traverse_in_with_keys(self, node_id: int, etype: Optional[int] = None) -> List[Tuple[int, Optional[str]]]: ...
|
|
480
|
+
def traverse_in_count(self, node_id: int, etype: Optional[int] = None) -> int: ...
|
|
481
|
+
def traverse(
|
|
482
|
+
self,
|
|
483
|
+
node_id: int,
|
|
484
|
+
max_depth: int,
|
|
485
|
+
etype: Optional[int] = None,
|
|
486
|
+
min_depth: Optional[int] = None,
|
|
487
|
+
direction: Optional[str] = None,
|
|
488
|
+
unique: Optional[bool] = None,
|
|
489
|
+
) -> List[TraversalResult]: ...
|
|
490
|
+
def traverse_multi(self, start_ids: List[int], steps: List[Tuple[str, Optional[int]]]) -> List[Tuple[int, Optional[str]]]: ...
|
|
491
|
+
def traverse_multi_count(self, start_ids: List[int], steps: List[Tuple[str, Optional[int]]]) -> int: ...
|
|
492
|
+
|
|
493
|
+
# Pathfinding
|
|
494
|
+
def find_path_bfs(
|
|
495
|
+
self,
|
|
496
|
+
source: int,
|
|
497
|
+
target: int,
|
|
498
|
+
etype: Optional[int] = None,
|
|
499
|
+
max_depth: Optional[int] = None,
|
|
500
|
+
direction: Optional[str] = None,
|
|
501
|
+
) -> PathResult: ...
|
|
502
|
+
def find_path_dijkstra(
|
|
503
|
+
self,
|
|
504
|
+
source: int,
|
|
505
|
+
target: int,
|
|
506
|
+
etype: Optional[int] = None,
|
|
507
|
+
max_depth: Optional[int] = None,
|
|
508
|
+
direction: Optional[str] = None,
|
|
509
|
+
) -> PathResult: ...
|
|
510
|
+
def has_path(
|
|
511
|
+
self,
|
|
512
|
+
source: int,
|
|
513
|
+
target: int,
|
|
514
|
+
etype: Optional[int] = None,
|
|
515
|
+
max_depth: Optional[int] = None,
|
|
516
|
+
) -> bool: ...
|
|
517
|
+
def reachable_nodes(
|
|
518
|
+
self,
|
|
519
|
+
source: int,
|
|
520
|
+
max_depth: int,
|
|
521
|
+
etype: Optional[int] = None,
|
|
522
|
+
) -> List[int]: ...
|
|
523
|
+
|
|
524
|
+
def open_database(path: str, options: Optional[OpenOptions] = None) -> Database: ...
|
|
525
|
+
def collect_metrics(db: Database) -> DatabaseMetrics: ...
|
|
526
|
+
def health_check(db: Database) -> HealthCheckResult: ...
|
|
527
|
+
def create_backup(db: Database, backup_path: str, options: Optional[BackupOptions] = None) -> BackupResult: ...
|
|
528
|
+
def restore_backup(backup_path: str, restore_path: str, options: Optional[RestoreOptions] = None) -> str: ...
|
|
529
|
+
def get_backup_info(backup_path: str) -> BackupResult: ...
|
|
530
|
+
def create_offline_backup(
|
|
531
|
+
db_path: str,
|
|
532
|
+
backup_path: str,
|
|
533
|
+
options: Optional[OfflineBackupOptions] = None,
|
|
534
|
+
) -> BackupResult: ...
|
|
535
|
+
def version() -> str: ...
|
|
536
|
+
|
|
537
|
+
# ============================================================================
|
|
538
|
+
# Vector Search Types
|
|
539
|
+
# ============================================================================
|
|
540
|
+
|
|
541
|
+
class IvfConfig:
|
|
542
|
+
"""Configuration for IVF index."""
|
|
543
|
+
n_clusters: Optional[int]
|
|
544
|
+
n_probe: Optional[int]
|
|
545
|
+
metric: Optional[str]
|
|
546
|
+
|
|
547
|
+
def __init__(
|
|
548
|
+
self,
|
|
549
|
+
n_clusters: Optional[int] = None,
|
|
550
|
+
n_probe: Optional[int] = None,
|
|
551
|
+
metric: Optional[str] = None,
|
|
552
|
+
) -> None: ...
|
|
553
|
+
|
|
554
|
+
class PqConfig:
|
|
555
|
+
"""Configuration for Product Quantization."""
|
|
556
|
+
num_subspaces: Optional[int]
|
|
557
|
+
num_centroids: Optional[int]
|
|
558
|
+
max_iterations: Optional[int]
|
|
559
|
+
|
|
560
|
+
def __init__(
|
|
561
|
+
self,
|
|
562
|
+
num_subspaces: Optional[int] = None,
|
|
563
|
+
num_centroids: Optional[int] = None,
|
|
564
|
+
max_iterations: Optional[int] = None,
|
|
565
|
+
) -> None: ...
|
|
566
|
+
|
|
567
|
+
class SearchOptions:
|
|
568
|
+
"""Options for vector search."""
|
|
569
|
+
n_probe: Optional[int]
|
|
570
|
+
threshold: Optional[float]
|
|
571
|
+
|
|
572
|
+
def __init__(
|
|
573
|
+
self,
|
|
574
|
+
n_probe: Optional[int] = None,
|
|
575
|
+
threshold: Optional[float] = None,
|
|
576
|
+
) -> None: ...
|
|
577
|
+
|
|
578
|
+
class SearchResult:
|
|
579
|
+
"""Result of a vector search."""
|
|
580
|
+
vector_id: int
|
|
581
|
+
node_id: int
|
|
582
|
+
distance: float
|
|
583
|
+
similarity: float
|
|
584
|
+
|
|
585
|
+
class IvfStats:
|
|
586
|
+
"""Statistics for IVF index."""
|
|
587
|
+
trained: bool
|
|
588
|
+
n_clusters: int
|
|
589
|
+
total_vectors: int
|
|
590
|
+
avg_vectors_per_cluster: float
|
|
591
|
+
empty_cluster_count: int
|
|
592
|
+
min_cluster_size: int
|
|
593
|
+
max_cluster_size: int
|
|
594
|
+
|
|
595
|
+
class IvfIndex:
|
|
596
|
+
"""IVF (Inverted File) index for approximate nearest neighbor search."""
|
|
597
|
+
|
|
598
|
+
dimensions: int
|
|
599
|
+
trained: bool
|
|
600
|
+
|
|
601
|
+
def __init__(self, dimensions: int, config: Optional[IvfConfig] = None) -> None: ...
|
|
602
|
+
def add_training_vectors(self, vectors: List[float], num_vectors: int) -> None: ...
|
|
603
|
+
def train(self) -> None: ...
|
|
604
|
+
def insert(self, vector_id: int, vector: List[float]) -> None: ...
|
|
605
|
+
def delete(self, vector_id: int, vector: List[float]) -> bool: ...
|
|
606
|
+
def clear(self) -> None: ...
|
|
607
|
+
def search(
|
|
608
|
+
self,
|
|
609
|
+
manifest_json: str,
|
|
610
|
+
query: List[float],
|
|
611
|
+
k: int,
|
|
612
|
+
options: Optional[SearchOptions] = None,
|
|
613
|
+
) -> List[SearchResult]: ...
|
|
614
|
+
def search_multi(
|
|
615
|
+
self,
|
|
616
|
+
manifest_json: str,
|
|
617
|
+
queries: List[List[float]],
|
|
618
|
+
k: int,
|
|
619
|
+
aggregation: str,
|
|
620
|
+
options: Optional[SearchOptions] = None,
|
|
621
|
+
) -> List[SearchResult]: ...
|
|
622
|
+
def stats(self) -> IvfStats: ...
|
|
623
|
+
def serialize(self) -> bytes: ...
|
|
624
|
+
@staticmethod
|
|
625
|
+
def deserialize(data: bytes) -> IvfIndex: ...
|
|
626
|
+
|
|
627
|
+
class IvfPqIndex:
|
|
628
|
+
"""IVF-PQ combined index for memory-efficient approximate nearest neighbor search."""
|
|
629
|
+
|
|
630
|
+
dimensions: int
|
|
631
|
+
trained: bool
|
|
632
|
+
|
|
633
|
+
def __init__(
|
|
634
|
+
self,
|
|
635
|
+
dimensions: int,
|
|
636
|
+
ivf_config: Optional[IvfConfig] = None,
|
|
637
|
+
pq_config: Optional[PqConfig] = None,
|
|
638
|
+
use_residuals: Optional[bool] = None,
|
|
639
|
+
) -> None: ...
|
|
640
|
+
def add_training_vectors(self, vectors: List[float], num_vectors: int) -> None: ...
|
|
641
|
+
def train(self) -> None: ...
|
|
642
|
+
def insert(self, vector_id: int, vector: List[float]) -> None: ...
|
|
643
|
+
def delete(self, vector_id: int, vector: List[float]) -> bool: ...
|
|
644
|
+
def clear(self) -> None: ...
|
|
645
|
+
def search(
|
|
646
|
+
self,
|
|
647
|
+
manifest_json: str,
|
|
648
|
+
query: List[float],
|
|
649
|
+
k: int,
|
|
650
|
+
options: Optional[SearchOptions] = None,
|
|
651
|
+
) -> List[SearchResult]: ...
|
|
652
|
+
def search_multi(
|
|
653
|
+
self,
|
|
654
|
+
manifest_json: str,
|
|
655
|
+
queries: List[List[float]],
|
|
656
|
+
k: int,
|
|
657
|
+
aggregation: str,
|
|
658
|
+
options: Optional[SearchOptions] = None,
|
|
659
|
+
) -> List[SearchResult]: ...
|
|
660
|
+
def stats(self) -> IvfStats: ...
|
|
661
|
+
def serialize(self) -> bytes: ...
|
|
662
|
+
@staticmethod
|
|
663
|
+
def deserialize(data: bytes) -> IvfPqIndex: ...
|
|
664
|
+
|
|
665
|
+
class BruteForceResult:
|
|
666
|
+
"""Brute force search result."""
|
|
667
|
+
node_id: int
|
|
668
|
+
distance: float
|
|
669
|
+
similarity: float
|
|
670
|
+
|
|
671
|
+
def brute_force_search(
|
|
672
|
+
vectors: List[List[float]],
|
|
673
|
+
node_ids: List[int],
|
|
674
|
+
query: List[float],
|
|
675
|
+
k: int,
|
|
676
|
+
metric: Optional[str] = None,
|
|
677
|
+
) -> List[BruteForceResult]: ...
|