@@ -253,115 +253,6 @@ class OBX_query(ctypes.Structure):
253253
254254OBX_query_p = ctypes .POINTER (OBX_query )
255255
256-
257- # Sync types
258- class OBX_sync (ctypes .Structure ):
259- pass
260-
261-
262- OBX_sync_p = ctypes .POINTER (OBX_sync )
263-
264-
265- class OBX_sync_server (ctypes .Structure ):
266- pass
267-
268-
269- OBX_sync_server_p = ctypes .POINTER (OBX_sync_server )
270-
271- OBXSyncCredentialsType = ctypes .c_int
272- OBXRequestUpdatesMode = ctypes .c_int
273- OBXSyncState = ctypes .c_int
274- OBXSyncCode = ctypes .c_int
275-
276- class SyncCredentialsType (IntEnum ):
277- NONE = 1
278- SHARED_SECRET = 2 # Deprecated, use SHARED_SECRET_SIPPED instead
279- GOOGLE_AUTH = 3
280- SHARED_SECRET_SIPPED = 4 # Uses shared secret to create a hashed credential
281- OBX_ADMIN_USER = 5 # ObjectBox admin users (username/password)
282- USER_PASSWORD = 6 # Generic credential type for admin users
283- JWT_ID = 7 # JSON Web Token (JWT): ID token with user identity
284- JWT_ACCESS = 8 # JSON Web Token (JWT): access token for resources
285- JWT_REFRESH = 9 # JSON Web Token (JWT): refresh token
286- JWT_CUSTOM = 10 # JSON Web Token (JWT): custom token type
287-
288-
289- class RequestUpdatesMode (IntEnum ):
290- MANUAL = 0 # No updates by default, must call obx_sync_updates_request() manually
291- AUTO = 1 # Same as calling obx_sync_updates_request(sync, TRUE)
292- AUTO_NO_PUSHES = 2 # Same as calling obx_sync_updates_request(sync, FALSE)
293-
294-
295- class SyncState (IntEnum ):
296- CREATED = 1
297- STARTED = 2
298- CONNECTED = 3
299- LOGGED_IN = 4
300- DISCONNECTED = 5
301- STOPPED = 6
302- DEAD = 7
303-
304- class OBXSyncError (IntEnum ):
305- REJECT_TX_NO_PERMISSION = 1 # Sync client received rejection of transaction writes due to missing permissions
306-
307-
308- class OBXSyncObjectType (IntEnum ):
309- FlatBuffers = 1
310- String = 2
311- Raw = 3
312-
313-
314- class OBX_sync_change (ctypes .Structure ):
315- _fields_ = [
316- ('entity_id' , obx_schema_id ),
317- ('puts' , ctypes .POINTER (OBX_id_array )),
318- ('removals' , ctypes .POINTER (OBX_id_array )),
319- ]
320-
321-
322- class OBX_sync_change_array (ctypes .Structure ):
323- _fields_ = [
324- ('list' , ctypes .POINTER (OBX_sync_change )),
325- ('count' , ctypes .c_size_t ),
326- ]
327-
328-
329- class OBX_sync_object (ctypes .Structure ):
330- _fields_ = [
331- ('type' , ctypes .c_int ), # OBXSyncObjectType
332- ('id' , ctypes .c_uint64 ),
333- ('data' , ctypes .c_void_p ),
334- ('size' , ctypes .c_size_t ),
335- ]
336-
337-
338- class OBX_sync_msg_objects (ctypes .Structure ):
339- _fields_ = [
340- ('topic' , ctypes .c_void_p ),
341- ('topic_size' , ctypes .c_size_t ),
342- ('objects' , ctypes .POINTER (OBX_sync_object )),
343- ('count' , ctypes .c_size_t ),
344- ]
345-
346-
347- class OBX_sync_msg_objects_builder (ctypes .Structure ):
348- pass
349-
350-
351- OBX_sync_msg_objects_builder_p = ctypes .POINTER (OBX_sync_msg_objects_builder )
352-
353- # Define callback types for sync listeners
354- OBX_sync_listener_connect = ctypes .CFUNCTYPE (None , ctypes .c_void_p )
355- OBX_sync_listener_disconnect = ctypes .CFUNCTYPE (None , ctypes .c_void_p )
356- OBX_sync_listener_login = ctypes .CFUNCTYPE (None , ctypes .c_void_p )
357- OBX_sync_listener_login_failure = ctypes .CFUNCTYPE (None , ctypes .c_void_p , ctypes .c_int ) # arg, OBXSyncCode
358- OBX_sync_listener_complete = ctypes .CFUNCTYPE (None , ctypes .c_void_p )
359- OBX_sync_listener_error = ctypes .CFUNCTYPE (None , ctypes .c_void_p , ctypes .c_int ) # arg, OBXSyncError
360- OBX_sync_listener_change = ctypes .CFUNCTYPE (None , ctypes .c_void_p , ctypes .POINTER (OBX_sync_change_array ))
361- OBX_sync_listener_server_time = ctypes .CFUNCTYPE (None , ctypes .c_void_p , ctypes .c_int64 )
362- OBX_sync_listener_msg_objects = ctypes .CFUNCTYPE (None , ctypes .c_void_p , ctypes .POINTER (OBX_sync_msg_objects ))
363-
364-
365256# manually configure error methods, we can't use `fn()` defined below yet due to circular dependencies
366257C .obx_last_error_message .restype = ctypes .c_char_p
367258C .obx_last_error_code .restype = obx_err
@@ -1193,47 +1084,206 @@ def c_array_pointer(py_list: Union[List[Any], np.ndarray], c_type):
11931084OBXBackupRestoreFlags_None = 0
11941085OBXBackupRestoreFlags_OverwriteExistingData = 1
11951086
1087+
1088+ # Sync API
1089+
1090+ class OBX_sync (ctypes .Structure ):
1091+ pass
1092+
1093+
1094+ OBX_sync_p = ctypes .POINTER (OBX_sync )
1095+
1096+
1097+ class OBX_sync_server (ctypes .Structure ):
1098+ pass
1099+
1100+
1101+ OBX_sync_server_p = ctypes .POINTER (OBX_sync_server )
1102+
1103+ OBXSyncCredentialsType = ctypes .c_int
1104+ OBXRequestUpdatesMode = ctypes .c_int
1105+ OBXSyncState = ctypes .c_int
1106+ OBXSyncCode = ctypes .c_int
1107+
1108+
1109+ class SyncCredentialsType (IntEnum ):
1110+ NONE = 1
1111+ SHARED_SECRET = 2 # Deprecated, use SHARED_SECRET_SIPPED instead
1112+ GOOGLE_AUTH = 3
1113+ SHARED_SECRET_SIPPED = 4 # Uses shared secret to create a hashed credential
1114+ OBX_ADMIN_USER = 5 # ObjectBox admin users (username/password)
1115+ USER_PASSWORD = 6 # Generic credential type for admin users
1116+ JWT_ID = 7 # JSON Web Token (JWT): ID token with user identity
1117+ JWT_ACCESS = 8 # JSON Web Token (JWT): access token for resources
1118+ JWT_REFRESH = 9 # JSON Web Token (JWT): refresh token
1119+ JWT_CUSTOM = 10 # JSON Web Token (JWT): custom token type
1120+
1121+
1122+ class RequestUpdatesMode (IntEnum ):
1123+ MANUAL = 0 # No updates by default, must call obx_sync_updates_request() manually
1124+ AUTO = 1 # Same as calling obx_sync_updates_request(sync, TRUE)
1125+ AUTO_NO_PUSHES = 2 # Same as calling obx_sync_updates_request(sync, FALSE)
1126+
1127+
1128+ class SyncState (IntEnum ):
1129+ CREATED = 1
1130+ STARTED = 2
1131+ CONNECTED = 3
1132+ LOGGED_IN = 4
1133+ DISCONNECTED = 5
1134+ STOPPED = 6
1135+ DEAD = 7
1136+
1137+
1138+ class OBXSyncError (IntEnum ):
1139+ REJECT_TX_NO_PERMISSION = 1 # Sync client received rejection of transaction writes due to missing permissions
1140+
1141+
1142+ class OBXSyncObjectType (IntEnum ):
1143+ FlatBuffers = 1
1144+ String = 2
1145+ Raw = 3
1146+
1147+
1148+ class OBX_sync_change (ctypes .Structure ):
1149+ _fields_ = [
1150+ ('entity_id' , obx_schema_id ),
1151+ ('puts' , ctypes .POINTER (OBX_id_array )),
1152+ ('removals' , ctypes .POINTER (OBX_id_array )),
1153+ ]
1154+
1155+
1156+ class OBX_sync_change_array (ctypes .Structure ):
1157+ _fields_ = [
1158+ ('list' , ctypes .POINTER (OBX_sync_change )),
1159+ ('count' , ctypes .c_size_t ),
1160+ ]
1161+
1162+
1163+ class OBX_sync_object (ctypes .Structure ):
1164+ _fields_ = [
1165+ ('type' , ctypes .c_int ), # OBXSyncObjectType
1166+ ('id' , ctypes .c_uint64 ),
1167+ ('data' , ctypes .c_void_p ),
1168+ ('size' , ctypes .c_size_t ),
1169+ ]
1170+
1171+
1172+ class OBX_sync_msg_objects (ctypes .Structure ):
1173+ _fields_ = [
1174+ ('topic' , ctypes .c_void_p ),
1175+ ('topic_size' , ctypes .c_size_t ),
1176+ ('objects' , ctypes .POINTER (OBX_sync_object )),
1177+ ('count' , ctypes .c_size_t ),
1178+ ]
1179+
1180+
1181+ class OBX_sync_msg_objects_builder (ctypes .Structure ):
1182+ pass
1183+
1184+
1185+ OBX_sync_msg_objects_builder_p = ctypes .POINTER (OBX_sync_msg_objects_builder )
1186+
1187+ # Define callback types for sync listeners
1188+ OBX_sync_listener_connect = ctypes .CFUNCTYPE (None , ctypes .c_void_p )
1189+ OBX_sync_listener_disconnect = ctypes .CFUNCTYPE (None , ctypes .c_void_p )
1190+ OBX_sync_listener_login = ctypes .CFUNCTYPE (None , ctypes .c_void_p )
1191+ OBX_sync_listener_login_failure = ctypes .CFUNCTYPE (None , ctypes .c_void_p , ctypes .c_int ) # arg, OBXSyncCode
1192+ OBX_sync_listener_complete = ctypes .CFUNCTYPE (None , ctypes .c_void_p )
1193+ OBX_sync_listener_error = ctypes .CFUNCTYPE (None , ctypes .c_void_p , ctypes .c_int ) # arg, OBXSyncError
1194+ OBX_sync_listener_change = ctypes .CFUNCTYPE (None , ctypes .c_void_p , ctypes .POINTER (OBX_sync_change_array ))
1195+ OBX_sync_listener_server_time = ctypes .CFUNCTYPE (None , ctypes .c_void_p , ctypes .c_int64 )
1196+ OBX_sync_listener_msg_objects = ctypes .CFUNCTYPE (None , ctypes .c_void_p , ctypes .POINTER (OBX_sync_msg_objects ))
1197+
1198+ # OBX_sync* obx_sync(OBX_store* store, const char* server_url);
11961199obx_sync = c_fn ("obx_sync" , OBX_sync_p , [OBX_store_p , ctypes .c_char_p ])
1200+
1201+ # OBX_sync* obx_sync_urls(OBX_store* store, const char* server_urls[], size_t server_urls_count);
11971202obx_sync_urls = c_fn ("obx_sync_urls" , OBX_sync_p , [OBX_store_p , ctypes .POINTER (ctypes .c_char_p ), ctypes .c_size_t ])
11981203
1204+ # Client Credentials
11991205
1206+ # obx_err obx_sync_credentials(OBX_sync* sync, OBXSyncCredentialsType type, const void* data, size_t size);
12001207obx_sync_credentials = c_fn_rc ('obx_sync_credentials' ,
12011208 [OBX_sync_p , OBXSyncCredentialsType , ctypes .c_void_p , ctypes .c_size_t ])
1209+
1210+ # obx_err obx_sync_credentials_user_password(OBX_sync* sync, OBXSyncCredentialsType type, const char* username, const char* password);
12021211obx_sync_credentials_user_password = c_fn_rc ('obx_sync_credentials_user_password' ,
12031212 [OBX_sync_p , OBXSyncCredentialsType , ctypes .c_char_p ,
12041213 ctypes .c_char_p ])
1214+
1215+ # obx_err obx_sync_credentials_add(OBX_sync* sync, OBXSyncCredentialsType type, const void* data, size_t size, bool complete);
12051216obx_sync_credentials_add = c_fn_rc ('obx_sync_credentials_add' ,
12061217 [OBX_sync_p , OBXSyncCredentialsType , ctypes .c_void_p , ctypes .c_size_t , ctypes .c_bool ])
1218+
1219+ # obx_err obx_sync_credentials_add_user_password(OBX_sync* sync, OBXSyncCredentialsType type, const char* username, const char* password, bool complete);
12071220obx_sync_credentials_add_user_password = c_fn_rc ('obx_sync_credentials_add_user_password' ,
12081221 [OBX_sync_p , OBXSyncCredentialsType , ctypes .c_char_p , ctypes .c_char_p ,
12091222 ctypes .c_bool ])
12101223
1224+ # Sync Control
1225+
1226+ # OBXSyncState obx_sync_state(OBX_sync* sync);
12111227obx_sync_state = c_fn ('obx_sync_state' , OBXSyncState , [OBX_sync_p ])
12121228
1229+ # obx_err obx_sync_request_updates_mode(OBX_sync* sync, OBXRequestUpdatesMode mode);
12131230obx_sync_request_updates_mode = c_fn_rc ('obx_sync_request_updates_mode' , [OBX_sync_p , OBXRequestUpdatesMode ])
12141231
1232+ # OBX_C_API obx_err obx_sync_updates_request(OBX_sync* sync, bool subscribe_for_pushes);
1233+ obx_sync_updates_request = c_fn_rc ('obx_sync_updates_request' , [OBX_sync_p , ctypes .c_bool ])
1234+
1235+ # OBX_C_API obx_err obx_sync_updates_cancel(OBX_sync* sync);
1236+ obx_sync_updates_cancel = c_fn_rc ('obx_sync_updates_cancel' , [OBX_sync_p ])
1237+
1238+ # obx_err obx_sync_start(OBX_sync* sync);
12151239obx_sync_start = c_fn_rc ('obx_sync_start' , [OBX_sync_p ])
1240+
1241+ # obx_err obx_sync_stop(OBX_sync* sync);
12161242obx_sync_stop = c_fn_rc ('obx_sync_stop' , [OBX_sync_p ])
12171243
1244+ # obx_err obx_sync_trigger_reconnect(OBX_sync* sync);
12181245obx_sync_trigger_reconnect = c_fn_rc ('obx_sync_trigger_reconnect' , [OBX_sync_p ])
12191246
1247+ # uint32_t obx_sync_protocol_version();
12201248obx_sync_protocol_version = c_fn ('obx_sync_protocol_version' , ctypes .c_uint32 , [])
1249+
1250+ # uint32_t obx_sync_protocol_version_server(OBX_sync* sync);
12211251obx_sync_protocol_version_server = c_fn ('obx_sync_protocol_version_server' , ctypes .c_uint32 , [OBX_sync_p ])
12221252
1253+ # obx_err obx_sync_wait_for_logged_in_state(OBX_sync* sync, uint64_t timeout_millis);
1254+ obx_sync_wait_for_logged_in_state = c_fn_rc ('obx_sync_wait_for_logged_in_state' , [OBX_sync_p , ctypes .c_uint64 ])
1255+
1256+ # obx_err obx_sync_close(OBX_sync* sync);
12231257obx_sync_close = c_fn_rc ('obx_sync_close' , [OBX_sync_p ])
12241258
1259+ # Listener Callbacks
1260+
1261+ # void obx_sync_listener_connect(OBX_sync* sync, OBX_sync_listener_connect* listener, void* listener_arg);
12251262obx_sync_listener_connect = c_fn ('obx_sync_listener_connect' , None , [OBX_sync_p , OBX_sync_listener_connect , ctypes .c_void_p ])
1263+
1264+ # void obx_sync_listener_disconnect(OBX_sync* sync, OBX_sync_listener_disconnect* listener, void* listener_arg);
12261265obx_sync_listener_disconnect = c_fn ('obx_sync_listener_disconnect' , None , [OBX_sync_p , OBX_sync_listener_disconnect , ctypes .c_void_p ])
1266+
1267+ # void obx_sync_listener_login(OBX_sync* sync, OBX_sync_listener_login* listener, void* listener_arg);
12271268obx_sync_listener_login = c_fn ('obx_sync_listener_login' , None , [OBX_sync_p , OBX_sync_listener_login , ctypes .c_void_p ])
1269+
1270+ # void obx_sync_listener_login_failure(OBX_sync* sync, OBX_sync_listener_login_failure* listener, void* listener_arg);
12281271obx_sync_listener_login_failure = c_fn ('obx_sync_listener_login_failure' , None , [OBX_sync_p , OBX_sync_listener_login_failure , ctypes .c_void_p ])
1272+
1273+ # void obx_sync_listener_complete(OBX_sync* sync, OBX_sync_listener_complete* listener, void* listener_arg);
12291274obx_sync_listener_error = c_fn ('obx_sync_listener_error' , None , [OBX_sync_p , OBX_sync_listener_error , ctypes .c_void_p ])
12301275
1231- obx_sync_wait_for_logged_in_state = c_fn_rc ( 'obx_sync_wait_for_logged_in_state' , [ OBX_sync_p , ctypes . c_uint64 ])
1276+ # Filter Variables
12321277
1278+ # obx_err obx_sync_filter_variables_put(OBX_sync* sync, const char* name, const char* value);
12331279obx_sync_filter_variables_put = c_fn_rc ('obx_sync_filter_variables_put' ,
12341280 [OBX_sync_p , c_char_p , c_char_p ])
1281+
1282+ # obx_err obx_sync_filter_variables_remove(OBX_sync* sync, const char* name);
12351283obx_sync_filter_variables_remove = c_fn_rc ('obx_sync_filter_variables_remove' ,
12361284 [OBX_sync_p , c_char_p ])
1285+
1286+ # obx_err obx_sync_filter_variables_remove_all(OBX_sync* sync);
12371287obx_sync_filter_variables_remove_all = c_fn_rc ('obx_sync_filter_variables_remove_all' ,
12381288 [OBX_sync_p ])
12391289
@@ -1243,33 +1293,27 @@ def c_array_pointer(py_list: Union[List[Any], np.ndarray], c_type):
12431293
12441294OBXFeature = ctypes .c_int
12451295
1246-
12471296class Feature (IntEnum ):
1248- ResultArray = 1
1249- TimeSeries = 2
1250- Sync = 3
1251- DebugLog = 4
1252- Admin = 5
1253- Tree = 6
1254- SyncServer = 7
1255- WebSockets = 8
1256- Cluster = 9
1257- HttpServer = 10
1258- GraphQL = 11
1259- Backup = 12
1260- Lmdb = 13
1261- VectorSearch = 14
1262- Wal = 15
1263- SyncMongoDb = 16
1264- Auth = 17
1265- Trial = 18
1266- SyncFilters = 19
1267-
1268-
1297+ ResultArray = 1 # Functions that are returning multiple results (e.g. multiple objects) can be only used if this is available.
1298+ TimeSeries = 2 # TimeSeries support (date/date-nano companion ID and other time-series functionality).
1299+ Sync = 3 # Sync client availability. Visit https://objectbox.io/sync for more details.
1300+ DebugLog = 4 # Check whether debug log can be enabled during runtime.
1301+ Admin = 5 # Admin UI including a database browser, user management, and more. Depends on HttpServer (if Admin is available HttpServer is too).
1302+ Tree = 6 # Tree with special GraphQL support
1303+ SyncServer = 7 # Sync server availability. Visit https://objectbox.io/sync for more details.
1304+ WebSockets = 8 # Implicitly added by Sync or SyncServer; disable via NoWebSockets
1305+ Cluster = 9 # Sync Server has cluster functionality. Implicitly added by SyncServer; disable via NoCluster
1306+ HttpServer = 10 # Embedded HTTP server.
1307+ GraphQL = 11 # Embedded GraphQL server (via HTTP). Depends on HttpServer (if GraphQL is available HttpServer is too).
1308+ Backup = 12 # Database Backup functionality; typically only enabled in Sync Server builds.
1309+ Lmdb = 13 # The default database "provider"; writes data persistently to disk (ACID).
1310+ VectorSearch = 14 # Vector search functionality; enables indexing for nearest neighbor search.
1311+ Wal = 15 # WAL (write-ahead logging).
1312+ SyncMongoDb = 16 # Sync connector to integrate MongoDB with SyncServer.
1313+ Auth = 17 # Enables additional authentication/authorization methods for sync login, e.g.
1314+ Trial = 18 # This is a free trial version; only applies to server builds (no trial builds for database and Sync clients).
1315+ SyncFilters = 19 # Server-side filters to return individual data for each sync user (user-specific data).
1316+
1317+
1318+ # bool obx_has_feature(OBXFeature feature);
12691319obx_has_feature = c_fn ('obx_has_feature' , ctypes .c_bool , [OBXFeature ])
1270-
1271- # OBX_C_API obx_err obx_sync_updates_request(OBX_sync* sync, bool subscribe_for_pushes);
1272- obx_sync_updates_request = c_fn_rc ('obx_sync_updates_request' , [OBX_sync_p , ctypes .c_bool ])
1273-
1274- # OBX_C_API obx_err obx_sync_updates_cancel(OBX_sync* sync);
1275- obx_sync_updates_cancel = c_fn_rc ('obx_sync_updates_cancel' , [OBX_sync_p ])
0 commit comments