objectbox-api 5.0.0__py3-none-any.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.
objectbox/c.py ADDED
@@ -0,0 +1,1572 @@
1
+ # Copyright 2019-2024 ObjectBox Ltd. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ from __future__ import annotations
16
+
17
+ import ctypes.util
18
+ import importlib
19
+ import os
20
+ import platform
21
+ import sys
22
+ import sysconfig
23
+ from ctypes import c_char_p
24
+ from objectbox.version import Version
25
+ from typing import *
26
+ from enum import IntEnum
27
+
28
+ if TYPE_CHECKING:
29
+ import numpy as np # imported lazily (only where needed): importing numpy may start (busy) BLAS threads
30
+
31
+ # This file contains C-API bindings based on lib/objectbox.h, linking to the 'objectbox' shared library.
32
+ # The bindings are implementing using ctypes, see https://docs.python.org/dev/library/ctypes.html for introduction.
33
+
34
+
35
+ # Version of the library used by the binding. This version is checked at runtime to ensure binary compatibility.
36
+ # Don't forget to update download-c-lib.py when upgrading to a newer version.
37
+ required_version = "5.3.2"
38
+
39
+
40
+ def shlib_name(library: str) -> str:
41
+ """Returns the platform-specific name of the shared library"""
42
+ if platform.system() == 'Linux':
43
+ return 'lib' + library + '.so'
44
+ elif platform.system() == 'Windows':
45
+ return library + '.dll'
46
+ elif platform.system() == 'Darwin':
47
+ return 'lib' + library + '.dylib'
48
+ else:
49
+ assert False, 'Unsupported platform: ' + platform.system()
50
+
51
+
52
+ def lib_dir_name() -> str:
53
+ """Returns the name of the library directory (inside objectbox_clib/lib) for the current platform."""
54
+ if platform.system() == 'Darwin':
55
+ return 'macos-universal'
56
+ if platform.system() == 'Windows':
57
+ # Use the architecture the Python interpreter was built for (derived from sys.version), e.g. "win-arm64";
58
+ # the library must match the Python process, which may differ from the OS (e.g. x64 Python on Windows ARM64).
59
+ windows_dirs = {'win-amd64': 'AMD64', 'win-arm64': 'ARM64'}
60
+ return windows_dirs.get(sysconfig.get_platform(), platform.machine())
61
+ machine = platform.machine()
62
+ # platform.machine() reports the kernel's architecture, but the library must match the (Python) process.
63
+ # These differ for a 32-bit Python on a 64-bit kernel, e.g. Raspberry Pi OS 32-bit on a Raspberry Pi 4/5
64
+ # (64-bit kernel by default since Bookworm). pip also handles this case and installs the armv7l wheel.
65
+ if machine == 'aarch64' and sys.maxsize <= 2 ** 32:
66
+ return 'armv7l'
67
+ return machine
68
+
69
+
70
+ def lib_package():
71
+ """Returns the package providing the C library: objectbox_sync_clib (Sync variant of the library, installed via
72
+ the metapackage objectbox-sync) if available, otherwise objectbox_clib (installed via the metapackage objectbox).
73
+ Raises ImportError if neither is available (e.g. only objectbox-api is installed)."""
74
+ # Note: the source tree has both packages, but maybe without libraries (see make depend and make depend-sync)
75
+ for package_name in ('objectbox_sync_clib', 'objectbox_clib'):
76
+ try:
77
+ package = importlib.import_module(package_name)
78
+ except ImportError:
79
+ continue
80
+ if os.path.exists(lib_path_in(package)):
81
+ return package
82
+ raise ImportError(
83
+ 'The ObjectBox C library for this platform (%s) was not found: neither package objectbox-clib nor '
84
+ 'objectbox-sync-clib provides it. Install ObjectBox via "pip install objectbox" (or "pip install objectbox-sync" '
85
+ 'for ObjectBox Sync) instead of the package objectbox-api alone (from source: make depend).' % lib_dir_name())
86
+
87
+
88
+ def lib_path_in(package) -> str:
89
+ package_dir = os.path.dirname(os.path.realpath(package.__file__))
90
+ return os.path.join(package_dir, 'lib', lib_dir_name(), shlib_name('objectbox'))
91
+
92
+
93
+ # initialize the C library
94
+ clib_package = lib_package()
95
+ lib_path = lib_path_in(clib_package)
96
+ C = ctypes.CDLL(lib_path)
97
+
98
+ # load the core library version
99
+ __major = ctypes.c_int(0)
100
+ __minor = ctypes.c_int(0)
101
+ __patch = ctypes.c_int(0)
102
+ C.obx_version(ctypes.byref(__major), ctypes.byref(
103
+ __minor), ctypes.byref(__patch))
104
+
105
+ # C-api (core library) version
106
+ version_core = Version(__major.value, __minor.value, __patch.value)
107
+
108
+ assert str(version_core) == required_version, \
109
+ "Incorrect ObjectBox version loaded: %s instead of expected %s (from %s)%s" % (
110
+ str(version_core), required_version, lib_path,
111
+ # E.g. objectbox-sync installed and objectbox upgraded (or both installed): the previous objectbox-sync-clib,
112
+ # which is preferred, stays installed
113
+ "; please update the Sync library via: pip install --upgrade objectbox-sync"
114
+ if clib_package.__name__ == "objectbox_sync_clib" else "")
115
+
116
+ # define some basic types
117
+ obx_err = ctypes.c_int
118
+ obx_schema_id = ctypes.c_uint32
119
+ obx_uid = ctypes.c_uint64
120
+ obx_id = ctypes.c_uint64
121
+ obx_qb_cond = ctypes.c_int
122
+
123
+ obx_qb_cond_p = ctypes.POINTER(obx_qb_cond)
124
+
125
+ # enums
126
+ OBXPropertyType = ctypes.c_int
127
+ OBXPropertyFlags = ctypes.c_int
128
+ OBXDebugFlags = ctypes.c_int
129
+ OBXPutMode = ctypes.c_int
130
+ OBXPutPaddingMode = ctypes.c_int
131
+ OBXOrderFlags = ctypes.c_int
132
+ OBXHnswFlags = ctypes.c_int
133
+ OBXVectorDistanceType = ctypes.c_int
134
+ OBXValidateOnOpenPagesFlags = ctypes.c_int
135
+ OBXValidateOnOpenKvFlags = ctypes.c_int
136
+ OBXBackupRestoreFlags = ctypes.c_int
137
+ OBXLogLevel = ctypes.c_int
138
+
139
+ from enum import IntEnum
140
+
141
+
142
+ class LogLevel(IntEnum):
143
+ # Values match OBXLogLevel (changed with C library 5.3.0, was: 10 to 50 for Verbose to Error)
144
+ Trace = 1
145
+ Verbose = 2
146
+ Debug = 3
147
+ Info = 4
148
+ Warn = 6
149
+ Error = 8
150
+
151
+
152
+ class DebugFlags(IntEnum):
153
+ """Debug flags (store option ``debug_flags``); combine multiple using ``|``.
154
+ Values are the ones of the C API (``OBXDebugFlags``)."""
155
+
156
+ NONE = 0
157
+
158
+ LOG_TRANSACTIONS_READ = 1
159
+ """ Log read transactions """
160
+
161
+ LOG_TRANSACTIONS_WRITE = 2
162
+ """ Log write transactions """
163
+
164
+ LOG_QUERIES = 4
165
+ """ Log queries """
166
+
167
+ LOG_QUERY_PARAMETERS = 8
168
+ """ Log query parameters """
169
+
170
+ LOG_ASYNC_QUEUE = 16
171
+ """ Log async queue """
172
+
173
+ LOG_CACHE_HITS = 32
174
+ """ Log cache hits """
175
+
176
+ LOG_CACHE_ALL = 64
177
+ """ Log cache hits and misses """
178
+
179
+ LOG_TREE = 128
180
+ """ Log tree operations """
181
+
182
+ LOG_EXCEPTION_STACK_TRACE = 256
183
+ """ Try to log stack traces for some error conditions (experimental, Linux only) """
184
+
185
+ RUN_THREADING_SELF_TEST = 512
186
+ """ Run a quick self-test to verify basic threading (checks the platform and the library setup) """
187
+
188
+
189
+ class OBX_model(ctypes.Structure):
190
+ pass
191
+
192
+
193
+ OBX_model_p = ctypes.POINTER(OBX_model)
194
+
195
+
196
+ class OBX_store(ctypes.Structure):
197
+ pass
198
+
199
+
200
+ OBX_store_p = ctypes.POINTER(OBX_store)
201
+
202
+
203
+ class OBX_store_options(ctypes.Structure):
204
+ pass
205
+
206
+
207
+ OBX_store_options_p = ctypes.POINTER(OBX_store_options)
208
+
209
+
210
+ class OBX_bytes(ctypes.Structure):
211
+ _fields_ = [
212
+ ('data', ctypes.c_void_p),
213
+ ('size', ctypes.c_size_t),
214
+ ]
215
+
216
+
217
+ OBX_bytes_p = ctypes.POINTER(OBX_bytes)
218
+
219
+
220
+ class OBX_bytes_array(ctypes.Structure):
221
+ _fields_ = [
222
+ ('data', OBX_bytes_p),
223
+ ('count', ctypes.c_size_t),
224
+ ]
225
+
226
+
227
+ OBX_bytes_array_p = ctypes.POINTER(OBX_bytes_array)
228
+
229
+
230
+ class OBX_bytes_score(ctypes.Structure):
231
+ _fields_ = [
232
+ ('data', ctypes.c_void_p),
233
+ ('size', ctypes.c_size_t),
234
+ ('score', ctypes.c_double),
235
+ ]
236
+
237
+
238
+ OBX_bytes_score_p = ctypes.POINTER(OBX_bytes_score)
239
+
240
+
241
+ class OBX_bytes_score_array(ctypes.Structure):
242
+ _fields_ = [
243
+ ('bytes_scores', OBX_bytes_score_p),
244
+ ('count', ctypes.c_size_t),
245
+ ]
246
+
247
+
248
+ OBX_bytes_score_array_p = ctypes.POINTER(OBX_bytes_score_array)
249
+
250
+
251
+ class OBX_id_array(ctypes.Structure):
252
+ _fields_ = [
253
+ ('ids', ctypes.POINTER(obx_id)),
254
+ ('count', ctypes.c_size_t),
255
+ ]
256
+
257
+
258
+ OBX_id_array_p = ctypes.POINTER(OBX_id_array)
259
+
260
+
261
+ class OBX_id_score(ctypes.Structure):
262
+ _fields_ = [
263
+ ('id', obx_id),
264
+ ('score', ctypes.c_double)
265
+ ]
266
+
267
+
268
+ OBX_id_score_p = ctypes.POINTER(OBX_id_score)
269
+
270
+
271
+ class OBX_id_score_array(ctypes.Structure):
272
+ _fields_ = [
273
+ ('ids_scores', OBX_id_score_p),
274
+ ('count', ctypes.c_size_t)
275
+ ]
276
+
277
+
278
+ OBX_id_score_array_p = ctypes.POINTER(OBX_id_score_array)
279
+
280
+
281
+ class OBX_txn(ctypes.Structure):
282
+ pass
283
+
284
+
285
+ OBX_txn_p = ctypes.POINTER(OBX_txn)
286
+
287
+
288
+ class OBX_box(ctypes.Structure):
289
+ pass
290
+
291
+
292
+ OBX_box_p = ctypes.POINTER(OBX_box)
293
+
294
+
295
+ class OBX_async(ctypes.Structure):
296
+ pass
297
+
298
+
299
+ OBX_async_p = ctypes.POINTER(OBX_async)
300
+
301
+
302
+ class OBX_query_builder(ctypes.Structure):
303
+ pass
304
+
305
+
306
+ OBX_query_builder_p = ctypes.POINTER(OBX_query_builder)
307
+
308
+
309
+ class OBX_query(ctypes.Structure):
310
+ pass
311
+
312
+
313
+ OBX_query_p = ctypes.POINTER(OBX_query)
314
+
315
+ # manually configure error methods, we can't use `fn()` defined below yet due to circular dependencies
316
+ C.obx_last_error_message.restype = ctypes.c_char_p
317
+ C.obx_last_error_code.restype = obx_err
318
+
319
+
320
+ class DbErrorCode(IntEnum):
321
+ OBX_SUCCESS = 0
322
+ OBX_NOT_FOUND = 404
323
+ OBX_NO_SUCCESS = 1001
324
+ OBX_TIMEOUT = 1002
325
+ OBX_ERROR_ILLEGAL_STATE = 10001
326
+ OBX_ERROR_ILLEGAL_ARGUMENT = 10002
327
+ OBX_ERROR_ALLOCATION = 10003
328
+ OBX_ERROR_NUMERIC_OVERFLOW = 10004
329
+ OBX_ERROR_FEATURE_NOT_AVAILABLE = 10005
330
+ OBX_ERROR_SHUTTING_DOWN = 10006
331
+ OBX_ERROR_IO = 10007
332
+ OBX_ERROR_BACKUP_FILE_INVALID = 10008
333
+ OBX_ERROR_NO_ERROR_INFO = 10097
334
+ OBX_ERROR_GENERAL = 10098
335
+ OBX_ERROR_UNKNOWN = 10099
336
+ OBX_ERROR_DB_FULL = 10101
337
+ OBX_ERROR_MAX_READERS_EXCEEDED = 10102
338
+ OBX_ERROR_STORE_MUST_SHUTDOWN = 10103
339
+ OBX_ERROR_MAX_DATA_SIZE_EXCEEDED = 10104
340
+ OBX_ERROR_DB_GENERAL = 10198
341
+ OBX_ERROR_STORAGE_GENERAL = 10199
342
+ OBX_ERROR_UNIQUE_VIOLATED = 10201
343
+ OBX_ERROR_NON_UNIQUE_RESULT = 10202
344
+ OBX_ERROR_PROPERTY_TYPE_MISMATCH = 10203
345
+ OBX_ERROR_ID_ALREADY_EXISTS = 10210
346
+ OBX_ERROR_ID_NOT_FOUND = 10211
347
+ OBX_ERROR_TIME_SERIES = 10212
348
+ OBX_ERROR_CONSTRAINT_VIOLATED = 10299
349
+ OBX_ERROR_STD_ILLEGAL_ARGUMENT = 10301
350
+ OBX_ERROR_STD_OUT_OF_RANGE = 10302
351
+ OBX_ERROR_STD_LENGTH = 10303
352
+ OBX_ERROR_STD_BAD_ALLOC = 10304
353
+ OBX_ERROR_STD_RANGE = 10305
354
+ OBX_ERROR_STD_OVERFLOW = 10306
355
+ OBX_ERROR_STD_OTHER = 10399
356
+ OBX_ERROR_SCHEMA = 10501
357
+ OBX_ERROR_FILE_CORRUPT = 10502
358
+ OBX_ERROR_FILE_PAGES_CORRUPT = 10503
359
+ OBX_ERROR_SCHEMA_OBJECT_NOT_FOUND = 10504
360
+ OBX_ERROR_TREE_MODEL_INVALID = 10601
361
+ OBX_ERROR_TREE_VALUE_TYPE_MISMATCH = 10602
362
+ OBX_ERROR_TREE_PATH_NON_UNIQUE = 10603
363
+ OBX_ERROR_TREE_PATH_ILLEGAL = 10604
364
+ OBX_ERROR_TREE_OTHER = 10699
365
+
366
+
367
+ class OBXEntityFlags(IntEnum):
368
+ SYNC_ENABLED = 2
369
+ SHARED_GLOBAL_IDS = 4
370
+
371
+
372
+ def check_obx_err(code: obx_err, func, args) -> obx_err:
373
+ """ Raises an exception if obx_err is not successful. """
374
+ if code != DbErrorCode.OBX_SUCCESS:
375
+ from objectbox.exceptions import create_db_error
376
+ raise create_db_error(code)
377
+ return code
378
+
379
+ def check_obx_success(code: obx_err, func, args) -> bool:
380
+ """ Returns True for OBX_SUCCESS, False for OBX_NO_SUCCESS (and OBX_TIMEOUT); raises an exception otherwise. """
381
+ if code == DbErrorCode.OBX_SUCCESS:
382
+ return True
383
+ if code == DbErrorCode.OBX_NO_SUCCESS or code == DbErrorCode.OBX_TIMEOUT:
384
+ return False
385
+ return check_obx_err(code, func, args)
386
+
387
+ def check_obx_qb_cond(qb_cond: obx_qb_cond, func, args) -> obx_qb_cond:
388
+ """ Raises an exception if obx_qb_cond is not successful. """
389
+ if qb_cond == 0:
390
+ from objectbox.exceptions import create_db_error
391
+ raise create_db_error(C.obx_last_error_code())
392
+ return qb_cond
393
+
394
+
395
+ # assert that the returned pointer/int is non-empty
396
+ def check_result(result, func, args):
397
+ if not result:
398
+ from objectbox.exceptions import create_db_error
399
+ raise create_db_error(C.obx_last_error_code())
400
+ return result
401
+
402
+
403
+ # creates a global function "name" with the given restype & argtypes, calling C function with the same name.
404
+ # restype is used for error checking: if not None, check_result will throw an exception if the result is empty.
405
+ def c_fn(name: str, restype: Optional[type], argtypes):
406
+ func = C.__getattr__(name)
407
+ func.argtypes = argtypes
408
+ func.restype = restype
409
+
410
+ if restype is not None:
411
+ func.errcheck = check_result
412
+
413
+ return func
414
+
415
+
416
+ # creates a global function "name" with the given restype & argtypes, calling C function with the same name.
417
+ # no error checking is done on restype as this is defered to higher-level functions.
418
+ def c_fn_nocheck(name: str, restype: type, argtypes):
419
+ func = C.__getattr__(name)
420
+ func.argtypes = argtypes
421
+ func.restype = restype
422
+ return func
423
+
424
+
425
+ # like c_fn, but for functions returning obx_err
426
+ def c_fn_rc(name: str, argtypes):
427
+ """ Like c_fn, but for functions returning obx_err (checks obx_err validity). """
428
+ func = C.__getattr__(name)
429
+ func.argtypes = argtypes
430
+ func.restype = obx_err
431
+ func.errcheck = check_obx_err
432
+ return func
433
+
434
+
435
+ def c_fn_rc_success(name: str, argtypes):
436
+ """ Like c_fn_rc, but for functions that may "fail" without an error (OBX_NO_SUCCESS, OBX_TIMEOUT): returns a bool
437
+ telling if the function was successful; still raises an exception for errors (other result codes). """
438
+ func = C.__getattr__(name)
439
+ func.argtypes = argtypes
440
+ func.restype = obx_err
441
+ func.errcheck = check_obx_success
442
+ return func
443
+
444
+
445
+ def c_fn_qb_cond(name: str, argtypes):
446
+ """ Like c_fn, but for functions returning obx_qb_cond (checks obx_qb_cond validity). """
447
+ func = C.__getattr__(name)
448
+ func.argtypes = argtypes
449
+ func.restype = obx_qb_cond
450
+ func.errcheck = check_obx_qb_cond
451
+ return func
452
+
453
+
454
+ def py_str(ptr: ctypes.c_char_p) -> str:
455
+ return ctypes.c_char_p(ptr).value.decode("utf-8")
456
+
457
+
458
+ def c_str(string: str) -> ctypes.c_char_p:
459
+ return string.encode('utf-8')
460
+
461
+
462
+ def c_voidp_as_bytes(voidp, size) -> bytes:
463
+ """Copies size bytes at the given pointer (c_void_p or int) into a bytes object."""
464
+ return ctypes.string_at(voidp, size) # one copy; ~3x faster than via ctypes.cast and a memoryview
465
+
466
+
467
+ def is_ndarray(value) -> bool:
468
+ """Whether the value is a numpy array; does not import numpy (if it was not imported, there are no arrays)."""
469
+ np = sys.modules.get("numpy")
470
+ return np is not None and isinstance(value, np.ndarray)
471
+
472
+
473
+ def c_array(py_list: Union[List[Any], np.ndarray], c_type):
474
+ """ Converts the given python list or ndarray into a C array of c_type. """
475
+ if is_ndarray(py_list):
476
+ if py_list.ndim != 1:
477
+ raise ValueError(f"ndarray is expected to be 1-dimensional. Input shape: {py_list.shape}")
478
+ return py_list.ctypes.data_as(ctypes.POINTER(c_type))
479
+ elif isinstance(py_list, list):
480
+ return (c_type * len(py_list))(*py_list)
481
+ else:
482
+ raise TypeError(f"Unsupported Python list type: {type(py_list)}")
483
+
484
+
485
+ def c_array_pointer(py_list: Union[List[Any], np.ndarray], c_type):
486
+ """ Converts the given python list or ndarray into a C array of c_type. Returns its pointer type. """
487
+ return ctypes.cast(c_array(py_list, c_type), ctypes.POINTER(c_type))
488
+
489
+
490
+ # OBX_C_API float obx_vector_distance_float32(OBXVectorDistanceType type, const float* vector1, const float* vector2, size_t dimension);
491
+ obx_vector_distance_float32 = c_fn("obx_vector_distance_float32", ctypes.c_float,
492
+ [OBXVectorDistanceType, ctypes.POINTER(ctypes.c_float),
493
+ ctypes.POINTER(ctypes.c_float), ctypes.c_size_t])
494
+
495
+ # OBX_C_API float obx_vector_distance_to_relevance(OBXVectorDistanceType type, float distance);
496
+ obx_vector_distance_to_relevance = c_fn("obx_vector_distance_to_relevance", ctypes.c_float,
497
+ [OBXVectorDistanceType, ctypes.c_float])
498
+
499
+ # OBX_model* (void);
500
+ obx_model = c_fn('obx_model', OBX_model_p, [])
501
+
502
+ # obx_err (OBX_model* model, const char* name, obx_schema_id entity_id, obx_uid entity_uid);
503
+ obx_model_entity = c_fn_rc('obx_model_entity', [
504
+ OBX_model_p, ctypes.c_char_p, obx_schema_id, obx_uid])
505
+
506
+ # obx_err obx_model_entity_flags(OBX_model* model, uint32_t flags);
507
+ obx_model_entity_flags = c_fn_rc('obx_model_entity_flags', [OBX_model_p, ctypes.c_uint32])
508
+
509
+ # obx_err (OBX_model* model, const char* name, OBXPropertyType type, obx_schema_id property_id, obx_uid property_uid);
510
+ obx_model_property = c_fn_rc('obx_model_property',
511
+ [OBX_model_p, ctypes.c_char_p, OBXPropertyType, obx_schema_id, obx_uid])
512
+
513
+ # obx_err (OBX_model* model, OBXPropertyFlags flags);
514
+ obx_model_property_flags = c_fn_rc('obx_model_property_flags', [OBX_model_p, OBXPropertyFlags])
515
+
516
+ # obx_err obx_model_property_index_id(OBX_model* model, obx_schema_id index_id, obx_uid index_uid)
517
+ obx_model_property_index_id = c_fn_rc('obx_model_property_index_id', [OBX_model_p, obx_schema_id, obx_uid])
518
+
519
+ # obx_err obx_model_property_relation(OBX_model* model, const char* target_entity, obx_schema_id index_id,
520
+ # obx_uid index_uid);
521
+ obx_model_property_relation = c_fn_rc('obx_model_property_relation',
522
+ [OBX_model_p, ctypes.c_char_p, obx_schema_id, obx_uid])
523
+
524
+ # obx_err obx_model_property_index_hnsw_dimensions(OBX_model* model, size_t value)
525
+ obx_model_property_index_hnsw_dimensions = \
526
+ c_fn_rc('obx_model_property_index_hnsw_dimensions', [OBX_model_p, ctypes.c_size_t])
527
+
528
+ # obx_err obx_model_property_index_hnsw_neighbors_per_node(OBX_model* model, uint32_t value)
529
+ obx_model_property_index_hnsw_neighbors_per_node = \
530
+ c_fn_rc('obx_model_property_index_hnsw_neighbors_per_node', [OBX_model_p, ctypes.c_uint32])
531
+
532
+ # obx_err obx_model_property_index_hnsw_indexing_search_count(OBX_model* model, uint32_t value)
533
+ obx_model_property_index_hnsw_indexing_search_count = \
534
+ c_fn_rc('obx_model_property_index_hnsw_indexing_search_count', [OBX_model_p, ctypes.c_uint32])
535
+
536
+ # obx_err obx_model_property_index_hnsw_flags(OBX_model* model, OBXHnswFlags value)
537
+ obx_model_property_index_hnsw_flags = \
538
+ c_fn_rc('obx_model_property_index_hnsw_flags', [OBX_model_p, OBXHnswFlags])
539
+
540
+ # obx_err obx_model_property_index_hnsw_distance_type(OBX_model* model, OBXVectorDistanceType value)
541
+ obx_model_property_index_hnsw_distance_type = c_fn_rc('obx_model_property_index_hnsw_distance_type',
542
+ [OBX_model_p, OBXVectorDistanceType])
543
+
544
+ # obx_err obx_model_property_index_hnsw_reparation_backlink_probability(OBX_model* model, float value)
545
+ obx_model_property_index_hnsw_reparation_backlink_probability = \
546
+ c_fn_rc('obx_model_property_index_hnsw_reparation_backlink_probability', [OBX_model_p, ctypes.c_float])
547
+
548
+ # obx_err obx_model_property_index_hnsw_vector_cache_hint_size_kb(OBX_model* model, size_t value)
549
+ obx_model_property_index_hnsw_vector_cache_hint_size_kb = \
550
+ c_fn_rc('obx_model_property_index_hnsw_vector_cache_hint_size_kb', [OBX_model_p, ctypes.c_size_t])
551
+
552
+ # obx_err (OBX_model*, obx_schema_id entity_id, obx_uid entity_uid);
553
+ obx_model_last_entity_id = c_fn('obx_model_last_entity_id', None, [
554
+ OBX_model_p, obx_schema_id, obx_uid])
555
+
556
+ # obx_err (OBX_model* model, obx_schema_id index_id, obx_uid index_uid);
557
+ obx_model_last_index_id = c_fn('obx_model_last_index_id', None, [
558
+ OBX_model_p, obx_schema_id, obx_uid])
559
+
560
+ # obx_err (OBX_model* model, obx_schema_id relation_id, obx_uid relation_uid);
561
+ obx_model_last_relation_id = c_fn('obx_model_last_relation_id', None, [
562
+ OBX_model_p, obx_schema_id, obx_uid])
563
+
564
+ # obx_err (OBX_model* model, obx_schema_id property_id, obx_uid property_uid);
565
+ obx_model_entity_last_property_id = c_fn_rc('obx_model_entity_last_property_id',
566
+ [OBX_model_p, obx_schema_id, obx_uid])
567
+
568
+ # OBX_store_options* ();
569
+ obx_opt = c_fn('obx_opt', OBX_store_options_p, [])
570
+
571
+ # OBX_C_API obx_err obx_opt_directory(OBX_store_options* opt, const char* dir);
572
+ obx_opt_directory = c_fn_rc('obx_opt_directory', [OBX_store_options_p, ctypes.c_char_p])
573
+
574
+ # OBX_C_API void obx_opt_max_db_size_in_kb(OBX_store_options* opt, uint64_t size_in_kb);
575
+ obx_opt_max_db_size_in_kb = c_fn('obx_opt_max_db_size_in_kb', None, [OBX_store_options_p, ctypes.c_uint64])
576
+
577
+ # OBX_C_API void obx_opt_max_data_size_in_kb(OBX_store_options* opt, uint64_t size_in_kb);
578
+ obx_opt_max_data_size_in_kb = c_fn('obx_opt_max_data_size_in_kb', None, [OBX_store_options_p, ctypes.c_uint64])
579
+
580
+ # OBX_C_API void obx_opt_file_mode(OBX_store_options* opt, unsigned int file_mode);
581
+ obx_opt_file_mode = c_fn('obx_opt_file_mode', None, [OBX_store_options_p, ctypes.c_uint32])
582
+
583
+ # OBX_C_API void obx_opt_max_readers(OBX_store_options* opt, unsigned int max_readers);
584
+ obx_opt_max_readers = c_fn('obx_opt_max_readers', None, [OBX_store_options_p, ctypes.c_uint32])
585
+
586
+ # OBX_C_API void obx_opt_no_reader_thread_locals(OBX_store_options* opt, bool flag);
587
+ obx_opt_no_reader_thread_locals = c_fn('obx_opt_no_reader_thread_locals', None, [OBX_store_options_p, ctypes.c_bool])
588
+
589
+ # OBX_C_API obx_err obx_opt_model(OBX_store_options* opt, OBX_model* model);
590
+ obx_opt_model = c_fn_rc('obx_opt_model', [OBX_store_options_p, OBX_model_p])
591
+
592
+ # OBX_C_API obx_err obx_opt_model_bytes(OBX_store_options* opt, const void* bytes, size_t size);
593
+ obx_opt_model_bytes = c_fn_rc('obx_opt_model_bytes', [OBX_store_options_p, ctypes.c_void_p, ctypes.c_size_t])
594
+
595
+ # OBX_C_API obx_err obx_opt_model_bytes_direct(OBX_store_options* opt, const void* bytes, size_t size);
596
+ obx_opt_model_bytes_direct = c_fn_rc('obx_opt_model_bytes_direct',
597
+ [OBX_store_options_p, ctypes.c_void_p, ctypes.c_size_t])
598
+
599
+ # OBX_C_API void obx_opt_validate_on_open_pages(OBX_store_options* opt, size_t page_limit, uint32_t flags);
600
+ obx_opt_validate_on_open_pages = c_fn('obx_opt_validate_on_open_pages', None,
601
+ [OBX_store_options_p, ctypes.c_size_t, OBXValidateOnOpenPagesFlags])
602
+
603
+ # OBX_C_API void obx_opt_validate_on_open_kv(OBX_store_options* opt, uint32_t flags);
604
+ obx_opt_validate_on_open_kv = c_fn('obx_opt_validate_on_open_kv', None, [OBX_store_options_p, OBXValidateOnOpenKvFlags])
605
+
606
+ # OBX_C_API void obx_opt_put_padding_mode(OBX_store_options* opt, OBXPutPaddingMode mode);
607
+ obx_opt_put_padding_mode = c_fn('obx_opt_put_padding_mode', None, [OBX_store_options_p, OBXPutPaddingMode])
608
+
609
+ # OBX_C_API void obx_opt_read_schema(OBX_store_options* opt, bool value);
610
+ obx_opt_read_schema = c_fn('obx_opt_read_schema', None, [OBX_store_options_p, ctypes.c_bool])
611
+
612
+ # OBX_C_API void obx_opt_use_previous_commit(OBX_store_options* opt, bool value);
613
+ obx_opt_use_previous_commit = c_fn('obx_opt_use_previous_commit', None, [OBX_store_options_p, ctypes.c_bool])
614
+
615
+ # OBX_C_API void obx_opt_read_only(OBX_store_options* opt, bool value);
616
+ obx_opt_read_only = c_fn('obx_opt_read_only', None, [OBX_store_options_p, ctypes.c_bool])
617
+
618
+ # OBX_C_API void obx_opt_debug_flags(OBX_store_options* opt, uint32_t flags);
619
+ obx_opt_debug_flags = c_fn('obx_opt_debug_flags', None, [OBX_store_options_p, OBXDebugFlags])
620
+
621
+ # OBX_C_API void obx_opt_add_debug_flags(OBX_store_options* opt, uint32_t flags);
622
+ obx_opt_add_debug_flags = c_fn('obx_opt_add_debug_flags', None, [OBX_store_options_p, ctypes.c_uint32])
623
+
624
+ # OBX_C_API void obx_opt_async_max_queue_length(OBX_store_options* opt, size_t value);
625
+ obx_opt_async_max_queue_length = c_fn('obx_opt_async_max_queue_length', None, [OBX_store_options_p, ctypes.c_size_t])
626
+
627
+ # OBX_C_API void obx_opt_async_throttle_at_queue_length(OBX_store_options* opt, size_t value);
628
+ obx_opt_async_throttle_at_queue_length = c_fn('obx_opt_async_throttle_at_queue_length', None,
629
+ [OBX_store_options_p, ctypes.c_size_t])
630
+
631
+ # OBX_C_API void obx_opt_async_throttle_micros(OBX_store_options* opt, uint32_t value);
632
+ obx_opt_async_throttle_micros = c_fn('obx_opt_async_throttle_micros', None, [OBX_store_options_p, ctypes.c_uint32])
633
+
634
+ # OBX_C_API void obx_opt_async_max_in_tx_duration(OBX_store_options* opt, uint32_t micros);
635
+ obx_opt_async_max_in_tx_duration = c_fn('obx_opt_async_max_in_tx_duration', None,
636
+ [OBX_store_options_p, ctypes.c_uint32])
637
+
638
+ # OBX_C_API void obx_opt_async_max_in_tx_operations(OBX_store_options* opt, uint32_t value);
639
+ obx_opt_async_max_in_tx_operations = c_fn('obx_opt_async_max_in_tx_operations', None,
640
+ [OBX_store_options_p, ctypes.c_uint32])
641
+
642
+ # OBX_C_API void obx_opt_async_pre_txn_delay(OBX_store_options* opt, uint32_t delay_micros);
643
+ obx_opt_async_pre_txn_delay = c_fn('obx_opt_async_pre_txn_delay', None, [OBX_store_options_p, ctypes.c_uint32])
644
+
645
+ # OBX_C_API void obx_opt_async_pre_txn_delay4(OBX_store_options* opt, uint32_t delay_micros, uint32_t delay2_micros, size_t min_queue_length_for_delay2);
646
+ obx_opt_async_pre_txn_delay4 = c_fn('obx_opt_async_pre_txn_delay4', None,
647
+ [OBX_store_options_p, ctypes.c_uint32, ctypes.c_uint32, ctypes.c_size_t])
648
+
649
+ # OBX_C_API void obx_opt_async_post_txn_delay(OBX_store_options* opt, uint32_t delay_micros);
650
+ obx_opt_async_post_txn_delay = c_fn('obx_opt_async_post_txn_delay', None, [OBX_store_options_p, ctypes.c_uint32])
651
+
652
+ # OBX_C_API void obx_opt_async_post_txn_delay5(OBX_store_options* opt, uint32_t delay_micros, uint32_t delay2_micros, size_t min_queue_length_for_delay2, bool subtract_processing_time);
653
+ obx_opt_async_post_txn_delay5 = c_fn('obx_opt_async_post_txn_delay5', None,
654
+ [OBX_store_options_p, ctypes.c_uint32, ctypes.c_uint32, ctypes.c_size_t,
655
+ ctypes.c_bool])
656
+
657
+ # OBX_C_API void obx_opt_async_minor_refill_threshold(OBX_store_options* opt, size_t queue_length);
658
+ obx_opt_async_minor_refill_threshold = c_fn('obx_opt_async_minor_refill_threshold', None,
659
+ [OBX_store_options_p, ctypes.c_size_t])
660
+
661
+ # OBX_C_API void obx_opt_async_minor_refill_max_count(OBX_store_options* opt, uint32_t value);
662
+ obx_opt_async_minor_refill_max_count = c_fn('obx_opt_async_minor_refill_max_count', None,
663
+ [OBX_store_options_p, ctypes.c_uint32])
664
+
665
+ # OBX_C_API void obx_opt_async_max_tx_pool_size(OBX_store_options* opt, size_t value);
666
+ obx_opt_async_max_tx_pool_size = c_fn('obx_opt_async_max_tx_pool_size', None, [OBX_store_options_p, ctypes.c_size_t])
667
+
668
+ # OBX_C_API void obx_opt_async_object_bytes_max_cache_size(OBX_store_options* opt, uint64_t value);
669
+ obx_opt_async_object_bytes_max_cache_size = c_fn('obx_opt_async_object_bytes_max_cache_size', None,
670
+ [OBX_store_options_p, ctypes.c_uint64])
671
+
672
+ # OBX_C_API void obx_opt_async_object_bytes_max_size_to_cache(OBX_store_options* opt, uint64_t value);
673
+ obx_opt_async_object_bytes_max_size_to_cache = c_fn('obx_opt_async_object_bytes_max_size_to_cache', None,
674
+ [OBX_store_options_p, ctypes.c_uint64])
675
+
676
+ # typedef void obx_log_callback(OBXLogLevel log_level, const char* message, size_t message_size, void* user_data);
677
+ obx_log_callback_fn = ctypes.CFUNCTYPE(None, OBXLogLevel, ctypes.c_char_p, ctypes.c_size_t, ctypes.c_voidp)
678
+
679
+ # OBX_C_API void obx_opt_log_callback(OBX_store_options* opt, obx_log_callback* callback, void* user_data);
680
+ obx_opt_log_callback = c_fn('obx_opt_log_callback', None, [OBX_store_options_p, obx_log_callback_fn, ctypes.c_voidp])
681
+
682
+ # OBX_C_API void obx_opt_backup_restore(OBX_store_options* opt, const char* backup_file, uint32_t flags);
683
+ obx_opt_backup_restore = c_fn('obx_opt_backup_restore', None,
684
+ [OBX_store_options_p, ctypes.c_char_p, OBXBackupRestoreFlags])
685
+
686
+ # OBX_C_API const char* obx_opt_get_directory(OBX_store_options* opt);
687
+ obx_opt_get_directory = c_fn('obx_opt_get_directory', ctypes.c_char_p, [OBX_store_options_p])
688
+
689
+ # OBX_C_API uint64_t obx_opt_get_max_db_size_in_kb(OBX_store_options* opt);
690
+ obx_opt_get_max_db_size_in_kb = c_fn('obx_opt_get_max_db_size_in_kb', ctypes.c_uint64, [OBX_store_options_p])
691
+
692
+ # OBX_C_API uint64_t obx_opt_get_max_data_size_in_kb(OBX_store_options* opt);
693
+ obx_opt_get_max_data_size_in_kb = c_fn('obx_opt_get_max_data_size_in_kb', ctypes.c_uint64, [OBX_store_options_p])
694
+
695
+ # OBX_C_API uint32_t obx_opt_get_debug_flags(OBX_store_options* opt);
696
+ obx_opt_get_debug_flags = c_fn('obx_opt_get_debug_flags', ctypes.c_uint32, [OBX_store_options_p])
697
+
698
+ # OBX_C_API void obx_opt_free(OBX_store_options* opt);
699
+ obx_opt_free = c_fn('obx_opt_free', None, [])
700
+
701
+ # OBX_store* (const OBX_store_options* options);
702
+ obx_store_open = c_fn('obx_store_open', OBX_store_p, [OBX_store_options_p])
703
+
704
+ # obx_err (OBX_store* store);
705
+ obx_store_close = c_fn_rc('obx_store_close', [OBX_store_p])
706
+
707
+ # obx_err obx_remove_db_files(const const* directory);
708
+ obx_remove_db_files = c_fn_rc('obx_remove_db_files', [ctypes.c_char_p]) # TODO provide a python wrapper
709
+
710
+ # OBX_txn* (OBX_store* store);
711
+ obx_txn_write = c_fn('obx_txn_write', OBX_txn_p, [OBX_store_p])
712
+
713
+ # OBX_txn* (OBX_store* store);
714
+ obx_txn_read = c_fn('obx_txn_read', OBX_txn_p, [OBX_store_p])
715
+
716
+ # obx_err (OBX_txn* txn)
717
+ obx_txn_close = c_fn_rc('obx_txn_close', [OBX_txn_p])
718
+
719
+ # obx_err (OBX_txn* txn);
720
+ obx_txn_abort = c_fn_rc('obx_txn_abort', [OBX_txn_p])
721
+
722
+ # obx_err (OBX_txn* txn);
723
+ obx_txn_success = c_fn_rc('obx_txn_success', [OBX_txn_p])
724
+
725
+ # OBX_box* (OBX_store* store, obx_schema_id entity_id);
726
+ obx_box = c_fn('obx_box', OBX_box_p, [OBX_store_p, obx_schema_id])
727
+
728
+ # OBX_C_API obx_err obx_box_contains(OBX_box* box, obx_id id, bool* out_contains);
729
+ obx_box_contains = c_fn_rc('obx_box_contains', [OBX_box_p, obx_id, ctypes.POINTER(ctypes.c_bool)])
730
+
731
+ # obx_err (OBX_box* box, obx_id id, const void** data, size_t* size);
732
+ obx_box_get = c_fn_nocheck('obx_box_get', obx_err, [
733
+ OBX_box_p, obx_id, ctypes.POINTER(ctypes.c_void_p), ctypes.POINTER(ctypes.c_size_t)])
734
+
735
+ # OBX_C_API OBX_bytes_array* obx_box_get_many(OBX_box* box, const OBX_id_array* ids);
736
+ obx_box_get_many = c_fn('obx_box_get_many', OBX_bytes_array_p, [OBX_box_p, OBX_id_array_p])
737
+
738
+ # OBX_bytes_array* (OBX_box* box);
739
+ obx_box_get_all = c_fn('obx_box_get_all', OBX_bytes_array_p, [OBX_box_p])
740
+
741
+ # obx_id (OBX_box* box, obx_id id_or_zero);
742
+ obx_box_id_for_put = c_fn('obx_box_id_for_put', obx_id, [OBX_box_p, obx_id])
743
+
744
+ # obx_err (OBX_box* box, uint64_t count, obx_id* out_first_id);
745
+ obx_box_ids_for_put = c_fn_rc('obx_box_ids_for_put', [
746
+ OBX_box_p, ctypes.c_uint64, ctypes.POINTER(obx_id)])
747
+
748
+ # obx_err (OBX_box* box, obx_id id, const void* data, size_t size);
749
+ obx_box_put = c_fn_rc('obx_box_put', [OBX_box_p, obx_id, ctypes.c_void_p, ctypes.c_size_t])
750
+
751
+ # OBX_C_API obx_id obx_box_put_object(OBX_box* box, void* data, size_t size);
752
+ # data must be writable: for a new object (ID 0 in data), the assigned ID is written into it
753
+ obx_box_put_object = c_fn('obx_box_put_object', obx_id, [OBX_box_p, ctypes.c_void_p, ctypes.c_size_t])
754
+
755
+ # OBX_C_API obx_id obx_box_put_object4(OBX_box* box, void* data, size_t size, OBXPutMode mode);
756
+ obx_box_put_object4 = c_fn('obx_box_put_object4', obx_id, [OBX_box_p, ctypes.c_void_p, ctypes.c_size_t, OBXPutMode])
757
+
758
+ # OBX_C_API obx_err obx_box_insert(OBX_box* box, obx_id id, const void* data, size_t size);
759
+ obx_box_insert = c_fn_rc('obx_box_insert', [OBX_box_p, obx_id, ctypes.c_void_p, ctypes.c_size_t])
760
+
761
+ # OBX_C_API obx_err obx_box_update(OBX_box* box, obx_id id, const void* data, size_t size);
762
+ obx_box_update = c_fn_rc('obx_box_update', [OBX_box_p, obx_id, ctypes.c_void_p, ctypes.c_size_t])
763
+
764
+ # obx_err (OBX_box* box, const OBX_bytes_array* objects, const obx_id* ids, OBXPutMode mode);
765
+ obx_box_put_many = c_fn_rc('obx_box_put_many', [OBX_box_p, OBX_bytes_array_p, ctypes.POINTER(obx_id), OBXPutMode])
766
+
767
+ # obx_err (OBX_box* box, obx_id id);
768
+ obx_box_remove = c_fn_nocheck('obx_box_remove', obx_err, [OBX_box_p, obx_id])
769
+
770
+ # OBX_C_API obx_err obx_box_remove_many(OBX_box* box, const OBX_id_array* ids, uint64_t* out_count);
771
+ obx_box_remove_many = c_fn_rc('obx_box_remove_many', [OBX_box_p, OBX_id_array_p, ctypes.POINTER(ctypes.c_uint64)])
772
+
773
+ # OBX_C_API obx_err obx_box_remove_all(OBX_box* box, uint64_t* out_count);
774
+ obx_box_remove_all = c_fn_rc('obx_box_remove_all', [OBX_box_p, ctypes.POINTER(ctypes.c_uint64)])
775
+
776
+ # OBX_C_API obx_err obx_box_is_empty(OBX_box* box, bool* out_is_empty);
777
+ obx_box_is_empty = c_fn_rc('obx_box_is_empty', [OBX_box_p, ctypes.POINTER(ctypes.c_bool)])
778
+
779
+ # OBX_C_API obx_err obx_box_count(OBX_box* box, uint64_t limit, uint64_t* out_count);
780
+ obx_box_count = c_fn_rc('obx_box_count', [OBX_box_p, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64)])
781
+
782
+ # OBX_query_builder* obx_query_builder(OBX_store* store, obx_schema_id entity_id);
783
+ obx_query_builder = c_fn('obx_query_builder', OBX_query_builder_p, [OBX_store_p, obx_schema_id])
784
+
785
+ # OBX_C_API obx_err obx_qb_close(OBX_query_builder* builder);
786
+ obx_qb_close = c_fn_rc('obx_qb_close', [OBX_query_builder_p])
787
+
788
+ # OBX_C_API OBX_query* obx_query(OBX_query_builder* builder);
789
+ obx_query = c_fn('obx_query', OBX_query_p, [OBX_query_builder_p])
790
+
791
+ # OBX_C_API obx_err obx_qb_error_code(OBX_query_builder* builder);
792
+ obx_qb_error_code = c_fn_rc('obx_qb_error_code', [OBX_query_builder_p])
793
+
794
+ # OBX_C_API const char* obx_qb_error_message(OBX_query_builder* builder);
795
+ obx_qb_error_message = c_fn('obx_qb_error_message', ctypes.c_char_p, [OBX_query_builder_p])
796
+
797
+ # OBX_C_API obx_qb_cond obx_qb_null(OBX_query_builder* builder, obx_schema_id property_id);
798
+ obx_qb_null = c_fn('obx_qb_null', obx_qb_cond, [OBX_query_builder_p, obx_schema_id])
799
+
800
+ # OBX_C_API obx_qb_cond obx_qb_not_null(OBX_query_builder* builder, obx_schema_id property_id);
801
+ obx_qb_not_null = c_fn('obx_qb_not_null', obx_qb_cond, [OBX_query_builder_p, obx_schema_id])
802
+
803
+ # OBX_C_API obx_qb_cond obx_qb_equals_string(OBX_query_builder* builder, obx_schema_id property_id, const char* value,
804
+ # bool case_sensitive);
805
+ obx_qb_equals_string = c_fn('obx_qb_equals_string', obx_qb_cond,
806
+ [OBX_query_builder_p, obx_schema_id, ctypes.c_char_p, ctypes.c_bool])
807
+
808
+ # OBX_C_API obx_qb_co nd obx_qb_not_equals_string(OBX_query_builder* builder, obx_schema_id property_id, const char* value,
809
+ # bool case_sensitive);
810
+ obx_qb_not_equals_string = c_fn('obx_qb_not_equals_string', obx_qb_cond,
811
+ [OBX_query_builder_p, obx_schema_id, ctypes.c_char_p, ctypes.c_bool])
812
+
813
+ # OBX_C_API obx_qb_cond obx_qb_contains_string(OBX_query_builder* builder, obx_schema_id property_id, const char* value,
814
+ # bool case_sensitive);
815
+ obx_qb_contains_string = c_fn('obx_qb_contains_string', obx_qb_cond,
816
+ [OBX_query_builder_p, obx_schema_id, ctypes.c_char_p, ctypes.c_bool])
817
+
818
+ # OBX_C_API obx_qb_cond obx_qb_contains_element_string(OBX_query_builder* builder, obx_schema_id property_id,
819
+ # const char* value, bool case_sensitive);
820
+ obx_qb_contains_element_string = c_fn('obx_qb_contains_element_string', obx_qb_cond,
821
+ [OBX_query_builder_p, obx_schema_id, ctypes.c_char_p, ctypes.c_bool])
822
+
823
+ # OBX_C_API obx_qb_cond obx_qb_contains_key_value_string(OBX_query_builder* builder, obx_schema_id property_id,
824
+ # const char* key, const char* value, bool case_sensitive);
825
+ obx_qb_contains_key_value_string = c_fn('obx_qb_contains_key_value_string', obx_qb_cond,
826
+ [OBX_query_builder_p, obx_schema_id, ctypes.c_char_p, ctypes.c_char_p,
827
+ ctypes.c_bool])
828
+
829
+ # OBX_C_API obx_qb_cond obx_qb_starts_with_string(OBX_query_builder* builder, obx_schema_id property_id,
830
+ # const char* value, bool case_sensitive);
831
+ obx_qb_starts_with_string = c_fn('obx_qb_starts_with_string', obx_qb_cond,
832
+ [OBX_query_builder_p, obx_schema_id, ctypes.c_char_p, ctypes.c_bool])
833
+
834
+ # OBX_C_API obx_qb_cond obx_qb_ends_with_string(OBX_query_builder* builder, obx_schema_id property_id, const char* value,
835
+ # bool case_sensitive);
836
+ obx_qb_ends_with_string = c_fn('obx_qb_ends_with_string', obx_qb_cond,
837
+ [OBX_query_builder_p, obx_schema_id, ctypes.c_char_p, ctypes.c_bool])
838
+
839
+ # OBX_C_API obx_qb_cond obx_qb_greater_than_string(OBX_query_builder* builder, obx_schema_id property_id,
840
+ # const char* value, bool case_sensitive);
841
+ obx_qb_greater_than_string = c_fn('obx_qb_greater_than_string', obx_qb_cond,
842
+ [OBX_query_builder_p, obx_schema_id, ctypes.c_char_p, ctypes.c_bool])
843
+
844
+ # OBX_C_API obx_qb_cond obx_qb_greater_or_equal_string(OBX_query_builder* builder, obx_schema_id property_id,
845
+ # const char* value, bool case_sensitive);
846
+ obx_qb_greater_or_equal_string = c_fn('obx_qb_greater_or_equal_string', obx_qb_cond,
847
+ [OBX_query_builder_p, obx_schema_id, ctypes.c_char_p, ctypes.c_bool])
848
+
849
+ # OBX_C_API obx_qb_cond obx_qb_less_than_string(OBX_query_builder* builder, obx_schema_id property_id, const char* value,
850
+ # bool case_sensitive);
851
+ obx_qb_less_than_string = c_fn('obx_qb_less_than_string', obx_qb_cond,
852
+ [OBX_query_builder_p, obx_schema_id, ctypes.c_char_p, ctypes.c_bool])
853
+
854
+ # OBX_C_API obx_qb_cond obx_qb_less_or_equal_string(OBX_query_builder* builder, obx_schema_id property_id,
855
+ # const char* value, bool case_sensitive);
856
+ obx_qb_less_or_equal_string = c_fn('obx_qb_less_or_equal_string', obx_qb_cond,
857
+ [OBX_query_builder_p, obx_schema_id, ctypes.c_char_p, ctypes.c_bool])
858
+
859
+ # OBX_C_API obx_qb_cond obx_qb_in_strings(OBX_query_builder* builder, obx_schema_id property_id,
860
+ # const char* const values[], size_t count, bool case_sensitive);
861
+ obx_qb_in_strings = c_fn('obx_qb_in_strings', obx_qb_cond,
862
+ [OBX_query_builder_p, obx_schema_id, ctypes.POINTER(ctypes.c_char_p), ctypes.c_size_t,
863
+ ctypes.c_bool])
864
+
865
+ # OBX_C_API obx_qb_cond obx_qb_any_equals_string(OBX_query_builder* builder, obx_schema_id property_id, const char* value,
866
+ # bool case_sensitive);
867
+ obx_qb_any_equals_string = c_fn('obx_qb_any_equals_string', obx_qb_cond,
868
+ [OBX_query_builder_p, obx_schema_id, ctypes.c_char_p, ctypes.c_bool])
869
+
870
+ # OBX_C_API obx_qb_cond obx_qb_equals_int(OBX_query_builder* builder, obx_schema_id property_id, int64_t value);
871
+ obx_qb_equals_int = c_fn('obx_qb_equals_int', obx_qb_cond, [OBX_query_builder_p, obx_schema_id, ctypes.c_int64])
872
+
873
+ # OBX_C_API obx_qb_cond obx_qb_not_equals_int(OBX_query_builder* builder, obx_schema_id property_id, int64_t value);
874
+ obx_qb_not_equals_int = c_fn('obx_qb_not_equals_int', obx_qb_cond, [OBX_query_builder_p, obx_schema_id, ctypes.c_int64])
875
+
876
+ # OBX_C_API obx_qb_cond obx_qb_greater_than_int(OBX_query_builder* builder, obx_schema_id property_id, int64_t value);
877
+ obx_qb_greater_than_int = c_fn('obx_qb_greater_than_int', obx_qb_cond,
878
+ [OBX_query_builder_p, obx_schema_id, ctypes.c_int64])
879
+
880
+ # OBX_C_API obx_qb_cond obx_qb_greater_or_equal_int(OBX_query_builder* builder, obx_schema_id property_id, int64_t value);
881
+ obx_qb_greater_or_equal_int = c_fn('obx_qb_greater_or_equal_int', obx_qb_cond,
882
+ [OBX_query_builder_p, obx_schema_id, ctypes.c_int64])
883
+
884
+ # OBX_C_API obx_qb_cond obx_qb_less_than_int(OBX_query_builder* builder, obx_schema_id property_id, int64_t value);
885
+ obx_qb_less_than_int = c_fn('obx_qb_less_than_int', obx_qb_cond, [OBX_query_builder_p, obx_schema_id, ctypes.c_int64])
886
+
887
+ # OBX_C_API obx_qb_cond obx_qb_less_or_equal_int(OBX_query_builder* builder, obx_schema_id property_id, int64_t value);
888
+ obx_qb_less_or_equal_int = c_fn('obx_qb_less_or_equal_int', obx_qb_cond,
889
+ [OBX_query_builder_p, obx_schema_id, ctypes.c_int64])
890
+
891
+ # OBX_C_API obx_qb_cond obx_qb_between_2ints(OBX_query_builder* builder, obx_schema_id property_id, int64_t value_a,
892
+ # int64_t value_b);
893
+ obx_qb_between_2ints = c_fn('obx_qb_between_2ints', obx_qb_cond,
894
+ [OBX_query_builder_p, obx_schema_id, ctypes.c_int64, ctypes.c_int64])
895
+
896
+ # OBX_C_API obx_qb_cond obx_qb_in_int64s(OBX_query_builder* builder, obx_schema_id property_id, const int64_t values[],
897
+ # size_t count);
898
+ obx_qb_in_int64s = c_fn('obx_qb_in_int64s', obx_qb_cond,
899
+ [OBX_query_builder_p, obx_schema_id, ctypes.POINTER(ctypes.c_int64), ctypes.c_size_t])
900
+
901
+ # OBX_C_API obx_qb_cond obx_qb_not_in_int64s(OBX_query_builder* builder, obx_schema_id property_id,
902
+ # const int64_t values[], size_t count);
903
+ obx_qb_not_in_int64s = c_fn('obx_qb_not_in_int64s', obx_qb_cond,
904
+ [OBX_query_builder_p, obx_schema_id, ctypes.POINTER(ctypes.c_int64), ctypes.c_size_t])
905
+
906
+ # OBX_C_API obx_qb_cond obx_qb_in_int32s(OBX_query_builder* builder, obx_schema_id property_id, const int32_t values[],
907
+ # size_t count);
908
+ obx_qb_in_int32s = c_fn('obx_qb_in_int32s', obx_qb_cond,
909
+ [OBX_query_builder_p, obx_schema_id, ctypes.POINTER(ctypes.c_int32), ctypes.c_size_t])
910
+
911
+ # OBX_C_API obx_qb_cond obx_qb_not_in_int32s(OBX_query_builder* builder, obx_schema_id property_id,
912
+ # const int32_t values[], size_t count);
913
+ obx_qb_not_in_int32s = c_fn('obx_qb_not_in_int32s', obx_qb_cond,
914
+ [OBX_query_builder_p, obx_schema_id, ctypes.POINTER(ctypes.c_int32), ctypes.c_size_t])
915
+
916
+ # OBX_C_API obx_qb_cond obx_qb_greater_than_double(OBX_query_builder* builder, obx_schema_id property_id, double value);
917
+ obx_qb_greater_than_double = c_fn('obx_qb_greater_than_double', obx_qb_cond,
918
+ [OBX_query_builder_p, obx_schema_id, ctypes.c_double])
919
+
920
+ # OBX_C_API obx_qb_cond obx_qb_greater_or_equal_double(OBX_query_builder* builder, obx_schema_id property_id,
921
+ # double value);
922
+ obx_qb_greater_or_equal_double = c_fn('obx_qb_greater_or_equal_double', obx_qb_cond,
923
+ [OBX_query_builder_p, obx_schema_id, ctypes.c_double])
924
+
925
+ # OBX_C_API obx_qb_cond obx_qb_less_than_double(OBX_query_builder* builder, obx_schema_id property_id, double value);
926
+ obx_qb_less_than_double = c_fn('obx_qb_less_than_double', obx_qb_cond,
927
+ [OBX_query_builder_p, obx_schema_id, ctypes.c_double])
928
+
929
+ # OBX_C_API obx_qb_cond obx_qb_less_or_equal_double(OBX_query_builder* builder, obx_schema_id property_id, double value);
930
+ obx_qb_less_or_equal_double = c_fn('obx_qb_less_or_equal_double', obx_qb_cond,
931
+ [OBX_query_builder_p, obx_schema_id, ctypes.c_double])
932
+
933
+ # OBX_C_API obx_qb_cond obx_qb_between_2doubles(OBX_query_builder* builder, obx_schema_id property_id, double value_a,
934
+ # double value_b);
935
+ obx_qb_between_2doubles = c_fn('obx_qb_between_2doubles', obx_qb_cond,
936
+ [OBX_query_builder_p, obx_schema_id, ctypes.c_double, ctypes.c_double])
937
+
938
+ # OBX_C_API obx_qb_cond obx_qb_equals_bytes(OBX_query_builder* builder, obx_schema_id property_id, const void* value,
939
+ # size_t size);
940
+ obx_qb_equals_bytes = c_fn('obx_qb_equals_bytes', obx_qb_cond,
941
+ [OBX_query_builder_p, obx_schema_id, ctypes.c_void_p, ctypes.c_size_t])
942
+
943
+ # OBX_C_API obx_qb_cond obx_qb_greater_than_bytes(OBX_query_builder* builder, obx_schema_id property_id,
944
+ # const void* value, size_t size);
945
+ obx_qb_greater_than_bytes = c_fn('obx_qb_greater_than_bytes', obx_qb_cond,
946
+ [OBX_query_builder_p, obx_schema_id, ctypes.c_void_p, ctypes.c_size_t])
947
+
948
+ # OBX_C_API obx_qb_cond obx_qb_greater_or_equal_bytes(OBX_query_builder* builder, obx_schema_id property_id,
949
+ # const void* value, size_t size);
950
+ obx_qb_greater_or_equal_bytes = c_fn('obx_qb_greater_or_equal_bytes', obx_qb_cond,
951
+ [OBX_query_builder_p, obx_schema_id, ctypes.c_void_p, ctypes.c_size_t])
952
+
953
+ # OBX_C_API obx_qb_cond obx_qb_less_than_bytes(OBX_query_builder* builder, obx_schema_id property_id, const void* value,
954
+ # size_t size);
955
+ obx_qb_less_than_bytes = c_fn('obx_qb_less_than_bytes', obx_qb_cond,
956
+ [OBX_query_builder_p, obx_schema_id, ctypes.c_void_p, ctypes.c_size_t])
957
+
958
+ # OBX_C_API obx_qb_cond obx_qb_less_or_equal_bytes(OBX_query_builder* builder, obx_schema_id property_id,
959
+ # const void* value, size_t size);
960
+ obx_qb_less_or_equal_bytes = c_fn('obx_qb_less_or_equal_bytes', obx_qb_cond,
961
+ [OBX_query_builder_p, obx_schema_id, ctypes.c_void_p, ctypes.c_size_t])
962
+
963
+ # OBX_C_API obx_qb_cond obx_qb_all(OBX_query_builder* builder, const obx_qb_cond conditions[], size_t count);
964
+ obx_qb_all = c_fn('obx_qb_all', obx_qb_cond, [OBX_query_builder_p, obx_qb_cond_p, ctypes.c_size_t])
965
+
966
+ # OBX_C_API obx_qb_cond obx_qb_any(OBX_query_builder* builder, const obx_qb_cond conditions[], size_t count);
967
+ obx_qb_any = c_fn('obx_qb_any', obx_qb_cond, [OBX_query_builder_p, obx_qb_cond_p, ctypes.c_size_t])
968
+
969
+ # OBX_C_API OBX_query_builder* obx_qb_link_property(OBX_query_builder* builder, obx_schema_id property_id);
970
+ obx_qb_link_property = c_fn('obx_qb_link_property', OBX_query_builder_p, [OBX_query_builder_p, obx_schema_id])
971
+
972
+ # OBX_C_API OBX_query_builder* obx_qb_backlink_property(OBX_query_builder* builder, obx_schema_id source_entity_id,
973
+ # obx_schema_id source_property_id);
974
+ obx_qb_backlink_property = c_fn('obx_qb_backlink_property', OBX_query_builder_p,
975
+ [OBX_query_builder_p, obx_schema_id, obx_schema_id])
976
+
977
+ # OBX_C_API obx_err obx_qb_param_alias(OBX_query_builder* builder, const char* alias);
978
+ obx_qb_param_alias = c_fn_rc('obx_qb_param_alias', [OBX_query_builder_p, ctypes.c_char_p])
979
+
980
+ # OBX_C_API obx_err obx_query_param_string(OBX_query* query, obx_schema_id entity_id, obx_schema_id property_id, const char* value);
981
+ obx_query_param_string = c_fn_rc('obx_query_param_string', [OBX_query_p, obx_schema_id, obx_schema_id, ctypes.c_char_p])
982
+
983
+ # OBX_C_API obx_err obx_query_param_int(OBX_query* query, obx_schema_id entity_id, obx_schema_id property_id, int64_t value);
984
+ obx_query_param_int = c_fn_rc('obx_query_param_int', [OBX_query_p, obx_schema_id, obx_schema_id, ctypes.c_int64])
985
+
986
+ # OBX_C_API obx_err obx_query_param_vector_float32(OBX_query* query, obx_schema_id entity_id, obx_schema_id property_id, const float* value, size_t element_count);
987
+ obx_query_param_vector_float32 = c_fn_rc('obx_query_param_vector_float32',
988
+ [OBX_query_p, obx_schema_id, obx_schema_id, ctypes.POINTER(ctypes.c_float),
989
+ ctypes.c_size_t])
990
+
991
+ # OBX_C_API obx_err obx_query_param_alias_vector_float32(OBX_query* query, const char* alias, const float* value, size_t element_count);
992
+ obx_query_param_alias_vector_float32 = c_fn_rc('obx_query_param_alias_vector_float32',
993
+ [OBX_query_p, ctypes.c_char_p, ctypes.POINTER(ctypes.c_float),
994
+ ctypes.c_size_t])
995
+
996
+ # OBX_C_API obx_err obx_query_param_alias_string(OBX_query* query, const char* alias, const char* value);
997
+ obx_query_param_alias_string = c_fn_rc('obx_query_param_alias_string', [OBX_query_p, ctypes.c_char_p, ctypes.c_char_p])
998
+
999
+ # OBX_C_API obx_err obx_query_param_alias_int(OBX_query* query, const char* alias, int64_t value);
1000
+ obx_query_param_alias_int = c_fn_rc('obx_query_param_alias_int', [OBX_query_p, ctypes.c_char_p, ctypes.c_int64])
1001
+
1002
+ # OBX_C_API obx_err obx_query_param_strings(OBX_query* query, obx_schema_id entity_id, obx_schema_id property_id,
1003
+ # const char* const values[], size_t count);
1004
+ obx_query_param_strings = c_fn_rc('obx_query_param_strings',
1005
+ [OBX_query_p, obx_schema_id, obx_schema_id, ctypes.POINTER(ctypes.c_char_p),
1006
+ ctypes.c_size_t])
1007
+
1008
+ # OBX_C_API obx_err obx_query_param_int64s(OBX_query* query, obx_schema_id entity_id, obx_schema_id property_id,
1009
+ # const int64_t values[], size_t count);
1010
+ obx_query_param_int64s = c_fn_rc('obx_query_param_int64s',
1011
+ [OBX_query_p, obx_schema_id, obx_schema_id, ctypes.POINTER(ctypes.c_int64),
1012
+ ctypes.c_size_t])
1013
+
1014
+ # OBX_C_API obx_err obx_query_param_int32s(OBX_query* query, obx_schema_id entity_id, obx_schema_id property_id,
1015
+ # const int32_t values[], size_t count);
1016
+ obx_query_param_int32s = c_fn_rc('obx_query_param_int32s',
1017
+ [OBX_query_p, obx_schema_id, obx_schema_id, ctypes.POINTER(ctypes.c_int32),
1018
+ ctypes.c_size_t])
1019
+
1020
+ # OBX_C_API obx_err obx_query_param_alias_strings(OBX_query* query, const char* alias, const char* const values[],
1021
+ # size_t count);
1022
+ obx_query_param_alias_strings = c_fn_rc('obx_query_param_alias_strings',
1023
+ [OBX_query_p, ctypes.c_char_p, ctypes.POINTER(ctypes.c_char_p),
1024
+ ctypes.c_size_t])
1025
+
1026
+ # OBX_C_API obx_err obx_query_param_alias_int64s(OBX_query* query, const char* alias, const int64_t values[],
1027
+ # size_t count);
1028
+ obx_query_param_alias_int64s = c_fn_rc('obx_query_param_alias_int64s',
1029
+ [OBX_query_p, ctypes.c_char_p, ctypes.POINTER(ctypes.c_int64), ctypes.c_size_t])
1030
+
1031
+ # OBX_C_API obx_err obx_query_param_alias_int32s(OBX_query* query, const char* alias, const int32_t values[],
1032
+ # size_t count);
1033
+ obx_query_param_alias_int32s = c_fn_rc('obx_query_param_alias_int32s',
1034
+ [OBX_query_p, ctypes.c_char_p, ctypes.POINTER(ctypes.c_int32), ctypes.c_size_t])
1035
+
1036
+ # OBX_C_API obx_err obx_query_param_2ints(OBX_query* query, obx_schema_id entity_id, obx_schema_id property_id,
1037
+ # int64_t value_a, int64_t value_b);
1038
+ obx_query_param_2ints = c_fn_rc('obx_query_param_2ints',
1039
+ [OBX_query_p, obx_schema_id, obx_schema_id, ctypes.c_int64, ctypes.c_int64])
1040
+
1041
+ # OBX_C_API obx_err obx_query_param_double(OBX_query* query, obx_schema_id entity_id, obx_schema_id property_id,
1042
+ # double value);
1043
+ obx_query_param_double = c_fn_rc('obx_query_param_double', [OBX_query_p, obx_schema_id, obx_schema_id, ctypes.c_double])
1044
+
1045
+ # OBX_C_API obx_err obx_query_param_2doubles(OBX_query* query, obx_schema_id entity_id, obx_schema_id property_id,
1046
+ # double value_a, double value_b);
1047
+ obx_query_param_2doubles = c_fn_rc('obx_query_param_2doubles',
1048
+ [OBX_query_p, obx_schema_id, obx_schema_id, ctypes.c_double, ctypes.c_double])
1049
+
1050
+ # OBX_C_API obx_err obx_query_param_bytes(OBX_query* query, obx_schema_id entity_id, obx_schema_id property_id,
1051
+ # const void* value, size_t size);
1052
+ obx_query_param_bytes = c_fn_rc('obx_query_param_bytes',
1053
+ [OBX_query_p, obx_schema_id, obx_schema_id, ctypes.c_void_p, ctypes.c_size_t])
1054
+
1055
+ # OBX_C_API obx_err obx_query_param_alias_2ints(OBX_query* query, const char* alias, int64_t value_a, int64_t value_b);
1056
+ obx_query_param_alias_2ints = c_fn_rc('obx_query_param_alias_2ints',
1057
+ [OBX_query_p, ctypes.c_char_p, ctypes.c_int64, ctypes.c_int64])
1058
+
1059
+ # OBX_C_API obx_err obx_query_param_alias_double(OBX_query* query, const char* alias, double value);
1060
+ obx_query_param_alias_double = c_fn_rc('obx_query_param_alias_double', [OBX_query_p, ctypes.c_char_p, ctypes.c_double])
1061
+
1062
+ # OBX_C_API obx_err obx_query_param_alias_2doubles(OBX_query* query, const char* alias, double value_a, double value_b);
1063
+ obx_query_param_alias_2doubles = c_fn_rc('obx_query_param_alias_2doubles',
1064
+ [OBX_query_p, ctypes.c_char_p, ctypes.c_double, ctypes.c_double])
1065
+
1066
+ # OBX_C_API obx_err obx_query_param_alias_bytes(OBX_query* query, const char* alias, const void* value, size_t size);
1067
+ obx_query_param_alias_bytes = c_fn_rc('obx_query_param_alias_bytes',
1068
+ [OBX_query_p, ctypes.c_char_p, ctypes.c_void_p, ctypes.c_size_t])
1069
+
1070
+ # OBX_C_API size_t obx_query_param_get_type_size(OBX_query* query, obx_schema_id entity_id, obx_schema_id property_id);
1071
+ # Not checked: returns 0 for non-scalar types (e.g. strings) and on errors.
1072
+ obx_query_param_get_type_size = c_fn_nocheck('obx_query_param_get_type_size', ctypes.c_size_t,
1073
+ [OBX_query_p, obx_schema_id, obx_schema_id])
1074
+
1075
+ # OBX_C_API size_t obx_query_param_alias_get_type_size(OBX_query* query, const char* alias);
1076
+ # Not checked: returns 0 for non-scalar types (e.g. strings) and on errors.
1077
+ obx_query_param_alias_get_type_size = c_fn_nocheck('obx_query_param_alias_get_type_size', ctypes.c_size_t,
1078
+ [OBX_query_p, ctypes.c_char_p])
1079
+
1080
+ # OBX_C_API obx_err obx_qb_order(OBX_query_builder* builder, obx_schema_id property_id, OBXOrderFlags flags);
1081
+ obx_qb_order = c_fn_rc('obx_qb_order', [OBX_query_builder_p, obx_schema_id, OBXOrderFlags])
1082
+
1083
+ # OBX_C_API obx_qb_cond obx_qb_nearest_neighbors_f32(OBX_query_builder* builder, obx_schema_id vector_property_id, const float* query_vector, size_t max_result_count)
1084
+ obx_qb_nearest_neighbors_f32 = c_fn_qb_cond('obx_qb_nearest_neighbors_f32',
1085
+ [OBX_query_builder_p, obx_schema_id, ctypes.POINTER(ctypes.c_float),
1086
+ ctypes.c_size_t])
1087
+
1088
+ # OBX_C_API OBX_query* obx_query(OBX_query_builder* builder);
1089
+ obx_query = c_fn('obx_query', OBX_query_p, [OBX_query_builder_p])
1090
+
1091
+ # OBX_C_API obx_err obx_query_close(OBX_query* query);
1092
+ obx_query_close = c_fn_rc('obx_query_close', [OBX_query_p])
1093
+
1094
+ # OBX_C_API OBX_query* obx_query_clone(OBX_query* query);
1095
+ obx_query_clone = c_fn('obx_query_clone', OBX_query_p, [OBX_query_p])
1096
+
1097
+ # OBX_C_API obx_err obx_query_offset(OBX_query* query, size_t offset);
1098
+ obx_query_offset = c_fn_rc('obx_query_offset', [OBX_query_p, ctypes.c_size_t])
1099
+
1100
+ # OBX_C_API obx_err obx_query_offset_limit(OBX_query* query, size_t offset, size_t limit);
1101
+ obx_query_offset_limit = c_fn_rc('obx_query_offset_limit', [OBX_query_p, ctypes.c_size_t, ctypes.c_size_t])
1102
+
1103
+ # OBX_C_API obx_err obx_query_limit(OBX_query* query, size_t limit);
1104
+ obx_query_limit = c_fn_rc('obx_query_limit', [OBX_query_p, ctypes.c_size_t])
1105
+
1106
+ # OBX_C_API OBX_bytes_array* obx_query_find(OBX_query* query);
1107
+ obx_query_find = c_fn('obx_query_find', OBX_bytes_array_p, [OBX_query_p])
1108
+
1109
+ # OBX_C_API obx_err obx_query_find_first(OBX_query* query, const void** data, size_t* size);
1110
+ obx_query_find_first = c_fn_nocheck('obx_query_find_first', obx_err, # OBX_NOT_FOUND if there is no result
1111
+ [OBX_query_p, ctypes.POINTER(ctypes.c_void_p), ctypes.POINTER(ctypes.c_size_t)])
1112
+
1113
+ # OBX_C_API obx_err obx_query_find_unique(OBX_query* query, const void** data, size_t* size);
1114
+ obx_query_find_unique = c_fn_nocheck('obx_query_find_unique', obx_err, # OBX_NOT_FOUND if there is no result
1115
+ [OBX_query_p, ctypes.POINTER(ctypes.c_void_p), ctypes.POINTER(ctypes.c_size_t)])
1116
+
1117
+ # OBX_C_API OBX_bytes_score_array* obx_query_find_with_scores(OBX_query* query);
1118
+ obx_query_find_with_scores = c_fn('obx_query_find_with_scores', OBX_bytes_score_array_p, [OBX_query_p])
1119
+
1120
+ # typedef bool obx_data_visitor(void* user_data, const void* data, size_t size);
1121
+
1122
+ # OBX_C_API obx_err obx_query_visit(OBX_query* query, obx_data_visitor* visitor, void* user_data);
1123
+ # obx_query_visit = fn('obx_query_visit', obx_err, [OBX_query_p, obx_data_visitor_p, ctypes.c_void_p])
1124
+
1125
+ # OBX_C_API OBX_id_array* obx_query_find_ids(OBX_query* query);
1126
+ obx_query_find_ids = c_fn('obx_query_find_ids', OBX_id_array_p, [OBX_query_p])
1127
+
1128
+ # OBX_C_API OBX_id_score_array* obx_query_find_ids_with_scores(OBX_query* query);
1129
+ obx_query_find_ids_with_scores = c_fn('obx_query_find_ids_with_scores', OBX_id_score_array_p, [OBX_query_p])
1130
+
1131
+ # OBX_C_API OBX_id_array* obx_query_find_ids_by_score(OBX_query* query);
1132
+ obx_query_find_ids_by_score = c_fn('obx_query_find_ids_by_score', OBX_id_array_p, [OBX_query_p])
1133
+
1134
+ # OBX_C_API obx_err obx_query_count(OBX_query* query, uint64_t* out_count);
1135
+ obx_query_count = c_fn_rc('obx_query_count', [OBX_query_p, ctypes.POINTER(ctypes.c_uint64)])
1136
+
1137
+ # OBX_C_API obx_err obx_query_remove(OBX_query* query, uint64_t* out_count);
1138
+ obx_query_remove = c_fn_rc('obx_query_remove', [OBX_query_p, ctypes.POINTER(ctypes.c_uint64)])
1139
+
1140
+ # OBX_C_API const char* obx_query_describe(OBX_query* query);
1141
+ obx_query_describe = c_fn('obx_query_describe', ctypes.c_char_p, [OBX_query_p])
1142
+
1143
+ # OBX_C_API const char* obx_query_describe_params(OBX_query* query);
1144
+ obx_query_describe_params = c_fn('obx_query_describe_params', ctypes.c_char_p, [OBX_query_p])
1145
+
1146
+ # OBX_bytes_array* (size_t count);
1147
+ obx_bytes_array = c_fn('obx_bytes_array', OBX_bytes_array_p, [ctypes.c_size_t])
1148
+
1149
+ # obx_err (OBX_bytes_array* array, size_t index, const void* data, size_t size);
1150
+ obx_bytes_array_set = c_fn_rc('obx_bytes_array_set', [
1151
+ OBX_bytes_array_p, ctypes.c_size_t, ctypes.c_void_p, ctypes.c_size_t])
1152
+
1153
+ # void (OBX_bytes_array * array);
1154
+ obx_bytes_array_free = c_fn('obx_bytes_array_free', None, [OBX_bytes_array_p])
1155
+
1156
+ # OBX_C_API void obx_id_array_free(OBX_id_array* array);
1157
+ obx_id_array_free = c_fn('obx_id_array_free', None, [OBX_id_array_p])
1158
+
1159
+ # OBX_C_API void obx_bytes_score_array_free(OBX_bytes_score_array* array)
1160
+ obx_bytes_score_array_free = c_fn('obx_bytes_score_array_free', None, [OBX_bytes_score_array_p])
1161
+
1162
+ # OBX_C_API void obx_id_score_array_free(OBX_id_score_array* array)
1163
+ obx_id_score_array_free = c_fn('obx_id_score_array_free', None, [OBX_id_score_array_p])
1164
+
1165
+ OBXPropertyType_Bool = 1
1166
+ OBXPropertyType_Byte = 2
1167
+ OBXPropertyType_Short = 3
1168
+ OBXPropertyType_Char = 4
1169
+ OBXPropertyType_Int = 5
1170
+ OBXPropertyType_Long = 6
1171
+ OBXPropertyType_Float = 7
1172
+ OBXPropertyType_Double = 8
1173
+ OBXPropertyType_String = 9
1174
+ OBXPropertyType_Date = 10
1175
+ OBXPropertyType_Relation = 11
1176
+ OBXPropertyType_DateNano = 12
1177
+ OBXPropertyType_Flex = 13
1178
+ OBXPropertyType_BoolVector = 22
1179
+ OBXPropertyType_ByteVector = 23
1180
+ OBXPropertyType_ShortVector = 24
1181
+ OBXPropertyType_CharVector = 25
1182
+ OBXPropertyType_IntVector = 26
1183
+ OBXPropertyType_LongVector = 27
1184
+ OBXPropertyType_FloatVector = 28
1185
+ OBXPropertyType_DoubleVector = 29
1186
+ OBXPropertyType_StringVector = 30
1187
+
1188
+ OBXPropertyFlags_ID = 1
1189
+ OBXPropertyFlags_NON_PRIMITIVE_TYPE = 2
1190
+ OBXPropertyFlags_NOT_NULL = 4
1191
+ OBXPropertyFlags_INDEXED = 8
1192
+ OBXPropertyFlags_RESERVED = 16
1193
+ OBXPropertyFlags_UNIQUE = 32
1194
+ OBXPropertyFlags_ID_MONOTONIC_SEQUENCE = 64
1195
+ OBXPropertyFlags_ID_SELF_ASSIGNABLE = 128
1196
+ OBXPropertyFlags_INDEX_PARTIAL_SKIP_NULL = 256
1197
+ OBXPropertyFlags_INDEX_PARTIAL_SKIP_ZERO = 512
1198
+ OBXPropertyFlags_VIRTUAL = 1024
1199
+ OBXPropertyFlags_INDEX_HASH = 2048
1200
+ OBXPropertyFlags_INDEX_HASH64 = 4096
1201
+ OBXPropertyFlags_UNSIGNED = 8192
1202
+ OBXPropertyFlags_UNIQUE_ON_CONFLICT_REPLACE = 32768
1203
+ OBXPropertyFlags_SYNC_CLOCK = 131072
1204
+ OBXPropertyFlags_SYNC_PRECEDENCE = 262144
1205
+
1206
+ OBXDebugFlags_LOG_TRANSACTIONS_READ = 1
1207
+ OBXDebugFlags_LOG_TRANSACTIONS_WRITE = 2
1208
+ OBXDebugFlags_LOG_QUERIES = 4
1209
+ OBXDebugFlags_LOG_QUERY_PARAMETERS = 8
1210
+ OBXDebugFlags_LOG_ASYNC_QUEUE = 16
1211
+ OBXDebugFlags_LOG_CACHE_HITS = 32
1212
+ OBXDebugFlags_LOG_CACHE_ALL = 64
1213
+ OBXDebugFlags_LOG_TREE = 128
1214
+ OBXDebugFlags_LOG_EXCEPTION_STACK_TRACE = 256
1215
+ OBXDebugFlags_RUN_THREADING_SELF_TEST = 512
1216
+
1217
+ # Standard put ("insert or update")
1218
+ OBXPutMode_PUT = 1
1219
+
1220
+ # Put succeeds only if the entity does not exist yet.
1221
+ OBXPutMode_INSERT = 2
1222
+
1223
+ # Put succeeds only if the entity already exist.
1224
+ OBXPutMode_UPDATE = 3
1225
+
1226
+ # The given ID (non-zero) is guaranteed to be new; don't use unless you know exactly what you are doing!
1227
+ # This is primarily used internally. Wrong usage leads to inconsistent data (e.g. index data not updated)!
1228
+ OBXPutMode_PUT_ID_GUARANTEED_TO_BE_NEW = 4
1229
+
1230
+ # Reverts the order from ascending (default) to descending.
1231
+ OBXOrderFlags_DESCENDING = 1
1232
+
1233
+ # Makes upper case letters (e.g. "Z") be sorted before lower case letters (e.g. "a").
1234
+ # If not specified, the default is case insensitive for ASCII characters.
1235
+ OBXOrderFlags_CASE_SENSITIVE = 2
1236
+
1237
+ # For scalars only: changes the comparison to unsigned (default is signed).
1238
+ OBXOrderFlags_UNSIGNED = 4
1239
+
1240
+ # null values will be put last.
1241
+ # If not specified, by default null values will be put first.
1242
+ OBXOrderFlags_NULLS_LAST = 8
1243
+
1244
+ # null values should be treated equal to zero (scalars only).
1245
+ OBXOrderFlags_NULLS_ZERO = 16
1246
+
1247
+ OBXHnswFlags_NONE = 0
1248
+ OBXHnswFlags_DEBUG_LOGS = 1
1249
+ OBXHnswFlags_DEBUG_LOGS_DETAILED = 2
1250
+ OBXHnswFlags_VECTOR_CACHE_SIMD_PADDING_OFF = 4
1251
+ OBXHnswFlags_REPARATION_LIMIT_CANDIDATES = 8
1252
+
1253
+ OBXVectorDistanceType_UNKNOWN = 0
1254
+ OBXVectorDistanceType_EUCLIDEAN = 1
1255
+ OBXVectorDistanceType_COSINE = 2
1256
+ OBXVectorDistanceType_DOT_PRODUCT = 3
1257
+ OBXVectorDistanceType_DOT_PRODUCT_NON_NORMALIZED = 10
1258
+
1259
+ OBXPutPaddingMode_PaddingAutomatic = 1
1260
+ OBXPutPaddingMode_PaddingAllowedByBuffer = 2
1261
+ OBXPutPaddingMode_PaddingByCaller = 3
1262
+
1263
+ OBXValidateOnOpenPagesFlags_None = 0
1264
+ OBXValidateOnOpenPagesFlags_VisitLeafPages = 1
1265
+
1266
+ OBXValidateOnOpenKvFlags_None = 0
1267
+
1268
+ OBXBackupRestoreFlags_None = 0
1269
+ OBXBackupRestoreFlags_OverwriteExistingData = 1
1270
+
1271
+
1272
+ # Sync API
1273
+
1274
+ class OBX_sync(ctypes.Structure):
1275
+ pass
1276
+
1277
+
1278
+ OBX_sync_p = ctypes.POINTER(OBX_sync)
1279
+
1280
+
1281
+ class OBX_sync_options(ctypes.Structure):
1282
+ pass
1283
+
1284
+
1285
+ OBX_sync_options_p = ctypes.POINTER(OBX_sync_options)
1286
+
1287
+
1288
+ class OBX_sync_server(ctypes.Structure):
1289
+ pass
1290
+
1291
+
1292
+ OBX_sync_server_p = ctypes.POINTER(OBX_sync_server)
1293
+
1294
+ OBXSyncCredentialsType = ctypes.c_int
1295
+ OBXRequestUpdatesMode = ctypes.c_int
1296
+ OBXSyncState = ctypes.c_int
1297
+ OBXSyncCode = ctypes.c_int
1298
+
1299
+
1300
+ class SyncCredentialsType(IntEnum):
1301
+ NONE = 1
1302
+ SHARED_SECRET = 2 # Deprecated, use SHARED_SECRET_SIPPED instead
1303
+ GOOGLE_AUTH = 3
1304
+ SHARED_SECRET_SIPPED = 4 # Uses shared secret to create a hashed credential
1305
+ OBX_ADMIN_USER = 5 # ObjectBox admin users (username/password)
1306
+ USER_PASSWORD = 6 # Generic credential type for admin users
1307
+ JWT_ID = 7 # JSON Web Token (JWT): ID token with user identity
1308
+ JWT_ACCESS = 8 # JSON Web Token (JWT): access token for resources
1309
+ JWT_REFRESH = 9 # JSON Web Token (JWT): refresh token
1310
+ JWT_CUSTOM = 10 # JSON Web Token (JWT): custom token type
1311
+
1312
+
1313
+ class RequestUpdatesMode(IntEnum):
1314
+ MANUAL = 0 # No updates by default, must call obx_sync_updates_request() manually
1315
+ AUTO = 1 # Same as calling obx_sync_updates_request(sync, TRUE)
1316
+ AUTO_NO_PUSHES = 2 # Same as calling obx_sync_updates_request(sync, FALSE)
1317
+
1318
+
1319
+ class SyncState(IntEnum):
1320
+ CREATED = 1
1321
+ STARTED = 2
1322
+ CONNECTED = 3
1323
+ LOGGED_IN = 4
1324
+ DISCONNECTED = 5
1325
+ STOPPED = 6
1326
+ DEAD = 7
1327
+
1328
+
1329
+ class OBXSyncError(IntEnum):
1330
+ REJECT_TX_NO_PERMISSION = 1 # Sync client received rejection of transaction writes due to missing permissions
1331
+
1332
+
1333
+ class OBXSyncObjectType(IntEnum):
1334
+ FlatBuffers = 1
1335
+ String = 2
1336
+ Raw = 3
1337
+
1338
+
1339
+ class OBX_sync_change(ctypes.Structure):
1340
+ _fields_ = [
1341
+ ('entity_id', obx_schema_id),
1342
+ ('puts', ctypes.POINTER(OBX_id_array)),
1343
+ ('removals', ctypes.POINTER(OBX_id_array)),
1344
+ ]
1345
+
1346
+
1347
+ class OBX_sync_change_array(ctypes.Structure):
1348
+ _fields_ = [
1349
+ ('list', ctypes.POINTER(OBX_sync_change)),
1350
+ ('count', ctypes.c_size_t),
1351
+ ]
1352
+
1353
+
1354
+ class OBX_sync_object(ctypes.Structure):
1355
+ _fields_ = [
1356
+ ('type', ctypes.c_int), # OBXSyncObjectType
1357
+ ('id', ctypes.c_uint64),
1358
+ ('data', ctypes.c_void_p),
1359
+ ('size', ctypes.c_size_t),
1360
+ ]
1361
+
1362
+
1363
+ class OBX_sync_msg_objects(ctypes.Structure):
1364
+ _fields_ = [
1365
+ ('topic', ctypes.c_void_p),
1366
+ ('topic_size', ctypes.c_size_t),
1367
+ ('objects', ctypes.POINTER(OBX_sync_object)),
1368
+ ('count', ctypes.c_size_t),
1369
+ ]
1370
+
1371
+
1372
+ class OBX_sync_msg_objects_builder(ctypes.Structure):
1373
+ pass
1374
+
1375
+
1376
+ OBX_sync_msg_objects_builder_p = ctypes.POINTER(OBX_sync_msg_objects_builder)
1377
+
1378
+ # Define callback types for sync listeners
1379
+ OBX_sync_listener_connect_t = ctypes.CFUNCTYPE(None, ctypes.c_void_p)
1380
+ OBX_sync_listener_disconnect_t = ctypes.CFUNCTYPE(None, ctypes.c_void_p)
1381
+ OBX_sync_listener_login_t = ctypes.CFUNCTYPE(None, ctypes.c_void_p)
1382
+ OBX_sync_listener_login_failure_t = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_int) # arg, OBXSyncCode
1383
+ OBX_sync_listener_complete_t = ctypes.CFUNCTYPE(None, ctypes.c_void_p)
1384
+ OBX_sync_listener_error_t = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_int) # arg, OBXSyncError
1385
+ OBX_sync_listener_change_t = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.POINTER(OBX_sync_change_array))
1386
+ OBX_sync_listener_server_time_t = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_int64)
1387
+ OBX_sync_listener_msg_objects_t = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.POINTER(OBX_sync_msg_objects))
1388
+
1389
+ # OBX_sync* obx_sync(OBX_store* store, const char* server_url);
1390
+ obx_sync = c_fn("obx_sync", OBX_sync_p, [OBX_store_p, ctypes.c_char_p])
1391
+
1392
+ # OBX_sync* obx_sync_urls(OBX_store* store, const char* server_urls[], size_t server_urls_count);
1393
+ obx_sync_urls = c_fn("obx_sync_urls", OBX_sync_p, [OBX_store_p, ctypes.POINTER(ctypes.c_char_p), ctypes.c_size_t])
1394
+
1395
+ # Client options (like Java and Dart, clients are created via options: allows e.g. flags and certificate paths)
1396
+
1397
+ # OBX_sync_options* obx_sync_opt(OBX_store* store);
1398
+ obx_sync_opt = c_fn("obx_sync_opt", OBX_sync_options_p, [OBX_store_p])
1399
+
1400
+ # obx_err obx_sync_opt_add_url(OBX_sync_options* opt, const char* url);
1401
+ obx_sync_opt_add_url = c_fn_rc("obx_sync_opt_add_url", [OBX_sync_options_p, ctypes.c_char_p])
1402
+
1403
+ # obx_err obx_sync_opt_add_cert_path(OBX_sync_options* opt, const char* cert_path);
1404
+ obx_sync_opt_add_cert_path = c_fn_rc("obx_sync_opt_add_cert_path", [OBX_sync_options_p, ctypes.c_char_p])
1405
+
1406
+ # obx_err obx_sync_opt_flags(OBX_sync_options* opt, uint32_t flags);
1407
+ obx_sync_opt_flags = c_fn_rc("obx_sync_opt_flags", [OBX_sync_options_p, ctypes.c_uint32])
1408
+
1409
+ # OBX_sync* obx_sync_create(OBX_sync_options* opt); Always frees the options, also on errors
1410
+ obx_sync_create = c_fn("obx_sync_create", OBX_sync_p, [OBX_sync_options_p])
1411
+
1412
+ # void obx_sync_opt_free(OBX_sync_options* opt); Only for unused options (obx_sync_create() frees them)
1413
+ obx_sync_opt_free = c_fn("obx_sync_opt_free", None, [OBX_sync_options_p])
1414
+
1415
+ # Client Credentials
1416
+
1417
+ # obx_err obx_sync_credentials(OBX_sync* sync, OBXSyncCredentialsType type, const void* data, size_t size);
1418
+ obx_sync_credentials = c_fn_rc('obx_sync_credentials',
1419
+ [OBX_sync_p, OBXSyncCredentialsType, ctypes.c_void_p, ctypes.c_size_t])
1420
+
1421
+ # obx_err obx_sync_credentials_user_password(OBX_sync* sync, OBXSyncCredentialsType type, const char* username, const char* password);
1422
+ obx_sync_credentials_user_password = c_fn_rc('obx_sync_credentials_user_password',
1423
+ [OBX_sync_p, OBXSyncCredentialsType, ctypes.c_char_p,
1424
+ ctypes.c_char_p])
1425
+
1426
+ # obx_err obx_sync_credentials_add(OBX_sync* sync, OBXSyncCredentialsType type, const void* data, size_t size, bool complete);
1427
+ obx_sync_credentials_add = c_fn_rc('obx_sync_credentials_add',
1428
+ [OBX_sync_p, OBXSyncCredentialsType, ctypes.c_void_p, ctypes.c_size_t, ctypes.c_bool])
1429
+
1430
+ # obx_err obx_sync_credentials_add_user_password(OBX_sync* sync, OBXSyncCredentialsType type, const char* username, const char* password, bool complete);
1431
+ obx_sync_credentials_add_user_password = c_fn_rc('obx_sync_credentials_add_user_password',
1432
+ [OBX_sync_p, OBXSyncCredentialsType, ctypes.c_char_p, ctypes.c_char_p,
1433
+ ctypes.c_bool])
1434
+
1435
+ # Sync Control
1436
+
1437
+ # OBXSyncState obx_sync_state(OBX_sync* sync);
1438
+ obx_sync_state = c_fn('obx_sync_state', OBXSyncState, [OBX_sync_p])
1439
+
1440
+ # obx_err obx_sync_time_server(OBX_sync* sync, int64_t* out_timestamp_ns);
1441
+ obx_sync_time_server = c_fn_rc('obx_sync_time_server', [OBX_sync_p, ctypes.POINTER(ctypes.c_int64)])
1442
+
1443
+ # obx_err obx_sync_time_server_diff(OBX_sync* sync, int64_t* out_diff_ns);
1444
+ obx_sync_time_server_diff = c_fn_rc('obx_sync_time_server_diff', [OBX_sync_p, ctypes.POINTER(ctypes.c_int64)])
1445
+
1446
+ # obx_err obx_sync_stats_u64(OBX_sync* sync, OBXSyncStats counter_type, uint64_t* out_count);
1447
+ obx_sync_stats_u64 = c_fn_rc('obx_sync_stats_u64', [OBX_sync_p, ctypes.c_int, ctypes.POINTER(ctypes.c_uint64)])
1448
+
1449
+ # obx_err obx_sync_max_messages_in_flight(OBX_sync* sync, int value);
1450
+ obx_sync_max_messages_in_flight = c_fn_rc('obx_sync_max_messages_in_flight', [OBX_sync_p, ctypes.c_int])
1451
+
1452
+ # obx_err obx_sync_request_updates_mode(OBX_sync* sync, OBXRequestUpdatesMode mode);
1453
+ obx_sync_request_updates_mode = c_fn_rc('obx_sync_request_updates_mode', [OBX_sync_p, OBXRequestUpdatesMode])
1454
+
1455
+ # OBX_C_API obx_err obx_sync_updates_request(OBX_sync* sync, bool subscribe_for_pushes);
1456
+ obx_sync_updates_request = c_fn_rc_success('obx_sync_updates_request', [OBX_sync_p, ctypes.c_bool])
1457
+
1458
+ # OBX_C_API obx_err obx_sync_updates_cancel(OBX_sync* sync);
1459
+ obx_sync_updates_cancel = c_fn_rc_success('obx_sync_updates_cancel', [OBX_sync_p])
1460
+
1461
+ # obx_err obx_sync_start(OBX_sync* sync);
1462
+ obx_sync_start = c_fn_rc('obx_sync_start', [OBX_sync_p])
1463
+
1464
+ # obx_err obx_sync_stop(OBX_sync* sync);
1465
+ obx_sync_stop = c_fn_rc('obx_sync_stop', [OBX_sync_p])
1466
+
1467
+ # obx_err obx_sync_trigger_reconnect(OBX_sync* sync);
1468
+ obx_sync_trigger_reconnect = c_fn_rc_success('obx_sync_trigger_reconnect', [OBX_sync_p])
1469
+
1470
+ # int64_t obx_sync_clock_timestamp(uint64_t sync_clock_value);
1471
+ obx_sync_clock_timestamp = c_fn_nocheck('obx_sync_clock_timestamp', ctypes.c_int64, [ctypes.c_uint64])
1472
+
1473
+ # int64_t obx_sync_clock_timestamp_corrected(uint64_t sync_clock_value);
1474
+ obx_sync_clock_timestamp_corrected = c_fn_nocheck('obx_sync_clock_timestamp_corrected', ctypes.c_int64,
1475
+ [ctypes.c_uint64])
1476
+
1477
+ # uint32_t obx_sync_protocol_version();
1478
+ obx_sync_protocol_version = c_fn('obx_sync_protocol_version', ctypes.c_uint32, [])
1479
+
1480
+ # uint32_t obx_sync_protocol_version_server(OBX_sync* sync);
1481
+ # Note: no error check, 0 is a valid result (no server contact yet)
1482
+ obx_sync_protocol_version_server = c_fn_nocheck('obx_sync_protocol_version_server', ctypes.c_uint32, [OBX_sync_p])
1483
+
1484
+ # obx_err obx_sync_wait_for_logged_in_state(OBX_sync* sync, uint64_t timeout_millis);
1485
+ obx_sync_wait_for_logged_in_state = c_fn_rc_success('obx_sync_wait_for_logged_in_state',
1486
+ [OBX_sync_p, ctypes.c_uint64])
1487
+
1488
+ # obx_err obx_sync_close(OBX_sync* sync);
1489
+ obx_sync_close = c_fn_rc('obx_sync_close', [OBX_sync_p])
1490
+
1491
+ # Listener Callbacks
1492
+
1493
+ # void obx_sync_listener_connect(OBX_sync* sync, OBX_sync_listener_connect* listener, void* listener_arg);
1494
+ obx_sync_listener_connect = c_fn('obx_sync_listener_connect', None,
1495
+ [OBX_sync_p, OBX_sync_listener_connect_t, ctypes.c_void_p])
1496
+
1497
+ # void obx_sync_listener_disconnect(OBX_sync* sync, OBX_sync_listener_disconnect* listener, void* listener_arg);
1498
+ obx_sync_listener_disconnect = c_fn('obx_sync_listener_disconnect', None,
1499
+ [OBX_sync_p, OBX_sync_listener_disconnect_t, ctypes.c_void_p])
1500
+
1501
+ # void obx_sync_listener_login(OBX_sync* sync, OBX_sync_listener_login* listener, void* listener_arg);
1502
+ obx_sync_listener_login = c_fn('obx_sync_listener_login', None,
1503
+ [OBX_sync_p, OBX_sync_listener_login_t, ctypes.c_void_p])
1504
+
1505
+ # void obx_sync_listener_login_failure(OBX_sync* sync, OBX_sync_listener_login_failure* listener, void* listener_arg);
1506
+ obx_sync_listener_login_failure = c_fn('obx_sync_listener_login_failure', None,
1507
+ [OBX_sync_p, OBX_sync_listener_login_failure_t, ctypes.c_void_p])
1508
+
1509
+ # void obx_sync_listener_complete(OBX_sync* sync, OBX_sync_listener_complete* listener, void* listener_arg);
1510
+ obx_sync_listener_complete = c_fn('obx_sync_listener_complete', None,
1511
+ [OBX_sync_p, OBX_sync_listener_complete_t, ctypes.c_void_p])
1512
+
1513
+ # void obx_sync_listener_error(OBX_sync* sync, OBX_sync_listener_error* listener, void* listener_arg);
1514
+ obx_sync_listener_error = c_fn('obx_sync_listener_error', None,
1515
+ [OBX_sync_p, OBX_sync_listener_error_t, ctypes.c_void_p])
1516
+
1517
+ # void obx_sync_listener_change(OBX_sync* sync, OBX_sync_listener_change* listener, void* listener_arg);
1518
+ obx_sync_listener_change = c_fn('obx_sync_listener_change', None,
1519
+ [OBX_sync_p, OBX_sync_listener_change_t, ctypes.c_void_p])
1520
+
1521
+ # void obx_sync_listener_server_time(OBX_sync* sync, OBX_sync_listener_server_time* listener, void* listener_arg);
1522
+ obx_sync_listener_server_time = c_fn('obx_sync_listener_server_time', None,
1523
+ [OBX_sync_p, OBX_sync_listener_server_time_t, ctypes.c_void_p])
1524
+
1525
+ # Filter Variables
1526
+
1527
+ # obx_err obx_sync_filter_variables_put(OBX_sync* sync, const char* name, const char* value);
1528
+ obx_sync_filter_variables_put = c_fn_rc('obx_sync_filter_variables_put',
1529
+ [OBX_sync_p, c_char_p, c_char_p])
1530
+
1531
+ # obx_err obx_sync_filter_variables_remove(OBX_sync* sync, const char* name);
1532
+ obx_sync_filter_variables_remove = c_fn_rc('obx_sync_filter_variables_remove',
1533
+ [OBX_sync_p, c_char_p])
1534
+
1535
+ # obx_err obx_sync_filter_variables_remove_all(OBX_sync* sync);
1536
+ obx_sync_filter_variables_remove_all = c_fn_rc('obx_sync_filter_variables_remove_all',
1537
+ [OBX_sync_p])
1538
+
1539
+ # obx_err obx_sync_filter_variables_apply(OBX_sync* sync);
1540
+ obx_sync_filter_variables_apply = c_fn_rc('obx_sync_filter_variables_apply', [OBX_sync_p])
1541
+
1542
+ # OBX_C_API obx_err obx_sync_outgoing_message_count(OBX_sync* sync, uint64_t limit, uint64_t* out_count);
1543
+ obx_sync_outgoing_message_count = c_fn_rc('obx_sync_outgoing_message_count',
1544
+ [OBX_sync_p, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64)])
1545
+
1546
+ OBXFeature = ctypes.c_int
1547
+
1548
+ class Feature(IntEnum):
1549
+ ResultArray = 1 # Functions that are returning multiple results (e.g. multiple objects) can be only used if this is available.
1550
+ TimeSeries = 2 # TimeSeries support (date/date-nano companion ID and other time-series functionality).
1551
+ Sync = 3 # Sync client availability. Visit https://objectbox.io/sync for more details.
1552
+ DebugLog = 4 # Check whether debug log can be enabled during runtime.
1553
+ Admin = 5 # Admin UI including a database browser, user management, and more. Depends on HttpServer (if Admin is available HttpServer is too).
1554
+ Tree = 6 # Tree with special GraphQL support
1555
+ SyncServer = 7 # Sync server availability. Visit https://objectbox.io/sync for more details.
1556
+ WebSockets = 8 # Implicitly added by Sync or SyncServer; disable via NoWebSockets
1557
+ Cluster = 9 # Sync Server has cluster functionality. Implicitly added by SyncServer; disable via NoCluster
1558
+ HttpServer = 10 # Embedded HTTP server.
1559
+ GraphQL = 11 # Embedded GraphQL server (via HTTP). Depends on HttpServer (if GraphQL is available HttpServer is too).
1560
+ Backup = 12 # Database Backup functionality; typically only enabled in Sync Server builds.
1561
+ Lmdb = 13 # The default database "provider"; writes data persistently to disk (ACID).
1562
+ VectorSearch = 14 # Vector search functionality; enables indexing for nearest neighbor search.
1563
+ Wal = 15 # WAL (write-ahead logging).
1564
+ SyncMongoDb = 16 # Sync connector to integrate MongoDB with SyncServer.
1565
+ Auth = 17 # Enables additional authentication/authorization methods for sync login, e.g.
1566
+ Trial = 18 # This is a free trial version; only applies to server builds (no trial builds for database and Sync clients).
1567
+ SyncFilters = 19 # Server-side filters to return individual data for each sync user (user-specific data).
1568
+
1569
+
1570
+ # bool obx_has_feature(OBXFeature feature);
1571
+ # Note: no error check, False is a valid result
1572
+ obx_has_feature = c_fn_nocheck('obx_has_feature', ctypes.c_bool, [OBXFeature])