|
23 | 23 | import sys |
24 | 24 | import ctypes |
25 | 25 | import warnings |
26 | | -from typing import Optional, Dict, List, Union |
| 26 | +from typing import Optional, Dict, List, Union, Tuple |
27 | 27 | from contextlib import contextmanager |
28 | 28 | from .errors import ( |
29 | 29 | DatabaseError, |
@@ -325,39 +325,42 @@ def _setup_bindings(cls): |
325 | 325 | lib.toondb_get_table_index_policy.restype = ctypes.c_uint8 |
326 | 326 |
|
327 | 327 | # Temporal Graph API |
328 | | - # Define C_TemporalEdge structure first |
329 | | - class C_TemporalEdge(ctypes.Structure): |
330 | | - _fields_ = [ |
331 | | - ("from_id", ctypes.c_char_p), |
332 | | - ("edge_type", ctypes.c_char_p), |
333 | | - ("to_id", ctypes.c_char_p), |
334 | | - ("valid_from", ctypes.c_uint64), |
335 | | - ("valid_until", ctypes.c_uint64), |
336 | | - ("properties_json", ctypes.c_char_p), |
337 | | - ] |
338 | | - |
339 | | - # toondb_add_temporal_edge(ptr, namespace, edge) -> c_int |
340 | | - lib.toondb_add_temporal_edge.argtypes = [ |
341 | | - ctypes.c_void_p, # ptr |
342 | | - ctypes.c_char_p, # namespace |
343 | | - C_TemporalEdge # edge struct by value |
344 | | - ] |
345 | | - lib.toondb_add_temporal_edge.restype = ctypes.c_int |
346 | | - |
347 | | - # toondb_query_temporal_graph(ptr, namespace, node_id, mode, timestamp, edge_type) -> *c_char |
348 | | - lib.toondb_query_temporal_graph.argtypes = [ |
349 | | - ctypes.c_void_p, # ptr |
350 | | - ctypes.c_char_p, # namespace |
351 | | - ctypes.c_char_p, # node_id |
352 | | - ctypes.c_int, # mode (0=CURRENT, 1=POINT_IN_TIME, 2=RANGE) |
353 | | - ctypes.c_uint64, # timestamp |
354 | | - ctypes.c_char_p # edge_type (optional, can be NULL) |
355 | | - ] |
356 | | - lib.toondb_query_temporal_graph.restype = ctypes.c_char_p |
357 | | - |
358 | | - # toondb_free_string(ptr) - Free strings returned by query_temporal_graph |
359 | | - lib.toondb_free_string.argtypes = [ctypes.c_char_p] |
360 | | - lib.toondb_free_string.restype = None |
| 328 | + # NOTE: These FFI bindings are not yet available in the native library |
| 329 | + # They are defined here for future compatibility but will cause dlsym errors if used |
| 330 | + # Commenting out until the native library exports these symbols |
| 331 | + |
| 332 | + # class C_TemporalEdge(ctypes.Structure): |
| 333 | + # _fields_ = [ |
| 334 | + # ("from_id", ctypes.c_char_p), |
| 335 | + # ("edge_type", ctypes.c_char_p), |
| 336 | + # ("to_id", ctypes.c_char_p), |
| 337 | + # ("valid_from", ctypes.c_uint64), |
| 338 | + # ("valid_until", ctypes.c_uint64), |
| 339 | + # ("properties_json", ctypes.c_char_p), |
| 340 | + # ] |
| 341 | + |
| 342 | + # # toondb_add_temporal_edge(ptr, namespace, edge) -> c_int |
| 343 | + # lib.toondb_add_temporal_edge.argtypes = [ |
| 344 | + # ctypes.c_void_p, # ptr |
| 345 | + # ctypes.c_char_p, # namespace |
| 346 | + # C_TemporalEdge # edge struct by value |
| 347 | + # ] |
| 348 | + # lib.toondb_add_temporal_edge.restype = ctypes.c_int |
| 349 | + |
| 350 | + # # toondb_query_temporal_graph(ptr, namespace, node_id, mode, timestamp, edge_type) -> *c_char |
| 351 | + # lib.toondb_query_temporal_graph.argtypes = [ |
| 352 | + # ctypes.c_void_p, # ptr |
| 353 | + # ctypes.c_char_p, # namespace |
| 354 | + # ctypes.c_char_p, # node_id |
| 355 | + # ctypes.c_int, # mode (0=CURRENT, 1=POINT_IN_TIME, 2=RANGE) |
| 356 | + # ctypes.c_uint64, # timestamp |
| 357 | + # ctypes.c_char_p # edge_type (optional, can be NULL) |
| 358 | + # ] |
| 359 | + # lib.toondb_query_temporal_graph.restype = ctypes.c_char_p |
| 360 | + |
| 361 | + # # toondb_free_string(ptr) - Free strings returned by query_temporal_graph |
| 362 | + # lib.toondb_free_string.argtypes = [ctypes.c_char_p] |
| 363 | + # lib.toondb_free_string.restype = None |
361 | 364 |
|
362 | 365 |
|
363 | 366 | class Transaction: |
|
0 commit comments