@dittolive/ditto 4.4.4 → 4.5.0
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.
- package/DittoReactNative.podspec +27 -0
- package/README.md +68 -51
- package/node/ditto.cjs.js +1639 -851
- package/node/ditto.darwin-arm64.node +0 -0
- package/node/ditto.darwin-x64.node +0 -0
- package/node/ditto.linux-arm.node +0 -0
- package/node/ditto.linux-x64.node +0 -0
- package/node/ditto.win32-x64.node +0 -0
- package/node/transports.darwin-arm64.node +0 -0
- package/node/transports.darwin-x64.node +0 -0
- package/package.json +34 -38
- package/react-native/android/CMakeLists.txt +37 -0
- package/react-native/android/build.gradle +203 -0
- package/react-native/android/cpp-adapter.cpp +254 -0
- package/react-native/android/gradle.properties +5 -0
- package/react-native/android/src/main/AndroidManifest.xml +4 -0
- package/react-native/android/src/main/java/com/dittolive/rnsdk/DittoRNSDKModule.java +85 -0
- package/react-native/android/src/main/java/com/dittolive/rnsdk/DittoRNSDKPackage.java +28 -0
- package/react-native/boost/boost/assert.hpp +85 -0
- package/react-native/boost/boost/config/abi/borland_prefix.hpp +27 -0
- package/react-native/boost/boost/config/abi/borland_suffix.hpp +12 -0
- package/react-native/boost/boost/config/abi/msvc_prefix.hpp +22 -0
- package/react-native/boost/boost/config/abi/msvc_suffix.hpp +8 -0
- package/react-native/boost/boost/config/abi_prefix.hpp +25 -0
- package/react-native/boost/boost/config/abi_suffix.hpp +25 -0
- package/react-native/boost/boost/config/assert_cxx03.hpp +211 -0
- package/react-native/boost/boost/config/assert_cxx11.hpp +209 -0
- package/react-native/boost/boost/config/assert_cxx14.hpp +47 -0
- package/react-native/boost/boost/config/assert_cxx17.hpp +62 -0
- package/react-native/boost/boost/config/assert_cxx20.hpp +59 -0
- package/react-native/boost/boost/config/assert_cxx98.hpp +23 -0
- package/react-native/boost/boost/config/auto_link.hpp +525 -0
- package/react-native/boost/boost/config/compiler/borland.hpp +339 -0
- package/react-native/boost/boost/config/compiler/clang.hpp +366 -0
- package/react-native/boost/boost/config/compiler/clang_version.hpp +83 -0
- package/react-native/boost/boost/config/compiler/codegear.hpp +385 -0
- package/react-native/boost/boost/config/compiler/comeau.hpp +59 -0
- package/react-native/boost/boost/config/compiler/common_edg.hpp +183 -0
- package/react-native/boost/boost/config/compiler/compaq_cxx.hpp +19 -0
- package/react-native/boost/boost/config/compiler/cray.hpp +446 -0
- package/react-native/boost/boost/config/compiler/diab.hpp +26 -0
- package/react-native/boost/boost/config/compiler/digitalmars.hpp +143 -0
- package/react-native/boost/boost/config/compiler/gcc.hpp +383 -0
- package/react-native/boost/boost/config/compiler/gcc_xml.hpp +114 -0
- package/react-native/boost/boost/config/compiler/greenhills.hpp +28 -0
- package/react-native/boost/boost/config/compiler/hp_acc.hpp +149 -0
- package/react-native/boost/boost/config/compiler/intel.hpp +577 -0
- package/react-native/boost/boost/config/compiler/kai.hpp +33 -0
- package/react-native/boost/boost/config/compiler/metrowerks.hpp +198 -0
- package/react-native/boost/boost/config/compiler/mpw.hpp +140 -0
- package/react-native/boost/boost/config/compiler/nvcc.hpp +61 -0
- package/react-native/boost/boost/config/compiler/pathscale.hpp +138 -0
- package/react-native/boost/boost/config/compiler/pgi.hpp +23 -0
- package/react-native/boost/boost/config/compiler/sgi_mipspro.hpp +29 -0
- package/react-native/boost/boost/config/compiler/sunpro_cc.hpp +222 -0
- package/react-native/boost/boost/config/compiler/vacpp.hpp +186 -0
- package/react-native/boost/boost/config/compiler/visualc.hpp +391 -0
- package/react-native/boost/boost/config/compiler/xlcpp.hpp +299 -0
- package/react-native/boost/boost/config/compiler/xlcpp_zos.hpp +173 -0
- package/react-native/boost/boost/config/detail/cxx_composite.hpp +203 -0
- package/react-native/boost/boost/config/detail/posix_features.hpp +95 -0
- package/react-native/boost/boost/config/detail/select_compiler_config.hpp +157 -0
- package/react-native/boost/boost/config/detail/select_platform_config.hpp +147 -0
- package/react-native/boost/boost/config/detail/select_stdlib_config.hpp +121 -0
- package/react-native/boost/boost/config/detail/suffix.hpp +1294 -0
- package/react-native/boost/boost/config/header_deprecated.hpp +26 -0
- package/react-native/boost/boost/config/helper_macros.hpp +37 -0
- package/react-native/boost/boost/config/no_tr1/cmath.hpp +28 -0
- package/react-native/boost/boost/config/no_tr1/complex.hpp +28 -0
- package/react-native/boost/boost/config/no_tr1/functional.hpp +28 -0
- package/react-native/boost/boost/config/no_tr1/memory.hpp +28 -0
- package/react-native/boost/boost/config/no_tr1/utility.hpp +28 -0
- package/react-native/boost/boost/config/platform/aix.hpp +33 -0
- package/react-native/boost/boost/config/platform/amigaos.hpp +15 -0
- package/react-native/boost/boost/config/platform/beos.hpp +26 -0
- package/react-native/boost/boost/config/platform/bsd.hpp +83 -0
- package/react-native/boost/boost/config/platform/cloudabi.hpp +18 -0
- package/react-native/boost/boost/config/platform/cray.hpp +18 -0
- package/react-native/boost/boost/config/platform/cygwin.hpp +71 -0
- package/react-native/boost/boost/config/platform/haiku.hpp +31 -0
- package/react-native/boost/boost/config/platform/hpux.hpp +87 -0
- package/react-native/boost/boost/config/platform/irix.hpp +31 -0
- package/react-native/boost/boost/config/platform/linux.hpp +106 -0
- package/react-native/boost/boost/config/platform/macos.hpp +87 -0
- package/react-native/boost/boost/config/platform/qnxnto.hpp +31 -0
- package/react-native/boost/boost/config/platform/solaris.hpp +31 -0
- package/react-native/boost/boost/config/platform/symbian.hpp +97 -0
- package/react-native/boost/boost/config/platform/vms.hpp +25 -0
- package/react-native/boost/boost/config/platform/vxworks.hpp +422 -0
- package/react-native/boost/boost/config/platform/wasm.hpp +23 -0
- package/react-native/boost/boost/config/platform/win32.hpp +90 -0
- package/react-native/boost/boost/config/platform/zos.hpp +32 -0
- package/react-native/boost/boost/config/pragma_message.hpp +31 -0
- package/react-native/boost/boost/config/requires_threads.hpp +92 -0
- package/react-native/boost/boost/config/stdlib/dinkumware.hpp +324 -0
- package/react-native/boost/boost/config/stdlib/libcomo.hpp +93 -0
- package/react-native/boost/boost/config/stdlib/libcpp.hpp +180 -0
- package/react-native/boost/boost/config/stdlib/libstdcpp3.hpp +482 -0
- package/react-native/boost/boost/config/stdlib/modena.hpp +79 -0
- package/react-native/boost/boost/config/stdlib/msl.hpp +98 -0
- package/react-native/boost/boost/config/stdlib/roguewave.hpp +208 -0
- package/react-native/boost/boost/config/stdlib/sgi.hpp +168 -0
- package/react-native/boost/boost/config/stdlib/stlport.hpp +258 -0
- package/react-native/boost/boost/config/stdlib/vacpp.hpp +74 -0
- package/react-native/boost/boost/config/stdlib/xlcpp_zos.hpp +61 -0
- package/react-native/boost/boost/config/user.hpp +133 -0
- package/react-native/boost/boost/config/warning_disable.hpp +47 -0
- package/react-native/boost/boost/config/workaround.hpp +305 -0
- package/react-native/boost/boost/config.hpp +67 -0
- package/react-native/boost/boost/cstdint.hpp +556 -0
- package/react-native/boost/boost/intrusive_ptr.hpp +18 -0
- package/react-native/boost/boost/smart_ptr/detail/atomic_count.hpp +103 -0
- package/react-native/boost/boost/smart_ptr/detail/atomic_count_gcc.hpp +79 -0
- package/react-native/boost/boost/smart_ptr/detail/atomic_count_gcc_atomic.hpp +63 -0
- package/react-native/boost/boost/smart_ptr/detail/atomic_count_gcc_x86.hpp +88 -0
- package/react-native/boost/boost/smart_ptr/detail/atomic_count_nt.hpp +66 -0
- package/react-native/boost/boost/smart_ptr/detail/atomic_count_pt.hpp +104 -0
- package/react-native/boost/boost/smart_ptr/detail/atomic_count_spin.hpp +69 -0
- package/react-native/boost/boost/smart_ptr/detail/atomic_count_std_atomic.hpp +67 -0
- package/react-native/boost/boost/smart_ptr/detail/atomic_count_sync.hpp +72 -0
- package/react-native/boost/boost/smart_ptr/detail/atomic_count_win32.hpp +70 -0
- package/react-native/boost/boost/smart_ptr/detail/local_counted_base.hpp +148 -0
- package/react-native/boost/boost/smart_ptr/detail/local_sp_deleter.hpp +91 -0
- package/react-native/boost/boost/smart_ptr/detail/operator_bool.hpp +64 -0
- package/react-native/boost/boost/smart_ptr/detail/requires_cxx11.hpp +23 -0
- package/react-native/boost/boost/smart_ptr/detail/shared_count.hpp +707 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_convertible.hpp +92 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_base.hpp +92 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp +163 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_aix.hpp +152 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp +185 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_gcc_atomic.hpp +148 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp +170 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp +200 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp +194 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp +179 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp +186 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_nt.hpp +119 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_pt.hpp +147 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp +174 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_spin.hpp +141 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp +147 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_sync.hpp +165 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp +163 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_w32.hpp +140 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_impl.hpp +309 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_disable_deprecated.hpp +40 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_forward.hpp +52 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_has_gcc_intrinsics.hpp +27 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_has_sync_intrinsics.hpp +69 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_interlocked.hpp +173 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_noexcept.hpp +48 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_nullptr_t.hpp +45 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_obsolete.hpp +32 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_thread_pause.hpp +51 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_thread_sleep.hpp +104 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_thread_yield.hpp +100 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_typeinfo_.hpp +58 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_win32_sleep.hpp +49 -0
- package/react-native/boost/boost/smart_ptr/intrusive_ptr.hpp +409 -0
- package/react-native/boost/boost/smart_ptr/intrusive_ref_counter.hpp +188 -0
- package/react-native/cpp/include/Attachment.h +16 -0
- package/react-native/cpp/include/Authentication.h +23 -0
- package/react-native/cpp/include/Collection.h +13 -0
- package/react-native/cpp/include/DQL.h +21 -0
- package/react-native/cpp/include/Document.h +17 -0
- package/react-native/cpp/include/Identity.h +17 -0
- package/react-native/cpp/include/Lifecycle.h +16 -0
- package/react-native/cpp/include/LiveQuery.h +17 -0
- package/react-native/cpp/include/Logger.h +22 -0
- package/react-native/cpp/include/Misc.h +26 -0
- package/react-native/cpp/include/Presence.h +14 -0
- package/react-native/cpp/include/RetainableState.h +24 -0
- package/react-native/cpp/include/SmallPeerInfo.h +17 -0
- package/react-native/cpp/include/Transports.h +25 -0
- package/react-native/cpp/include/TypedArray.hpp +167 -0
- package/react-native/cpp/include/Utils.h +61 -0
- package/react-native/cpp/include/main.h +10 -0
- package/react-native/cpp/src/Attachment.cpp +86 -0
- package/react-native/cpp/src/Authentication.cpp +224 -0
- package/react-native/cpp/src/Collection.cpp +54 -0
- package/react-native/cpp/src/DQL.cpp +254 -0
- package/react-native/cpp/src/Document.cpp +146 -0
- package/react-native/cpp/src/Identity.cpp +123 -0
- package/react-native/cpp/src/Lifecycle.cpp +75 -0
- package/react-native/cpp/src/LiveQuery.cpp +64 -0
- package/react-native/cpp/src/Logger.cpp +200 -0
- package/react-native/cpp/src/Misc.cpp +271 -0
- package/react-native/cpp/src/Presence.cpp +77 -0
- package/react-native/cpp/src/RetainableState.cpp +15 -0
- package/react-native/cpp/src/SmallPeerInfo.cpp +108 -0
- package/react-native/cpp/src/Transports.cpp +270 -0
- package/react-native/cpp/src/TypedArray.cpp +303 -0
- package/react-native/cpp/src/Utils.cpp +138 -0
- package/react-native/cpp/src/main.cpp +149 -0
- package/react-native/dittoffi/dittoffi.h +4698 -0
- package/react-native/dittoffi/ifaddrs.cpp +385 -0
- package/react-native/dittoffi/ifaddrs.h +206 -0
- package/react-native/ios/DittoRNSDK.h +7 -0
- package/react-native/ios/DittoRNSDK.mm +107 -0
- package/react-native/ios/YeetJSIUtils.h +60 -0
- package/react-native/ios/YeetJSIUtils.mm +196 -0
- package/react-native/lib/commonjs/ditto.rn.js +93 -0
- package/react-native/lib/commonjs/ditto.rn.js.map +1 -0
- package/react-native/lib/commonjs/index.js +14 -0
- package/react-native/lib/commonjs/index.js.map +1 -0
- package/react-native/lib/module/ditto.rn.js +83 -0
- package/react-native/lib/module/ditto.rn.js.map +1 -0
- package/react-native/lib/module/index.js +13 -0
- package/react-native/lib/module/index.js.map +1 -0
- package/react-native/lib/typescript/ditto.rn.d.ts +15 -0
- package/react-native/lib/typescript/ditto.rn.d.ts.map +1 -0
- package/react-native/lib/typescript/index.d.ts +1 -0
- package/react-native/lib/typescript/index.d.ts.map +1 -0
- package/react-native/scripts/ruby/include_local_boost.rb +78 -0
- package/react-native/src/ditto.rn.ts +91 -0
- package/react-native/src/environment/environment.fallback.ts +4 -0
- package/react-native/src/index.ts +26 -0
- package/react-native/src/sources/@cbor-redux.ts +2 -0
- package/react-native/src/sources/@ditto.core.ts +1 -0
- package/react-native/src/sources/@environment.ts +2 -0
- package/react-native/src/sources/attachment-fetch-event.ts +54 -0
- package/react-native/src/sources/attachment-fetcher-manager.ts +129 -0
- package/react-native/src/sources/attachment-fetcher.ts +124 -0
- package/react-native/src/sources/attachment-token.ts +48 -0
- package/react-native/src/sources/attachment.ts +59 -0
- package/react-native/src/sources/augment.ts +89 -0
- package/react-native/src/sources/authenticator.ts +314 -0
- package/react-native/src/sources/base-pending-cursor-operation.ts +237 -0
- package/react-native/src/sources/base-pending-id-specific-operation.ts +109 -0
- package/react-native/src/sources/bridge.ts +549 -0
- package/react-native/src/sources/build-time-constants.ts +4 -0
- package/react-native/src/sources/cbor.ts +35 -0
- package/react-native/src/sources/collection-interface.ts +67 -0
- package/react-native/src/sources/collection.ts +212 -0
- package/react-native/src/sources/collections-event.ts +99 -0
- package/react-native/src/sources/counter.ts +77 -0
- package/react-native/src/sources/ditto.ts +945 -0
- package/react-native/src/sources/document-id.ts +159 -0
- package/react-native/src/sources/document-path.ts +303 -0
- package/react-native/src/sources/document.ts +192 -0
- package/react-native/src/sources/epilogue.ts +24 -0
- package/react-native/src/sources/error-codes.ts +52 -0
- package/react-native/src/sources/error.ts +203 -0
- package/react-native/src/sources/essentials.ts +53 -0
- package/react-native/src/sources/ffi-error.ts +117 -0
- package/react-native/src/sources/ffi.ts +1972 -0
- package/react-native/src/sources/identity.ts +163 -0
- package/react-native/src/sources/init.ts +70 -0
- package/react-native/src/sources/internal.ts +113 -0
- package/react-native/src/sources/keep-alive.ts +69 -0
- package/react-native/src/sources/key-path.ts +195 -0
- package/react-native/src/sources/live-query-event.ts +208 -0
- package/react-native/src/sources/live-query-manager.ts +101 -0
- package/react-native/src/sources/live-query.ts +164 -0
- package/react-native/src/sources/logger.ts +196 -0
- package/react-native/src/sources/observer-manager.ts +175 -0
- package/react-native/src/sources/observer.ts +77 -0
- package/react-native/src/sources/pending-collections-operation.ts +232 -0
- package/react-native/src/sources/pending-cursor-operation.ts +218 -0
- package/react-native/src/sources/pending-id-specific-operation.ts +216 -0
- package/react-native/src/sources/presence-manager.ts +160 -0
- package/react-native/src/sources/presence.ts +238 -0
- package/react-native/src/sources/query-result-item.ts +116 -0
- package/react-native/src/sources/query-result.ts +55 -0
- package/react-native/src/sources/register.ts +92 -0
- package/react-native/src/sources/small-peer-info.ts +176 -0
- package/react-native/src/sources/static-tcp-client.ts +6 -0
- package/react-native/src/sources/store-observer.ts +176 -0
- package/react-native/src/sources/store.ts +365 -0
- package/react-native/src/sources/subscription-manager.ts +98 -0
- package/react-native/src/sources/subscription.ts +88 -0
- package/react-native/src/sources/sync-subscription.ts +90 -0
- package/react-native/src/sources/sync.ts +495 -0
- package/react-native/src/sources/test-helpers.ts +24 -0
- package/react-native/src/sources/transport-conditions-manager.ts +104 -0
- package/react-native/src/sources/transport-config.ts +428 -0
- package/react-native/src/sources/update-result.ts +66 -0
- package/react-native/src/sources/update-results-map.ts +57 -0
- package/react-native/src/sources/websocket-client.ts +6 -0
- package/react-native/src/sources/write-transaction-collection.ts +122 -0
- package/react-native/src/sources/write-transaction-pending-cursor-operation.ts +101 -0
- package/react-native/src/sources/write-transaction-pending-id-specific-operation.ts +72 -0
- package/react-native/src/sources/write-transaction.ts +119 -0
- package/react-native.config.js +9 -0
- package/types/ditto.d.ts +1230 -798
- package/web/ditto.es6.js +1 -1
- package/web/ditto.umd.js +1 -1
- package/web/ditto.wasm +0 -0
|
@@ -0,0 +1,4698 @@
|
|
|
1
|
+
/*! \file */
|
|
2
|
+
/*******************************************
|
|
3
|
+
* *
|
|
4
|
+
* File auto-generated by `::safer_ffi`. *
|
|
5
|
+
* *
|
|
6
|
+
* Do not manually edit this file. *
|
|
7
|
+
* *
|
|
8
|
+
*******************************************/
|
|
9
|
+
|
|
10
|
+
#ifndef __RUST_DITTOFFI__
|
|
11
|
+
#define __RUST_DITTOFFI__
|
|
12
|
+
#ifdef __cplusplus
|
|
13
|
+
extern "C" {
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
#include <stddef.h>
|
|
18
|
+
#include <stdint.h>
|
|
19
|
+
|
|
20
|
+
/** \brief
|
|
21
|
+
* This enum contains all the Ditto types exposed publicly. The IDs **MUST**
|
|
22
|
+
* not be modified otherwise this would break the type conversions.
|
|
23
|
+
*
|
|
24
|
+
* CHECKME: When merging with Russell's work on explicit types, this enum may
|
|
25
|
+
* be duplicated.
|
|
26
|
+
*/
|
|
27
|
+
typedef enum DittoCrdtType {
|
|
28
|
+
/** <No documentation available> */
|
|
29
|
+
DITTO_CRDT_TYPE_COUNTER = 0,
|
|
30
|
+
/** <No documentation available> */
|
|
31
|
+
DITTO_CRDT_TYPE_REGISTER = 1,
|
|
32
|
+
/** <No documentation available> */
|
|
33
|
+
DITTO_CRDT_TYPE_ATTACHMENT = 2,
|
|
34
|
+
/** <No documentation available> */
|
|
35
|
+
DITTO_CRDT_TYPE_RGA = 3,
|
|
36
|
+
/** <No documentation available> */
|
|
37
|
+
DITTO_CRDT_TYPE_R_W_MAP = 4,
|
|
38
|
+
/** <No documentation available> */
|
|
39
|
+
DITTO_CRDT_TYPE_ST_COUNTER = 5,
|
|
40
|
+
/** <No documentation available> */
|
|
41
|
+
DITTO_CRDT_TYPE_A_W_SET = 6,
|
|
42
|
+
} DittoCrdtType_t;
|
|
43
|
+
|
|
44
|
+
/** \brief
|
|
45
|
+
* A short-lived FFI object to let an SDK handle an authentication request
|
|
46
|
+
* in an async manner.
|
|
47
|
+
*/
|
|
48
|
+
typedef struct CAuthServerAuthRequest CAuthServerAuthRequest_t;
|
|
49
|
+
|
|
50
|
+
/** <No documentation available> */
|
|
51
|
+
void
|
|
52
|
+
/* fn */ auth_server_auth_submit_with_error (
|
|
53
|
+
CAuthServerAuthRequest_t * req,
|
|
54
|
+
uint32_t _error_code);
|
|
55
|
+
|
|
56
|
+
/** \brief
|
|
57
|
+
* `&'lt [T]` but with a guaranteed `#[repr(C)]` layout.
|
|
58
|
+
*
|
|
59
|
+
* # C layout (for some given type T)
|
|
60
|
+
*
|
|
61
|
+
* ```c
|
|
62
|
+
* typedef struct {
|
|
63
|
+
* // Cannot be NULL
|
|
64
|
+
* T * ptr;
|
|
65
|
+
* size_t len;
|
|
66
|
+
* } slice_T;
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* # Nullable pointer?
|
|
70
|
+
*
|
|
71
|
+
* If you want to support the above typedef, but where the `ptr` field is
|
|
72
|
+
* allowed to be `NULL` (with the contents of `len` then being undefined)
|
|
73
|
+
* use the `Option< slice_ptr<_> >` type.
|
|
74
|
+
*/
|
|
75
|
+
typedef struct slice_ref_uint8 {
|
|
76
|
+
/** \brief
|
|
77
|
+
* Pointer to the first element (if any).
|
|
78
|
+
*/
|
|
79
|
+
uint8_t const * ptr;
|
|
80
|
+
|
|
81
|
+
/** \brief
|
|
82
|
+
* Element count
|
|
83
|
+
*/
|
|
84
|
+
size_t len;
|
|
85
|
+
} slice_ref_uint8_t;
|
|
86
|
+
|
|
87
|
+
/** <No documentation available> */
|
|
88
|
+
void
|
|
89
|
+
/* fn */ auth_server_auth_submit_with_success (
|
|
90
|
+
CAuthServerAuthRequest_t * req,
|
|
91
|
+
slice_ref_uint8_t success_cbor);
|
|
92
|
+
|
|
93
|
+
/** <No documentation available> */
|
|
94
|
+
typedef struct CAuthServerRefreshRequest CAuthServerRefreshRequest_t;
|
|
95
|
+
|
|
96
|
+
/** <No documentation available> */
|
|
97
|
+
void
|
|
98
|
+
/* fn */ auth_server_refresh_submit_with_error (
|
|
99
|
+
CAuthServerRefreshRequest_t * req,
|
|
100
|
+
uint32_t _error_code);
|
|
101
|
+
|
|
102
|
+
/** <No documentation available> */
|
|
103
|
+
void
|
|
104
|
+
/* fn */ auth_server_refresh_submit_with_success (
|
|
105
|
+
CAuthServerRefreshRequest_t * req,
|
|
106
|
+
slice_ref_uint8_t success_cbor);
|
|
107
|
+
|
|
108
|
+
/** \brief
|
|
109
|
+
* An opaque handle for each installed transport, heap-allocated and owned by
|
|
110
|
+
* the SDK.
|
|
111
|
+
*
|
|
112
|
+
* A pointer to this handle is used to send platform events over FFI. In the
|
|
113
|
+
* future this handle will be the SDK's only point of control over the
|
|
114
|
+
* transport once created. In particular, a transport will be removed by
|
|
115
|
+
* freeing the handle. The concept of online and offline will be eliminated.
|
|
116
|
+
* (i.e., if you don't want a transport, remove it.)
|
|
117
|
+
*
|
|
118
|
+
* For now, the `Peer` object holds the transports and provides an API based on
|
|
119
|
+
* a numeric id assigned to each transport instance. Until that is removed, the
|
|
120
|
+
* id still exists and the SDK can request it from the opaque handle over FFI.
|
|
121
|
+
*
|
|
122
|
+
* For each transport type, define an `extern "C"` function to free that
|
|
123
|
+
* specific monomorphisation of the `TransportHandle` using `Box::from_raw`,
|
|
124
|
+
* plus a function to retrieve the transport id, which will be removed later.
|
|
125
|
+
*
|
|
126
|
+
* Safety: The SDK owns the `TransportHandle`. It is responsible for ensuring
|
|
127
|
+
* that it does not use the pointer to the `TransportHandle` after freeing it
|
|
128
|
+
* with its respective function. In Rust we will assume it is okay to unsafely
|
|
129
|
+
* dereference a handle.
|
|
130
|
+
*
|
|
131
|
+
* The C interface of `TransportHandle` is thread-safe (`Send + Sync`).
|
|
132
|
+
*/
|
|
133
|
+
typedef struct TransportHandle_AwdlClientPlatformEvent TransportHandle_AwdlClientPlatformEvent_t;
|
|
134
|
+
|
|
135
|
+
/** \brief
|
|
136
|
+
* Generic enum used by crate and platforms to indicate a connection status
|
|
137
|
+
*/
|
|
138
|
+
typedef enum ConnectState {
|
|
139
|
+
/** <No documentation available> */
|
|
140
|
+
CONNECT_STATE_DISCONNECTED,
|
|
141
|
+
/** <No documentation available> */
|
|
142
|
+
CONNECT_STATE_CONNECTED,
|
|
143
|
+
/** <No documentation available> */
|
|
144
|
+
CONNECT_STATE_CONNECTING,
|
|
145
|
+
/** <No documentation available> */
|
|
146
|
+
CONNECT_STATE_DISCONNECTING,
|
|
147
|
+
} ConnectState_t;
|
|
148
|
+
|
|
149
|
+
/** \brief
|
|
150
|
+
* The platform advises Rust that a peer has changed its current connection
|
|
151
|
+
* status
|
|
152
|
+
*/
|
|
153
|
+
void
|
|
154
|
+
/* fn */ awdl_client_connect_state_changed (
|
|
155
|
+
TransportHandle_AwdlClientPlatformEvent_t const * handle,
|
|
156
|
+
char const * announce,
|
|
157
|
+
ConnectState_t state);
|
|
158
|
+
|
|
159
|
+
/** \brief
|
|
160
|
+
* The platform advises Rust that a complete message has been received from a
|
|
161
|
+
* remote peer
|
|
162
|
+
*/
|
|
163
|
+
void
|
|
164
|
+
/* fn */ awdl_client_data_available (
|
|
165
|
+
TransportHandle_AwdlClientPlatformEvent_t const * handle,
|
|
166
|
+
char const * announce);
|
|
167
|
+
|
|
168
|
+
/** \brief
|
|
169
|
+
* The SDK requests to drop its handle to the AWDL Client Transport
|
|
170
|
+
*
|
|
171
|
+
* At some point dropping this events channel will effectively shut down and
|
|
172
|
+
* remove the Transport. At time of writing, the Transport is still owned
|
|
173
|
+
* within Peer.
|
|
174
|
+
*/
|
|
175
|
+
void
|
|
176
|
+
/* fn */ awdl_client_free_handle (
|
|
177
|
+
TransportHandle_AwdlClientPlatformEvent_t * handle);
|
|
178
|
+
|
|
179
|
+
/** \brief
|
|
180
|
+
* The platform advises Rust that a peer has been identified. We know only its
|
|
181
|
+
* announce string.
|
|
182
|
+
*/
|
|
183
|
+
void
|
|
184
|
+
/* fn */ awdl_client_platform_peer_appeared (
|
|
185
|
+
TransportHandle_AwdlClientPlatformEvent_t const * handle,
|
|
186
|
+
char const * announce);
|
|
187
|
+
|
|
188
|
+
/** \brief
|
|
189
|
+
* The platform advises Rust that a peer has disappeared.
|
|
190
|
+
*/
|
|
191
|
+
void
|
|
192
|
+
/* fn */ awdl_client_platform_peer_disappeared (
|
|
193
|
+
TransportHandle_AwdlClientPlatformEvent_t const * handle,
|
|
194
|
+
char const * announce);
|
|
195
|
+
|
|
196
|
+
/** \brief
|
|
197
|
+
* The platform advises Rust that a given peer is now clear to queue up a new
|
|
198
|
+
* message whenever one is ready to go
|
|
199
|
+
*/
|
|
200
|
+
void
|
|
201
|
+
/* fn */ awdl_client_ready_to_send (
|
|
202
|
+
TransportHandle_AwdlClientPlatformEvent_t const * handle,
|
|
203
|
+
char const * announce);
|
|
204
|
+
|
|
205
|
+
/** \brief
|
|
206
|
+
* Generic enum used by crate and platforms to indicate online-ness.
|
|
207
|
+
*
|
|
208
|
+
* In other words, is something active or not? Not everything will use the
|
|
209
|
+
* transitional states.
|
|
210
|
+
*/
|
|
211
|
+
typedef enum OnlineState {
|
|
212
|
+
/** <No documentation available> */
|
|
213
|
+
ONLINE_STATE_OFFLINE,
|
|
214
|
+
/** <No documentation available> */
|
|
215
|
+
ONLINE_STATE_ONLINE,
|
|
216
|
+
/** <No documentation available> */
|
|
217
|
+
ONLINE_STATE_GOING_ONLINE,
|
|
218
|
+
/** <No documentation available> */
|
|
219
|
+
ONLINE_STATE_GOING_OFFLINE,
|
|
220
|
+
} OnlineState_t;
|
|
221
|
+
|
|
222
|
+
/** \brief
|
|
223
|
+
* A code reported by platforms/transports to indicate specific health
|
|
224
|
+
* conditions
|
|
225
|
+
*/
|
|
226
|
+
typedef enum TransportCondition {
|
|
227
|
+
/** \brief
|
|
228
|
+
* A default state. Only use this for transient conditions, e.g., we are
|
|
229
|
+
* waiting for a platform to finish starting up. If everything is just
|
|
230
|
+
* quiet, use `Ok`.
|
|
231
|
+
*/
|
|
232
|
+
TRANSPORT_CONDITION_UNKNOWN,
|
|
233
|
+
/** \brief
|
|
234
|
+
* No known problems.
|
|
235
|
+
*/
|
|
236
|
+
TRANSPORT_CONDITION_OK,
|
|
237
|
+
/** \brief
|
|
238
|
+
* Catch-all failure, particularly for unexpected/internal faults. If
|
|
239
|
+
* possible, add a new case that the customer will be able to
|
|
240
|
+
* interpret.
|
|
241
|
+
*/
|
|
242
|
+
TRANSPORT_CONDITION_GENERIC_FAILURE,
|
|
243
|
+
/** \brief
|
|
244
|
+
* App is in background.
|
|
245
|
+
*/
|
|
246
|
+
TRANSPORT_CONDITION_APP_IN_BACKGROUND,
|
|
247
|
+
/** \brief
|
|
248
|
+
* We are not able to publish or discover with the mDNS daemon.
|
|
249
|
+
*/
|
|
250
|
+
TRANSPORT_CONDITION_MDNS_FAILURE,
|
|
251
|
+
/** \brief
|
|
252
|
+
* We cannot bind to a port.
|
|
253
|
+
*/
|
|
254
|
+
TRANSPORT_CONDITION_TCP_LISTEN_FAILURE,
|
|
255
|
+
/** \brief
|
|
256
|
+
* No app permission to act as a BLE Central.
|
|
257
|
+
*/
|
|
258
|
+
TRANSPORT_CONDITION_NO_BLE_CENTRAL_PERMISSION,
|
|
259
|
+
/** \brief
|
|
260
|
+
* No app permission to act as a BLE Peripheral.
|
|
261
|
+
*/
|
|
262
|
+
TRANSPORT_CONDITION_NO_BLE_PERIPHERAL_PERMISSION,
|
|
263
|
+
/** \brief
|
|
264
|
+
* This Transport targets a particular peer and we can't reach them right
|
|
265
|
+
* now.
|
|
266
|
+
*/
|
|
267
|
+
TRANSPORT_CONDITION_CANNOT_ESTABLISH_CONNECTION,
|
|
268
|
+
/** \brief
|
|
269
|
+
* The device has Bluetooth disabled at the OS level.
|
|
270
|
+
*/
|
|
271
|
+
TRANSPORT_CONDITION_BLE_DISABLED,
|
|
272
|
+
/** \brief
|
|
273
|
+
* The device has no Bluetooth hardware.
|
|
274
|
+
*/
|
|
275
|
+
TRANSPORT_CONDITION_NO_BLE_HARDWARE,
|
|
276
|
+
/** \brief
|
|
277
|
+
* The device has Wifi disabled at the OS level.
|
|
278
|
+
*/
|
|
279
|
+
TRANSPORT_CONDITION_WIFI_DISABLED,
|
|
280
|
+
/** \brief
|
|
281
|
+
* The platform has suspended briefly for internal reasons. Peers are
|
|
282
|
+
* reset.
|
|
283
|
+
*/
|
|
284
|
+
TRANSPORT_CONDITION_TEMPORARILY_UNAVAILABLE,
|
|
285
|
+
} TransportCondition_t;
|
|
286
|
+
|
|
287
|
+
/** \brief
|
|
288
|
+
* The platform advises Rust that searching status changed
|
|
289
|
+
*/
|
|
290
|
+
void
|
|
291
|
+
/* fn */ awdl_client_scanning_state_changed (
|
|
292
|
+
TransportHandle_AwdlClientPlatformEvent_t const * handle,
|
|
293
|
+
OnlineState_t state,
|
|
294
|
+
TransportCondition_t condition);
|
|
295
|
+
|
|
296
|
+
/** \brief
|
|
297
|
+
* An opaque handle for each installed transport, heap-allocated and owned by
|
|
298
|
+
* the SDK.
|
|
299
|
+
*
|
|
300
|
+
* A pointer to this handle is used to send platform events over FFI. In the
|
|
301
|
+
* future this handle will be the SDK's only point of control over the
|
|
302
|
+
* transport once created. In particular, a transport will be removed by
|
|
303
|
+
* freeing the handle. The concept of online and offline will be eliminated.
|
|
304
|
+
* (i.e., if you don't want a transport, remove it.)
|
|
305
|
+
*
|
|
306
|
+
* For now, the `Peer` object holds the transports and provides an API based on
|
|
307
|
+
* a numeric id assigned to each transport instance. Until that is removed, the
|
|
308
|
+
* id still exists and the SDK can request it from the opaque handle over FFI.
|
|
309
|
+
*
|
|
310
|
+
* For each transport type, define an `extern "C"` function to free that
|
|
311
|
+
* specific monomorphisation of the `TransportHandle` using `Box::from_raw`,
|
|
312
|
+
* plus a function to retrieve the transport id, which will be removed later.
|
|
313
|
+
*
|
|
314
|
+
* Safety: The SDK owns the `TransportHandle`. It is responsible for ensuring
|
|
315
|
+
* that it does not use the pointer to the `TransportHandle` after freeing it
|
|
316
|
+
* with its respective function. In Rust we will assume it is okay to unsafely
|
|
317
|
+
* dereference a handle.
|
|
318
|
+
*
|
|
319
|
+
* The C interface of `TransportHandle` is thread-safe (`Send + Sync`).
|
|
320
|
+
*/
|
|
321
|
+
typedef struct TransportHandle_AwdlServerPlatformEvent TransportHandle_AwdlServerPlatformEvent_t;
|
|
322
|
+
|
|
323
|
+
/** \brief
|
|
324
|
+
* The platform advises Rust that advertising status changed
|
|
325
|
+
*/
|
|
326
|
+
void
|
|
327
|
+
/* fn */ awdl_server_advertising_state_changed (
|
|
328
|
+
TransportHandle_AwdlServerPlatformEvent_t const * handle,
|
|
329
|
+
OnlineState_t state,
|
|
330
|
+
TransportCondition_t condition);
|
|
331
|
+
|
|
332
|
+
/** \brief
|
|
333
|
+
* The platform advises Rust that a peer has changed its current connection
|
|
334
|
+
* status
|
|
335
|
+
*/
|
|
336
|
+
void
|
|
337
|
+
/* fn */ awdl_server_connect_state_changed (
|
|
338
|
+
TransportHandle_AwdlServerPlatformEvent_t const * handle,
|
|
339
|
+
int64_t platform_id,
|
|
340
|
+
ConnectState_t state);
|
|
341
|
+
|
|
342
|
+
/** \brief
|
|
343
|
+
* The platform advises Rust that a complete message has been received from a
|
|
344
|
+
* remote peer
|
|
345
|
+
*/
|
|
346
|
+
void
|
|
347
|
+
/* fn */ awdl_server_data_available (
|
|
348
|
+
TransportHandle_AwdlServerPlatformEvent_t const * handle,
|
|
349
|
+
int64_t platform_id);
|
|
350
|
+
|
|
351
|
+
/** \brief
|
|
352
|
+
* The SDK requests to drop its handle to the AWDL Server Transport
|
|
353
|
+
*
|
|
354
|
+
* At some point dropping this events channel will effectively shut down and
|
|
355
|
+
* remove the Transport. At time of writing, the Transport is still owned
|
|
356
|
+
* within Peer.
|
|
357
|
+
*/
|
|
358
|
+
void
|
|
359
|
+
/* fn */ awdl_server_free_handle (
|
|
360
|
+
TransportHandle_AwdlServerPlatformEvent_t * handle);
|
|
361
|
+
|
|
362
|
+
/** \brief
|
|
363
|
+
* The platform advises Rust that a peer has been identified. We know only its
|
|
364
|
+
* announce string.
|
|
365
|
+
*/
|
|
366
|
+
void
|
|
367
|
+
/* fn */ awdl_server_platform_peer_appeared (
|
|
368
|
+
TransportHandle_AwdlServerPlatformEvent_t const * handle,
|
|
369
|
+
int64_t platform_id);
|
|
370
|
+
|
|
371
|
+
/** \brief
|
|
372
|
+
* The platform advises Rust that a peer has disappeared.
|
|
373
|
+
*/
|
|
374
|
+
void
|
|
375
|
+
/* fn */ awdl_server_platform_peer_disappeared (
|
|
376
|
+
TransportHandle_AwdlServerPlatformEvent_t const * handle,
|
|
377
|
+
int64_t platform_id);
|
|
378
|
+
|
|
379
|
+
/** \brief
|
|
380
|
+
* The platform advises Rust that a given peer is now clear to queue up a new
|
|
381
|
+
* message whenever one is ready to go
|
|
382
|
+
*/
|
|
383
|
+
void
|
|
384
|
+
/* fn */ awdl_server_ready_to_send (
|
|
385
|
+
TransportHandle_AwdlServerPlatformEvent_t const * handle,
|
|
386
|
+
int64_t platform_id);
|
|
387
|
+
|
|
388
|
+
/** \brief
|
|
389
|
+
* An opaque handle for each installed transport, heap-allocated and owned by
|
|
390
|
+
* the SDK.
|
|
391
|
+
*
|
|
392
|
+
* A pointer to this handle is used to send platform events over FFI. In the
|
|
393
|
+
* future this handle will be the SDK's only point of control over the
|
|
394
|
+
* transport once created. In particular, a transport will be removed by
|
|
395
|
+
* freeing the handle. The concept of online and offline will be eliminated.
|
|
396
|
+
* (i.e., if you don't want a transport, remove it.)
|
|
397
|
+
*
|
|
398
|
+
* For now, the `Peer` object holds the transports and provides an API based on
|
|
399
|
+
* a numeric id assigned to each transport instance. Until that is removed, the
|
|
400
|
+
* id still exists and the SDK can request it from the opaque handle over FFI.
|
|
401
|
+
*
|
|
402
|
+
* For each transport type, define an `extern "C"` function to free that
|
|
403
|
+
* specific monomorphisation of the `TransportHandle` using `Box::from_raw`,
|
|
404
|
+
* plus a function to retrieve the transport id, which will be removed later.
|
|
405
|
+
*
|
|
406
|
+
* Safety: The SDK owns the `TransportHandle`. It is responsible for ensuring
|
|
407
|
+
* that it does not use the pointer to the `TransportHandle` after freeing it
|
|
408
|
+
* with its respective function. In Rust we will assume it is okay to unsafely
|
|
409
|
+
* dereference a handle.
|
|
410
|
+
*
|
|
411
|
+
* The C interface of `TransportHandle` is thread-safe (`Send + Sync`).
|
|
412
|
+
*/
|
|
413
|
+
typedef struct TransportHandle_BleClientPlatformEvent TransportHandle_BleClientPlatformEvent_t;
|
|
414
|
+
|
|
415
|
+
typedef struct {
|
|
416
|
+
uint8_t idx[16];
|
|
417
|
+
} uint8_16_array_t;
|
|
418
|
+
|
|
419
|
+
/** <No documentation available> */
|
|
420
|
+
void
|
|
421
|
+
/* fn */ ble_advertisement_heard (
|
|
422
|
+
TransportHandle_BleClientPlatformEvent_t const * handle,
|
|
423
|
+
uint8_16_array_t const * peripheral_uuid,
|
|
424
|
+
slice_ref_uint8_t local_name,
|
|
425
|
+
float rssi);
|
|
426
|
+
|
|
427
|
+
/** \brief
|
|
428
|
+
* An opaque handle for each installed transport, heap-allocated and owned by
|
|
429
|
+
* the SDK.
|
|
430
|
+
*
|
|
431
|
+
* A pointer to this handle is used to send platform events over FFI. In the
|
|
432
|
+
* future this handle will be the SDK's only point of control over the
|
|
433
|
+
* transport once created. In particular, a transport will be removed by
|
|
434
|
+
* freeing the handle. The concept of online and offline will be eliminated.
|
|
435
|
+
* (i.e., if you don't want a transport, remove it.)
|
|
436
|
+
*
|
|
437
|
+
* For now, the `Peer` object holds the transports and provides an API based on
|
|
438
|
+
* a numeric id assigned to each transport instance. Until that is removed, the
|
|
439
|
+
* id still exists and the SDK can request it from the opaque handle over FFI.
|
|
440
|
+
*
|
|
441
|
+
* For each transport type, define an `extern "C"` function to free that
|
|
442
|
+
* specific monomorphisation of the `TransportHandle` using `Box::from_raw`,
|
|
443
|
+
* plus a function to retrieve the transport id, which will be removed later.
|
|
444
|
+
*
|
|
445
|
+
* Safety: The SDK owns the `TransportHandle`. It is responsible for ensuring
|
|
446
|
+
* that it does not use the pointer to the `TransportHandle` after freeing it
|
|
447
|
+
* with its respective function. In Rust we will assume it is okay to unsafely
|
|
448
|
+
* dereference a handle.
|
|
449
|
+
*
|
|
450
|
+
* The C interface of `TransportHandle` is thread-safe (`Send + Sync`).
|
|
451
|
+
*/
|
|
452
|
+
typedef struct TransportHandle_BleServerPlatformEvent TransportHandle_BleServerPlatformEvent_t;
|
|
453
|
+
|
|
454
|
+
/** <No documentation available> */
|
|
455
|
+
void
|
|
456
|
+
/* fn */ ble_advertising_state_changed (
|
|
457
|
+
TransportHandle_BleServerPlatformEvent_t const * handle,
|
|
458
|
+
OnlineState_t state,
|
|
459
|
+
TransportCondition_t result);
|
|
460
|
+
|
|
461
|
+
/** <No documentation available> */
|
|
462
|
+
void
|
|
463
|
+
/* fn */ ble_central_finished_connecting (
|
|
464
|
+
TransportHandle_BleServerPlatformEvent_t const * handle,
|
|
465
|
+
uint8_16_array_t const * uuid,
|
|
466
|
+
slice_ref_uint8_t announce,
|
|
467
|
+
int32_t l2cap_available,
|
|
468
|
+
uint32_t mtu);
|
|
469
|
+
|
|
470
|
+
/** <No documentation available> */
|
|
471
|
+
void
|
|
472
|
+
/* fn */ ble_central_l2cap_data_available (
|
|
473
|
+
TransportHandle_BleServerPlatformEvent_t const * handle,
|
|
474
|
+
uint8_16_array_t const * uuid);
|
|
475
|
+
|
|
476
|
+
/** <No documentation available> */
|
|
477
|
+
void
|
|
478
|
+
/* fn */ ble_central_l2cap_ready_to_send (
|
|
479
|
+
TransportHandle_BleServerPlatformEvent_t const * handle,
|
|
480
|
+
uint8_16_array_t const * uuid);
|
|
481
|
+
|
|
482
|
+
/** <No documentation available> */
|
|
483
|
+
void
|
|
484
|
+
/* fn */ ble_central_mtu_updated (
|
|
485
|
+
TransportHandle_BleServerPlatformEvent_t const * handle,
|
|
486
|
+
uint8_16_array_t const * uuid,
|
|
487
|
+
uint32_t mtu);
|
|
488
|
+
|
|
489
|
+
/** <No documentation available> */
|
|
490
|
+
void
|
|
491
|
+
/* fn */ ble_central_ready_to_send (
|
|
492
|
+
TransportHandle_BleServerPlatformEvent_t const * handle,
|
|
493
|
+
uint8_16_array_t const * uuid);
|
|
494
|
+
|
|
495
|
+
/** <No documentation available> */
|
|
496
|
+
void
|
|
497
|
+
/* fn */ ble_central_unsubscribed (
|
|
498
|
+
TransportHandle_BleServerPlatformEvent_t const * handle,
|
|
499
|
+
uint8_16_array_t const * central_uuid);
|
|
500
|
+
|
|
501
|
+
/** \brief
|
|
502
|
+
* The SDK requests to drop its handle to the BLE Client Transport
|
|
503
|
+
*
|
|
504
|
+
* At some point dropping this events channel will effectively shut down and
|
|
505
|
+
* remove the Transport. At time of writing, the Transport is still owned
|
|
506
|
+
* within Peer.
|
|
507
|
+
*/
|
|
508
|
+
void
|
|
509
|
+
/* fn */ ble_client_free_handle (
|
|
510
|
+
TransportHandle_BleClientPlatformEvent_t * handle);
|
|
511
|
+
|
|
512
|
+
/** <No documentation available> */
|
|
513
|
+
void
|
|
514
|
+
/* fn */ ble_connection_state_changed (
|
|
515
|
+
TransportHandle_BleClientPlatformEvent_t const * handle,
|
|
516
|
+
uint8_16_array_t const * peripheral_uuid,
|
|
517
|
+
ConnectState_t state,
|
|
518
|
+
int32_t l2cap_available,
|
|
519
|
+
uint32_t mtu);
|
|
520
|
+
|
|
521
|
+
/** <No documentation available> */
|
|
522
|
+
void
|
|
523
|
+
/* fn */ ble_peripheral_l2cap_data_available (
|
|
524
|
+
TransportHandle_BleClientPlatformEvent_t const * handle,
|
|
525
|
+
uint8_16_array_t const * uuid);
|
|
526
|
+
|
|
527
|
+
/** <No documentation available> */
|
|
528
|
+
void
|
|
529
|
+
/* fn */ ble_peripheral_l2cap_ready_to_send (
|
|
530
|
+
TransportHandle_BleClientPlatformEvent_t const * handle,
|
|
531
|
+
uint8_16_array_t const * uuid);
|
|
532
|
+
|
|
533
|
+
/** <No documentation available> */
|
|
534
|
+
void
|
|
535
|
+
/* fn */ ble_peripheral_mtu_updated (
|
|
536
|
+
TransportHandle_BleClientPlatformEvent_t const * handle,
|
|
537
|
+
uint8_16_array_t const * uuid,
|
|
538
|
+
uint32_t mtu);
|
|
539
|
+
|
|
540
|
+
/** <No documentation available> */
|
|
541
|
+
void
|
|
542
|
+
/* fn */ ble_peripheral_ready_to_send (
|
|
543
|
+
TransportHandle_BleClientPlatformEvent_t const * handle,
|
|
544
|
+
uint8_16_array_t const * uuid);
|
|
545
|
+
|
|
546
|
+
/** \brief
|
|
547
|
+
* When receiving data from a Bluetooth LE peer, such as a characteristic
|
|
548
|
+
* write, indicates what sort of data it is.
|
|
549
|
+
*/
|
|
550
|
+
typedef enum BleDataType {
|
|
551
|
+
/** \brief
|
|
552
|
+
* The data _should_ contain the remote peer's announce string.
|
|
553
|
+
* Used during handshake.
|
|
554
|
+
*/
|
|
555
|
+
BLE_DATA_TYPE_ANNOUNCE = 0,
|
|
556
|
+
/** \brief
|
|
557
|
+
* Data message
|
|
558
|
+
*/
|
|
559
|
+
BLE_DATA_TYPE_MESH_DATA = 1,
|
|
560
|
+
/** \brief
|
|
561
|
+
* Control message
|
|
562
|
+
*/
|
|
563
|
+
BLE_DATA_TYPE_CONTROL = 2,
|
|
564
|
+
} BleDataType_t;
|
|
565
|
+
|
|
566
|
+
/** <No documentation available> */
|
|
567
|
+
void
|
|
568
|
+
/* fn */ ble_received_from_central (
|
|
569
|
+
TransportHandle_BleServerPlatformEvent_t const * handle,
|
|
570
|
+
uint8_16_array_t const * central_uuid,
|
|
571
|
+
BleDataType_t data_type,
|
|
572
|
+
slice_ref_uint8_t data);
|
|
573
|
+
|
|
574
|
+
/** <No documentation available> */
|
|
575
|
+
void
|
|
576
|
+
/* fn */ ble_received_from_peripheral (
|
|
577
|
+
TransportHandle_BleClientPlatformEvent_t const * handle,
|
|
578
|
+
uint8_16_array_t const * peripheral_uuid,
|
|
579
|
+
BleDataType_t data_type,
|
|
580
|
+
slice_ref_uint8_t data);
|
|
581
|
+
|
|
582
|
+
/** <No documentation available> */
|
|
583
|
+
void
|
|
584
|
+
/* fn */ ble_scanning_state_changed (
|
|
585
|
+
TransportHandle_BleClientPlatformEvent_t const * handle,
|
|
586
|
+
OnlineState_t state,
|
|
587
|
+
TransportCondition_t result);
|
|
588
|
+
|
|
589
|
+
/** \brief
|
|
590
|
+
* The SDK requests to drop its handle to the BLE Server Transport
|
|
591
|
+
*
|
|
592
|
+
* At some point dropping this events channel will effectively shut down and
|
|
593
|
+
* remove the Transport. At time of writing, the Transport is still owned
|
|
594
|
+
* within Peer.
|
|
595
|
+
*/
|
|
596
|
+
void
|
|
597
|
+
/* fn */ ble_server_free_handle (
|
|
598
|
+
TransportHandle_BleServerPlatformEvent_t * handle);
|
|
599
|
+
|
|
600
|
+
/** <No documentation available> */
|
|
601
|
+
typedef struct CDitto CDitto_t;
|
|
602
|
+
|
|
603
|
+
/** \brief
|
|
604
|
+
* `&'lt mut [T]` but with a guaranteed `#[repr(C)]` layout.
|
|
605
|
+
*
|
|
606
|
+
* # C layout (for some given type T)
|
|
607
|
+
*
|
|
608
|
+
* ```c
|
|
609
|
+
* typedef struct {
|
|
610
|
+
* // Cannot be NULL
|
|
611
|
+
* T * ptr;
|
|
612
|
+
* size_t len;
|
|
613
|
+
* } slice_T;
|
|
614
|
+
* ```
|
|
615
|
+
*
|
|
616
|
+
* # Nullable pointer?
|
|
617
|
+
*
|
|
618
|
+
* If you want to support the above typedef, but where the `ptr` field is
|
|
619
|
+
* allowed to be `NULL` (with the contents of `len` then being undefined)
|
|
620
|
+
* use the `Option< slice_ptr<_> >` type.
|
|
621
|
+
*/
|
|
622
|
+
typedef struct slice_mut_uint8 {
|
|
623
|
+
/** \brief
|
|
624
|
+
* Pointer to the first element (if any).
|
|
625
|
+
*/
|
|
626
|
+
uint8_t * ptr;
|
|
627
|
+
|
|
628
|
+
/** \brief
|
|
629
|
+
* Element count
|
|
630
|
+
*/
|
|
631
|
+
size_t len;
|
|
632
|
+
} slice_mut_uint8_t;
|
|
633
|
+
|
|
634
|
+
/** <No documentation available> */
|
|
635
|
+
typedef struct AwdlClientCallbacks {
|
|
636
|
+
/** <No documentation available> */
|
|
637
|
+
void (*start_searching)(void *, char const *, char const *);
|
|
638
|
+
|
|
639
|
+
/** <No documentation available> */
|
|
640
|
+
void (*stop_searching)(void *);
|
|
641
|
+
|
|
642
|
+
/** <No documentation available> */
|
|
643
|
+
void (*request_connect)(void *, char const *);
|
|
644
|
+
|
|
645
|
+
/** <No documentation available> */
|
|
646
|
+
void (*request_disconnect)(void *, char const *);
|
|
647
|
+
|
|
648
|
+
/** <No documentation available> */
|
|
649
|
+
int32_t (*send_data)(void *, char const *, slice_ref_uint8_t);
|
|
650
|
+
|
|
651
|
+
/** <No documentation available> */
|
|
652
|
+
int32_t (*read_data)(void *, char const *, slice_mut_uint8_t);
|
|
653
|
+
} AwdlClientCallbacks_t;
|
|
654
|
+
|
|
655
|
+
/** <No documentation available> */
|
|
656
|
+
TransportHandle_AwdlClientPlatformEvent_t *
|
|
657
|
+
/* fn */ ditto_add_awdl_client_transport (
|
|
658
|
+
CDitto_t const * ditto,
|
|
659
|
+
AwdlClientCallbacks_t callbacks,
|
|
660
|
+
void * ctx,
|
|
661
|
+
void (*retain)(void *),
|
|
662
|
+
void (*release)(void *));
|
|
663
|
+
|
|
664
|
+
/** <No documentation available> */
|
|
665
|
+
typedef struct AwdlServerCallbacks {
|
|
666
|
+
/** <No documentation available> */
|
|
667
|
+
void (*start_advertising)(void *, char const *, char const *);
|
|
668
|
+
|
|
669
|
+
/** <No documentation available> */
|
|
670
|
+
void (*stop_advertising)(void *);
|
|
671
|
+
|
|
672
|
+
/** <No documentation available> */
|
|
673
|
+
void (*request_disconnect)(void *, int64_t);
|
|
674
|
+
|
|
675
|
+
/** <No documentation available> */
|
|
676
|
+
int32_t (*send_data)(void *, int64_t, slice_ref_uint8_t);
|
|
677
|
+
|
|
678
|
+
/** <No documentation available> */
|
|
679
|
+
int32_t (*read_data)(void *, int64_t, slice_mut_uint8_t);
|
|
680
|
+
} AwdlServerCallbacks_t;
|
|
681
|
+
|
|
682
|
+
/** <No documentation available> */
|
|
683
|
+
TransportHandle_AwdlServerPlatformEvent_t *
|
|
684
|
+
/* fn */ ditto_add_awdl_server_transport (
|
|
685
|
+
CDitto_t const * ditto,
|
|
686
|
+
AwdlServerCallbacks_t callbacks,
|
|
687
|
+
void * ctx,
|
|
688
|
+
void (*retain)(void *),
|
|
689
|
+
void (*release)(void *));
|
|
690
|
+
|
|
691
|
+
|
|
692
|
+
#include <stdbool.h>
|
|
693
|
+
|
|
694
|
+
/** \brief
|
|
695
|
+
* Rust-level representation of the result of a send operation, converted from
|
|
696
|
+
* a bitfield
|
|
697
|
+
*/
|
|
698
|
+
typedef struct SendResult {
|
|
699
|
+
/** <No documentation available> */
|
|
700
|
+
bool accepted;
|
|
701
|
+
|
|
702
|
+
/** <No documentation available> */
|
|
703
|
+
bool wait_for_ready;
|
|
704
|
+
} SendResult_t;
|
|
705
|
+
|
|
706
|
+
/** <No documentation available> */
|
|
707
|
+
typedef struct BleClientCallbacks {
|
|
708
|
+
/** <No documentation available> */
|
|
709
|
+
void (*start_scanning)(void *, uint8_16_array_t const *, slice_ref_uint8_t);
|
|
710
|
+
|
|
711
|
+
/** <No documentation available> */
|
|
712
|
+
void (*stop_scanning)(void *);
|
|
713
|
+
|
|
714
|
+
/** <No documentation available> */
|
|
715
|
+
OnlineState_t (*scanning_state)(void *);
|
|
716
|
+
|
|
717
|
+
/** <No documentation available> */
|
|
718
|
+
void (*connect_peripheral)(void *, uint8_16_array_t const *);
|
|
719
|
+
|
|
720
|
+
/** <No documentation available> */
|
|
721
|
+
void (*disconnect_peripheral)(void *, uint8_16_array_t const *);
|
|
722
|
+
|
|
723
|
+
/** <No documentation available> */
|
|
724
|
+
SendResult_t (*write_to_peripheral)(void *, BleDataType_t, uint8_16_array_t const *, slice_ref_uint8_t);
|
|
725
|
+
|
|
726
|
+
/** <No documentation available> */
|
|
727
|
+
bool (*app_is_in_foreground)(void *);
|
|
728
|
+
|
|
729
|
+
/** <No documentation available> */
|
|
730
|
+
int32_t (*read_l2cap_from_peripheral)(void *, uint8_16_array_t const *, slice_mut_uint8_t);
|
|
731
|
+
|
|
732
|
+
/** <No documentation available> */
|
|
733
|
+
int32_t (*send_l2cap_to_peripheral)(void *, uint8_16_array_t const *, slice_ref_uint8_t);
|
|
734
|
+
} BleClientCallbacks_t;
|
|
735
|
+
|
|
736
|
+
/** <No documentation available> */
|
|
737
|
+
TransportHandle_BleClientPlatformEvent_t *
|
|
738
|
+
/* fn */ ditto_add_ble_client_transport (
|
|
739
|
+
CDitto_t const * ditto,
|
|
740
|
+
BleClientCallbacks_t callbacks,
|
|
741
|
+
void * ctx,
|
|
742
|
+
void (*retain)(void *),
|
|
743
|
+
void (*release)(void *));
|
|
744
|
+
|
|
745
|
+
/** <No documentation available> */
|
|
746
|
+
typedef struct BleServerCallbacks {
|
|
747
|
+
/** <No documentation available> */
|
|
748
|
+
void (*start_advertising)(void *, uint8_16_array_t const *, slice_ref_uint8_t);
|
|
749
|
+
|
|
750
|
+
/** <No documentation available> */
|
|
751
|
+
void (*stop_advertising)(void *);
|
|
752
|
+
|
|
753
|
+
/** <No documentation available> */
|
|
754
|
+
OnlineState_t (*advertising_state)(void *);
|
|
755
|
+
|
|
756
|
+
/** <No documentation available> */
|
|
757
|
+
SendResult_t (*notify_to_central)(void *, BleDataType_t, uint8_16_array_t const *, slice_ref_uint8_t);
|
|
758
|
+
|
|
759
|
+
/** <No documentation available> */
|
|
760
|
+
bool (*app_is_in_foreground)(void *);
|
|
761
|
+
|
|
762
|
+
/** <No documentation available> */
|
|
763
|
+
int32_t (*read_l2cap_from_central)(void *, uint8_16_array_t const *, slice_mut_uint8_t);
|
|
764
|
+
|
|
765
|
+
/** <No documentation available> */
|
|
766
|
+
int32_t (*send_l2cap_to_central)(void *, uint8_16_array_t const *, slice_ref_uint8_t);
|
|
767
|
+
} BleServerCallbacks_t;
|
|
768
|
+
|
|
769
|
+
/** <No documentation available> */
|
|
770
|
+
TransportHandle_BleServerPlatformEvent_t *
|
|
771
|
+
/* fn */ ditto_add_ble_server_transport (
|
|
772
|
+
CDitto_t const * ditto,
|
|
773
|
+
BleServerCallbacks_t callbacks,
|
|
774
|
+
void * ctx,
|
|
775
|
+
void (*retain)(void *),
|
|
776
|
+
void (*release)(void *));
|
|
777
|
+
|
|
778
|
+
/** \brief
|
|
779
|
+
* Requested reliability level for a message to be transmitted to another peer.
|
|
780
|
+
*
|
|
781
|
+
* Related to Link's
|
|
782
|
+
* [`StreamReliability`](`::ditto_link::protocol::StreamReliability`).
|
|
783
|
+
*/
|
|
784
|
+
typedef enum ReliabilityMode {
|
|
785
|
+
/** \brief
|
|
786
|
+
* No guarantees of successful delivery, ordering, or once-only delivery
|
|
787
|
+
*/
|
|
788
|
+
RELIABILITY_MODE_UNRELIABLE,
|
|
789
|
+
/** \brief
|
|
790
|
+
* Messages will be delivered at most once, in the same order that they are sent,
|
|
791
|
+
* but there may be gaps.
|
|
792
|
+
*/
|
|
793
|
+
RELIABILITY_MODE_UNRELIABLE_SEQUENCED,
|
|
794
|
+
/** \brief
|
|
795
|
+
* Every message will be delivered in order or else the connection fails
|
|
796
|
+
*/
|
|
797
|
+
RELIABILITY_MODE_RELIABLE,
|
|
798
|
+
} ReliabilityMode_t;
|
|
799
|
+
|
|
800
|
+
/** \brief
|
|
801
|
+
* FFI version of CompletionReason
|
|
802
|
+
*/
|
|
803
|
+
typedef enum BusCompletionReason {
|
|
804
|
+
/** <No documentation available> */
|
|
805
|
+
BUS_COMPLETION_REASON_CLOSED_BY_REMOTE,
|
|
806
|
+
/** <No documentation available> */
|
|
807
|
+
BUS_COMPLETION_REASON_CLOSED_BY_LOCAL,
|
|
808
|
+
} BusCompletionReason_t;
|
|
809
|
+
|
|
810
|
+
/** \brief
|
|
811
|
+
* FFI mapping of SingleSendError results
|
|
812
|
+
*/
|
|
813
|
+
typedef enum BusSingleSendResult {
|
|
814
|
+
/** <No documentation available> */
|
|
815
|
+
BUS_SINGLE_SEND_RESULT_OK,
|
|
816
|
+
/** <No documentation available> */
|
|
817
|
+
BUS_SINGLE_SEND_RESULT_PAYLOAD_TOO_LARGE,
|
|
818
|
+
/** <No documentation available> */
|
|
819
|
+
BUS_SINGLE_SEND_RESULT_QUEUE_FULL,
|
|
820
|
+
/** <No documentation available> */
|
|
821
|
+
BUS_SINGLE_SEND_RESULT_STREAM_FAILED,
|
|
822
|
+
} BusSingleSendResult_t;
|
|
823
|
+
|
|
824
|
+
/** <No documentation available> */
|
|
825
|
+
typedef struct BusCallbacks {
|
|
826
|
+
/** <No documentation available> */
|
|
827
|
+
void (*new_incoming_stream)(void *, uint64_t, slice_ref_uint8_t, ReliabilityMode_t, uint64_t);
|
|
828
|
+
|
|
829
|
+
/** <No documentation available> */
|
|
830
|
+
void (*stream_open_succeeded)(void *, uint64_t, ReliabilityMode_t, uint64_t);
|
|
831
|
+
|
|
832
|
+
/** <No documentation available> */
|
|
833
|
+
void (*stream_open_failed)(void *, uint64_t);
|
|
834
|
+
|
|
835
|
+
/** <No documentation available> */
|
|
836
|
+
void (*stream_send_completed)(void *, uint64_t, uint32_t, uint64_t);
|
|
837
|
+
|
|
838
|
+
/** <No documentation available> */
|
|
839
|
+
void (*stream_closed)(void *, uint64_t, BusCompletionReason_t);
|
|
840
|
+
|
|
841
|
+
/** <No documentation available> */
|
|
842
|
+
void (*stream_incoming_message)(void *, uint64_t, slice_ref_uint8_t);
|
|
843
|
+
|
|
844
|
+
/** <No documentation available> */
|
|
845
|
+
void (*stream_remote_ack)(void *, uint64_t, uint64_t);
|
|
846
|
+
|
|
847
|
+
/** <No documentation available> */
|
|
848
|
+
void (*single_message_received)(void *, uint64_t, slice_ref_uint8_t, slice_ref_uint8_t);
|
|
849
|
+
|
|
850
|
+
/** <No documentation available> */
|
|
851
|
+
void (*finished_sending_single_message)(void *, uint64_t, ReliabilityMode_t, BusSingleSendResult_t);
|
|
852
|
+
} BusCallbacks_t;
|
|
853
|
+
|
|
854
|
+
/** <No documentation available> */
|
|
855
|
+
void
|
|
856
|
+
/* fn */ ditto_add_bus (
|
|
857
|
+
CDitto_t const * ditto,
|
|
858
|
+
BusCallbacks_t callbacks,
|
|
859
|
+
void * ctx,
|
|
860
|
+
void (*retain)(void *),
|
|
861
|
+
void (*release)(void *));
|
|
862
|
+
|
|
863
|
+
/** <No documentation available> */
|
|
864
|
+
TransportHandle_BleClientPlatformEvent_t *
|
|
865
|
+
/* fn */ ditto_add_internal_ble_client_transport (
|
|
866
|
+
CDitto_t const * ditto);
|
|
867
|
+
|
|
868
|
+
/** <No documentation available> */
|
|
869
|
+
TransportHandle_BleServerPlatformEvent_t *
|
|
870
|
+
/* fn */ ditto_add_internal_ble_server_transport (
|
|
871
|
+
CDitto_t const * ditto);
|
|
872
|
+
|
|
873
|
+
/** \brief
|
|
874
|
+
* An opaque handle for each installed transport, heap-allocated and owned by
|
|
875
|
+
* the SDK.
|
|
876
|
+
*
|
|
877
|
+
* A pointer to this handle is used to send platform events over FFI. In the
|
|
878
|
+
* future this handle will be the SDK's only point of control over the
|
|
879
|
+
* transport once created. In particular, a transport will be removed by
|
|
880
|
+
* freeing the handle. The concept of online and offline will be eliminated.
|
|
881
|
+
* (i.e., if you don't want a transport, remove it.)
|
|
882
|
+
*
|
|
883
|
+
* For now, the `Peer` object holds the transports and provides an API based on
|
|
884
|
+
* a numeric id assigned to each transport instance. Until that is removed, the
|
|
885
|
+
* id still exists and the SDK can request it from the opaque handle over FFI.
|
|
886
|
+
*
|
|
887
|
+
* For each transport type, define an `extern "C"` function to free that
|
|
888
|
+
* specific monomorphisation of the `TransportHandle` using `Box::from_raw`,
|
|
889
|
+
* plus a function to retrieve the transport id, which will be removed later.
|
|
890
|
+
*
|
|
891
|
+
* Safety: The SDK owns the `TransportHandle`. It is responsible for ensuring
|
|
892
|
+
* that it does not use the pointer to the `TransportHandle` after freeing it
|
|
893
|
+
* with its respective function. In Rust we will assume it is okay to unsafely
|
|
894
|
+
* dereference a handle.
|
|
895
|
+
*
|
|
896
|
+
* The C interface of `TransportHandle` is thread-safe (`Send + Sync`).
|
|
897
|
+
*/
|
|
898
|
+
typedef struct TransportHandle_MdnsClientPlatformEvent TransportHandle_MdnsClientPlatformEvent_t;
|
|
899
|
+
|
|
900
|
+
/** <No documentation available> */
|
|
901
|
+
TransportHandle_MdnsClientPlatformEvent_t *
|
|
902
|
+
/* fn */ ditto_add_internal_mdns_client_transport (
|
|
903
|
+
CDitto_t const * ditto);
|
|
904
|
+
|
|
905
|
+
/** \brief
|
|
906
|
+
* An opaque handle for each installed transport, heap-allocated and owned by
|
|
907
|
+
* the SDK.
|
|
908
|
+
*
|
|
909
|
+
* A pointer to this handle is used to send platform events over FFI. In the
|
|
910
|
+
* future this handle will be the SDK's only point of control over the
|
|
911
|
+
* transport once created. In particular, a transport will be removed by
|
|
912
|
+
* freeing the handle. The concept of online and offline will be eliminated.
|
|
913
|
+
* (i.e., if you don't want a transport, remove it.)
|
|
914
|
+
*
|
|
915
|
+
* For now, the `Peer` object holds the transports and provides an API based on
|
|
916
|
+
* a numeric id assigned to each transport instance. Until that is removed, the
|
|
917
|
+
* id still exists and the SDK can request it from the opaque handle over FFI.
|
|
918
|
+
*
|
|
919
|
+
* For each transport type, define an `extern "C"` function to free that
|
|
920
|
+
* specific monomorphisation of the `TransportHandle` using `Box::from_raw`,
|
|
921
|
+
* plus a function to retrieve the transport id, which will be removed later.
|
|
922
|
+
*
|
|
923
|
+
* Safety: The SDK owns the `TransportHandle`. It is responsible for ensuring
|
|
924
|
+
* that it does not use the pointer to the `TransportHandle` after freeing it
|
|
925
|
+
* with its respective function. In Rust we will assume it is okay to unsafely
|
|
926
|
+
* dereference a handle.
|
|
927
|
+
*
|
|
928
|
+
* The C interface of `TransportHandle` is thread-safe (`Send + Sync`).
|
|
929
|
+
*/
|
|
930
|
+
typedef struct TransportHandle_MdnsServerPlatformEvent TransportHandle_MdnsServerPlatformEvent_t;
|
|
931
|
+
|
|
932
|
+
/** <No documentation available> */
|
|
933
|
+
TransportHandle_MdnsServerPlatformEvent_t *
|
|
934
|
+
/* fn */ ditto_add_internal_mdns_server_transport (
|
|
935
|
+
CDitto_t const * ditto);
|
|
936
|
+
|
|
937
|
+
/** <No documentation available> */
|
|
938
|
+
typedef struct MdnsClientCallbacks {
|
|
939
|
+
/** <No documentation available> */
|
|
940
|
+
void (*start_searching)(void *, char const *);
|
|
941
|
+
|
|
942
|
+
/** <No documentation available> */
|
|
943
|
+
void (*stop_searching)(void *);
|
|
944
|
+
|
|
945
|
+
/** <No documentation available> */
|
|
946
|
+
void (*resolve_service)(void *, slice_ref_uint8_t);
|
|
947
|
+
} MdnsClientCallbacks_t;
|
|
948
|
+
|
|
949
|
+
/** <No documentation available> */
|
|
950
|
+
TransportHandle_MdnsClientPlatformEvent_t *
|
|
951
|
+
/* fn */ ditto_add_mdns_client_transport (
|
|
952
|
+
CDitto_t const * ditto,
|
|
953
|
+
MdnsClientCallbacks_t callbacks,
|
|
954
|
+
void * ctx,
|
|
955
|
+
void (*retain)(void *),
|
|
956
|
+
void (*release)(void *));
|
|
957
|
+
|
|
958
|
+
/** <No documentation available> */
|
|
959
|
+
typedef struct MdnsServerCallbacks {
|
|
960
|
+
/** <No documentation available> */
|
|
961
|
+
void (*start_advertising)(void *, char const *, char const *, uint16_t);
|
|
962
|
+
|
|
963
|
+
/** <No documentation available> */
|
|
964
|
+
void (*stop_advertising)(void *);
|
|
965
|
+
} MdnsServerCallbacks_t;
|
|
966
|
+
|
|
967
|
+
/** <No documentation available> */
|
|
968
|
+
TransportHandle_MdnsServerPlatformEvent_t *
|
|
969
|
+
/* fn */ ditto_add_mdns_server_transport (
|
|
970
|
+
CDitto_t const * ditto,
|
|
971
|
+
MdnsServerCallbacks_t callbacks,
|
|
972
|
+
void * ctx,
|
|
973
|
+
void (*retain)(void *),
|
|
974
|
+
void (*release)(void *));
|
|
975
|
+
|
|
976
|
+
/** <No documentation available> */
|
|
977
|
+
void
|
|
978
|
+
/* fn */ ditto_add_multicast_transport (
|
|
979
|
+
CDitto_t const * ditto);
|
|
980
|
+
|
|
981
|
+
/** \brief
|
|
982
|
+
* An opaque handle for each installed transport, heap-allocated and owned by
|
|
983
|
+
* the SDK.
|
|
984
|
+
*
|
|
985
|
+
* A pointer to this handle is used to send platform events over FFI. In the
|
|
986
|
+
* future this handle will be the SDK's only point of control over the
|
|
987
|
+
* transport once created. In particular, a transport will be removed by
|
|
988
|
+
* freeing the handle. The concept of online and offline will be eliminated.
|
|
989
|
+
* (i.e., if you don't want a transport, remove it.)
|
|
990
|
+
*
|
|
991
|
+
* For now, the `Peer` object holds the transports and provides an API based on
|
|
992
|
+
* a numeric id assigned to each transport instance. Until that is removed, the
|
|
993
|
+
* id still exists and the SDK can request it from the opaque handle over FFI.
|
|
994
|
+
*
|
|
995
|
+
* For each transport type, define an `extern "C"` function to free that
|
|
996
|
+
* specific monomorphisation of the `TransportHandle` using `Box::from_raw`,
|
|
997
|
+
* plus a function to retrieve the transport id, which will be removed later.
|
|
998
|
+
*
|
|
999
|
+
* Safety: The SDK owns the `TransportHandle`. It is responsible for ensuring
|
|
1000
|
+
* that it does not use the pointer to the `TransportHandle` after freeing it
|
|
1001
|
+
* with its respective function. In Rust we will assume it is okay to unsafely
|
|
1002
|
+
* dereference a handle.
|
|
1003
|
+
*
|
|
1004
|
+
* The C interface of `TransportHandle` is thread-safe (`Send + Sync`).
|
|
1005
|
+
*/
|
|
1006
|
+
typedef struct TransportHandle_StaticTcpClientPlatformEvent TransportHandle_StaticTcpClientPlatformEvent_t;
|
|
1007
|
+
|
|
1008
|
+
/** <No documentation available> */
|
|
1009
|
+
TransportHandle_StaticTcpClientPlatformEvent_t *
|
|
1010
|
+
/* fn */ ditto_add_static_tcp_client (
|
|
1011
|
+
CDitto_t const * ditto,
|
|
1012
|
+
char const * address);
|
|
1013
|
+
|
|
1014
|
+
/** <No documentation available> */
|
|
1015
|
+
typedef enum QuerySortDirection {
|
|
1016
|
+
/** <No documentation available> */
|
|
1017
|
+
QUERY_SORT_DIRECTION_ASCENDING = 1,
|
|
1018
|
+
/** <No documentation available> */
|
|
1019
|
+
QUERY_SORT_DIRECTION_DESCENDING,
|
|
1020
|
+
} QuerySortDirection_t;
|
|
1021
|
+
|
|
1022
|
+
/** \brief
|
|
1023
|
+
* OrderBy Parameter
|
|
1024
|
+
*/
|
|
1025
|
+
typedef struct COrderByParam {
|
|
1026
|
+
/** <No documentation available> */
|
|
1027
|
+
char const * query_c_str;
|
|
1028
|
+
|
|
1029
|
+
/** <No documentation available> */
|
|
1030
|
+
QuerySortDirection_t direction;
|
|
1031
|
+
} COrderByParam_t;
|
|
1032
|
+
|
|
1033
|
+
/** \brief
|
|
1034
|
+
* `&'lt [T]` but with a guaranteed `#[repr(C)]` layout.
|
|
1035
|
+
*
|
|
1036
|
+
* # C layout (for some given type T)
|
|
1037
|
+
*
|
|
1038
|
+
* ```c
|
|
1039
|
+
* typedef struct {
|
|
1040
|
+
* // Cannot be NULL
|
|
1041
|
+
* T * ptr;
|
|
1042
|
+
* size_t len;
|
|
1043
|
+
* } slice_T;
|
|
1044
|
+
* ```
|
|
1045
|
+
*
|
|
1046
|
+
* # Nullable pointer?
|
|
1047
|
+
*
|
|
1048
|
+
* If you want to support the above typedef, but where the `ptr` field is
|
|
1049
|
+
* allowed to be `NULL` (with the contents of `len` then being undefined)
|
|
1050
|
+
* use the `Option< slice_ptr<_> >` type.
|
|
1051
|
+
*/
|
|
1052
|
+
typedef struct slice_ref_COrderByParam {
|
|
1053
|
+
/** \brief
|
|
1054
|
+
* Pointer to the first element (if any).
|
|
1055
|
+
*/
|
|
1056
|
+
COrderByParam_t const * ptr;
|
|
1057
|
+
|
|
1058
|
+
/** \brief
|
|
1059
|
+
* Element count
|
|
1060
|
+
*/
|
|
1061
|
+
size_t len;
|
|
1062
|
+
} slice_ref_COrderByParam_t;
|
|
1063
|
+
|
|
1064
|
+
/** <No documentation available> */
|
|
1065
|
+
int32_t
|
|
1066
|
+
/* fn */ ditto_add_subscription (
|
|
1067
|
+
CDitto_t const * ditto,
|
|
1068
|
+
char const * collection,
|
|
1069
|
+
char const * query,
|
|
1070
|
+
slice_ref_uint8_t query_args_cbor,
|
|
1071
|
+
slice_ref_COrderByParam_t order_by,
|
|
1072
|
+
int32_t limit,
|
|
1073
|
+
uint32_t offset);
|
|
1074
|
+
|
|
1075
|
+
/** \brief
|
|
1076
|
+
* An opaque handle for each installed transport, heap-allocated and owned by
|
|
1077
|
+
* the SDK.
|
|
1078
|
+
*
|
|
1079
|
+
* A pointer to this handle is used to send platform events over FFI. In the
|
|
1080
|
+
* future this handle will be the SDK's only point of control over the
|
|
1081
|
+
* transport once created. In particular, a transport will be removed by
|
|
1082
|
+
* freeing the handle. The concept of online and offline will be eliminated.
|
|
1083
|
+
* (i.e., if you don't want a transport, remove it.)
|
|
1084
|
+
*
|
|
1085
|
+
* For now, the `Peer` object holds the transports and provides an API based on
|
|
1086
|
+
* a numeric id assigned to each transport instance. Until that is removed, the
|
|
1087
|
+
* id still exists and the SDK can request it from the opaque handle over FFI.
|
|
1088
|
+
*
|
|
1089
|
+
* For each transport type, define an `extern "C"` function to free that
|
|
1090
|
+
* specific monomorphisation of the `TransportHandle` using `Box::from_raw`,
|
|
1091
|
+
* plus a function to retrieve the transport id, which will be removed later.
|
|
1092
|
+
*
|
|
1093
|
+
* Safety: The SDK owns the `TransportHandle`. It is responsible for ensuring
|
|
1094
|
+
* that it does not use the pointer to the `TransportHandle` after freeing it
|
|
1095
|
+
* with its respective function. In Rust we will assume it is okay to unsafely
|
|
1096
|
+
* dereference a handle.
|
|
1097
|
+
*
|
|
1098
|
+
* The C interface of `TransportHandle` is thread-safe (`Send + Sync`).
|
|
1099
|
+
*/
|
|
1100
|
+
typedef struct TransportHandle_WebsocketClientPlatformEvent TransportHandle_WebsocketClientPlatformEvent_t;
|
|
1101
|
+
|
|
1102
|
+
/** <No documentation available> */
|
|
1103
|
+
TransportHandle_WebsocketClientPlatformEvent_t *
|
|
1104
|
+
/* fn */ ditto_add_websocket_client (
|
|
1105
|
+
CDitto_t const * ditto,
|
|
1106
|
+
char const * address,
|
|
1107
|
+
uint32_t routing_hint);
|
|
1108
|
+
|
|
1109
|
+
/** <No documentation available> */
|
|
1110
|
+
typedef struct WifiAwareClientCallbacks {
|
|
1111
|
+
/** <No documentation available> */
|
|
1112
|
+
void (*start_searching)(void *, char const *, char const *);
|
|
1113
|
+
|
|
1114
|
+
/** <No documentation available> */
|
|
1115
|
+
void (*stop_searching)(void *);
|
|
1116
|
+
|
|
1117
|
+
/** <No documentation available> */
|
|
1118
|
+
void (*create_network)(void *, char const *);
|
|
1119
|
+
|
|
1120
|
+
/** <No documentation available> */
|
|
1121
|
+
void (*update_peer)(void *, char const *, ConnectState_t);
|
|
1122
|
+
} WifiAwareClientCallbacks_t;
|
|
1123
|
+
|
|
1124
|
+
/** \brief
|
|
1125
|
+
* An opaque handle for each installed transport, heap-allocated and owned by
|
|
1126
|
+
* the SDK.
|
|
1127
|
+
*
|
|
1128
|
+
* A pointer to this handle is used to send platform events over FFI. In the
|
|
1129
|
+
* future this handle will be the SDK's only point of control over the
|
|
1130
|
+
* transport once created. In particular, a transport will be removed by
|
|
1131
|
+
* freeing the handle. The concept of online and offline will be eliminated.
|
|
1132
|
+
* (i.e., if you don't want a transport, remove it.)
|
|
1133
|
+
*
|
|
1134
|
+
* For now, the `Peer` object holds the transports and provides an API based on
|
|
1135
|
+
* a numeric id assigned to each transport instance. Until that is removed, the
|
|
1136
|
+
* id still exists and the SDK can request it from the opaque handle over FFI.
|
|
1137
|
+
*
|
|
1138
|
+
* For each transport type, define an `extern "C"` function to free that
|
|
1139
|
+
* specific monomorphisation of the `TransportHandle` using `Box::from_raw`,
|
|
1140
|
+
* plus a function to retrieve the transport id, which will be removed later.
|
|
1141
|
+
*
|
|
1142
|
+
* Safety: The SDK owns the `TransportHandle`. It is responsible for ensuring
|
|
1143
|
+
* that it does not use the pointer to the `TransportHandle` after freeing it
|
|
1144
|
+
* with its respective function. In Rust we will assume it is okay to unsafely
|
|
1145
|
+
* dereference a handle.
|
|
1146
|
+
*
|
|
1147
|
+
* The C interface of `TransportHandle` is thread-safe (`Send + Sync`).
|
|
1148
|
+
*/
|
|
1149
|
+
typedef struct TransportHandle_WifiAwareClientPlatformEvent TransportHandle_WifiAwareClientPlatformEvent_t;
|
|
1150
|
+
|
|
1151
|
+
/** <No documentation available> */
|
|
1152
|
+
TransportHandle_WifiAwareClientPlatformEvent_t *
|
|
1153
|
+
/* fn */ ditto_add_wifi_aware_client_transport (
|
|
1154
|
+
CDitto_t const * ditto,
|
|
1155
|
+
WifiAwareClientCallbacks_t callbacks,
|
|
1156
|
+
void * ctx,
|
|
1157
|
+
void (*retain)(void *),
|
|
1158
|
+
void (*release)(void *));
|
|
1159
|
+
|
|
1160
|
+
/** <No documentation available> */
|
|
1161
|
+
typedef struct WifiAwareServerCallbacks {
|
|
1162
|
+
/** <No documentation available> */
|
|
1163
|
+
void (*start_advertising)(void *, char const *, char const *, uint16_t);
|
|
1164
|
+
|
|
1165
|
+
/** <No documentation available> */
|
|
1166
|
+
void (*stop_advertising)(void *);
|
|
1167
|
+
|
|
1168
|
+
/** <No documentation available> */
|
|
1169
|
+
void (*update_peer)(void *, char const *, ConnectState_t);
|
|
1170
|
+
} WifiAwareServerCallbacks_t;
|
|
1171
|
+
|
|
1172
|
+
/** \brief
|
|
1173
|
+
* An opaque handle for each installed transport, heap-allocated and owned by
|
|
1174
|
+
* the SDK.
|
|
1175
|
+
*
|
|
1176
|
+
* A pointer to this handle is used to send platform events over FFI. In the
|
|
1177
|
+
* future this handle will be the SDK's only point of control over the
|
|
1178
|
+
* transport once created. In particular, a transport will be removed by
|
|
1179
|
+
* freeing the handle. The concept of online and offline will be eliminated.
|
|
1180
|
+
* (i.e., if you don't want a transport, remove it.)
|
|
1181
|
+
*
|
|
1182
|
+
* For now, the `Peer` object holds the transports and provides an API based on
|
|
1183
|
+
* a numeric id assigned to each transport instance. Until that is removed, the
|
|
1184
|
+
* id still exists and the SDK can request it from the opaque handle over FFI.
|
|
1185
|
+
*
|
|
1186
|
+
* For each transport type, define an `extern "C"` function to free that
|
|
1187
|
+
* specific monomorphisation of the `TransportHandle` using `Box::from_raw`,
|
|
1188
|
+
* plus a function to retrieve the transport id, which will be removed later.
|
|
1189
|
+
*
|
|
1190
|
+
* Safety: The SDK owns the `TransportHandle`. It is responsible for ensuring
|
|
1191
|
+
* that it does not use the pointer to the `TransportHandle` after freeing it
|
|
1192
|
+
* with its respective function. In Rust we will assume it is okay to unsafely
|
|
1193
|
+
* dereference a handle.
|
|
1194
|
+
*
|
|
1195
|
+
* The C interface of `TransportHandle` is thread-safe (`Send + Sync`).
|
|
1196
|
+
*/
|
|
1197
|
+
typedef struct TransportHandle_WifiAwareServerPlatformEvent TransportHandle_WifiAwareServerPlatformEvent_t;
|
|
1198
|
+
|
|
1199
|
+
/** <No documentation available> */
|
|
1200
|
+
TransportHandle_WifiAwareServerPlatformEvent_t *
|
|
1201
|
+
/* fn */ ditto_add_wifi_aware_server_advertiser (
|
|
1202
|
+
CDitto_t const * ditto,
|
|
1203
|
+
WifiAwareServerCallbacks_t callbacks,
|
|
1204
|
+
void * ctx,
|
|
1205
|
+
void (*retain)(void *),
|
|
1206
|
+
void (*release)(void *));
|
|
1207
|
+
|
|
1208
|
+
/** <No documentation available> */
|
|
1209
|
+
char *
|
|
1210
|
+
/* fn */ ditto_auth_client_get_app_id (
|
|
1211
|
+
CDitto_t const * ditto);
|
|
1212
|
+
|
|
1213
|
+
/** <No documentation available> */
|
|
1214
|
+
uint64_t
|
|
1215
|
+
/* fn */ ditto_auth_client_get_site_id (
|
|
1216
|
+
CDitto_t const * ditto);
|
|
1217
|
+
|
|
1218
|
+
/** <No documentation available> */
|
|
1219
|
+
int32_t
|
|
1220
|
+
/* fn */ ditto_auth_client_is_web_valid (
|
|
1221
|
+
CDitto_t const * ditto);
|
|
1222
|
+
|
|
1223
|
+
/** <No documentation available> */
|
|
1224
|
+
int32_t
|
|
1225
|
+
/* fn */ ditto_auth_client_is_x509_valid (
|
|
1226
|
+
CDitto_t const * ditto);
|
|
1227
|
+
|
|
1228
|
+
/** <No documentation available> */
|
|
1229
|
+
int32_t
|
|
1230
|
+
/* fn */ ditto_auth_client_login_with_credentials (
|
|
1231
|
+
CDitto_t * ditto,
|
|
1232
|
+
char const * username,
|
|
1233
|
+
char const * password,
|
|
1234
|
+
char const * provider);
|
|
1235
|
+
|
|
1236
|
+
/** <No documentation available> */
|
|
1237
|
+
int32_t
|
|
1238
|
+
/* fn */ ditto_auth_client_login_with_token (
|
|
1239
|
+
CDitto_t * ditto,
|
|
1240
|
+
char const * token,
|
|
1241
|
+
char const * provider);
|
|
1242
|
+
|
|
1243
|
+
/** <No documentation available> */
|
|
1244
|
+
typedef struct BoxedCharPtrResult {
|
|
1245
|
+
/** <No documentation available> */
|
|
1246
|
+
int32_t status_code;
|
|
1247
|
+
|
|
1248
|
+
/** <No documentation available> */
|
|
1249
|
+
char * c_string;
|
|
1250
|
+
} BoxedCharPtrResult_t;
|
|
1251
|
+
|
|
1252
|
+
/** <No documentation available> */
|
|
1253
|
+
BoxedCharPtrResult_t
|
|
1254
|
+
/* fn */ ditto_auth_client_login_with_token_and_feedback (
|
|
1255
|
+
CDitto_t const * ditto,
|
|
1256
|
+
char const * token,
|
|
1257
|
+
char const * provider);
|
|
1258
|
+
|
|
1259
|
+
/** \brief
|
|
1260
|
+
* Trigger an explicit logout and purge of any cached credentials
|
|
1261
|
+
*/
|
|
1262
|
+
int32_t
|
|
1263
|
+
/* fn */ ditto_auth_client_logout (
|
|
1264
|
+
CDitto_t const * ditto);
|
|
1265
|
+
|
|
1266
|
+
/** \brief
|
|
1267
|
+
* An `SdkLoginProvider` that sends the notifications over FFI
|
|
1268
|
+
*/
|
|
1269
|
+
typedef struct CLoginProvider CLoginProvider_t;
|
|
1270
|
+
|
|
1271
|
+
/** \brief
|
|
1272
|
+
* Create a LoginProvider. Ownership passes to the SDK.
|
|
1273
|
+
*
|
|
1274
|
+
* This cannot be freed directly - it should be passed in when creating an
|
|
1275
|
+
* AuthClient.
|
|
1276
|
+
*/
|
|
1277
|
+
CLoginProvider_t *
|
|
1278
|
+
/* fn */ ditto_auth_client_make_login_provider (
|
|
1279
|
+
void * ctx,
|
|
1280
|
+
void (*retain)(void *),
|
|
1281
|
+
void (*release)(void *),
|
|
1282
|
+
void (*expiring_cb)(void *, uint32_t));
|
|
1283
|
+
|
|
1284
|
+
/** \brief
|
|
1285
|
+
* Represents the error code as returned by various FFI functions. It's a
|
|
1286
|
+
* simple integer for now, the codes are specified by each FFI function
|
|
1287
|
+
* individually (for now, we plan to introduce a proper error type in the near
|
|
1288
|
+
* future).
|
|
1289
|
+
* Beware that all errors are not captured here. It is encouraged to use this enum
|
|
1290
|
+
* instead of explicit `status_code` -mostly 0 and 1-.
|
|
1291
|
+
*/
|
|
1292
|
+
typedef enum DittoErrorCode {
|
|
1293
|
+
/** <No documentation available> */
|
|
1294
|
+
DITTO_ERROR_CODE_OK = 0,
|
|
1295
|
+
/** <No documentation available> */
|
|
1296
|
+
DITTO_ERROR_CODE_UNKNOWN = 1,
|
|
1297
|
+
/** <No documentation available> */
|
|
1298
|
+
DITTO_ERROR_CODE_NOT_IMPLEMENTED = 2,
|
|
1299
|
+
/** \brief
|
|
1300
|
+
* Fatal case that ought to never happen.
|
|
1301
|
+
*/
|
|
1302
|
+
DITTO_ERROR_CODE_UNREACHABLE = 2989,
|
|
1303
|
+
/** <No documentation available> */
|
|
1304
|
+
DITTO_ERROR_CODE_FAILED_TO_ACQUIRE_LOCK_FILE = 16777217,
|
|
1305
|
+
/** <No documentation available> */
|
|
1306
|
+
DITTO_ERROR_CODE_INVALID_PASSPHRASE = 33554433,
|
|
1307
|
+
/** <No documentation available> */
|
|
1308
|
+
DITTO_ERROR_CODE_EXTRANEOUS_PASSPHRASE_GIVEN = 33554434,
|
|
1309
|
+
/** <No documentation available> */
|
|
1310
|
+
DITTO_ERROR_CODE_PASSPHRASE_NOT_GIVEN = 33554435,
|
|
1311
|
+
/** <No documentation available> */
|
|
1312
|
+
DITTO_ERROR_CODE_ALREADY_ENCRYPTED = 33554436,
|
|
1313
|
+
/** <No documentation available> */
|
|
1314
|
+
DITTO_ERROR_CODE_ENCRYPTION_FAILED = 33554437,
|
|
1315
|
+
/** <No documentation available> */
|
|
1316
|
+
DITTO_ERROR_CODE_CANNOT_BE_ENCRYPTED = 33554438,
|
|
1317
|
+
/** <No documentation available> */
|
|
1318
|
+
DITTO_ERROR_CODE_NOT_INITIALIZED = 33554439,
|
|
1319
|
+
/** <No documentation available> */
|
|
1320
|
+
DITTO_ERROR_CODE_SORT_FAILED = 50331649,
|
|
1321
|
+
/** <No documentation available> */
|
|
1322
|
+
DITTO_ERROR_CODE_DQL_FAILED_TO_COMPILE_QUERY = 50331650,
|
|
1323
|
+
/** <No documentation available> */
|
|
1324
|
+
DITTO_ERROR_CODE_DQL_UNSUPPORTED = 50331651,
|
|
1325
|
+
/** <No documentation available> */
|
|
1326
|
+
DITTO_ERROR_CODE_DQL_EXECUTION_FAILED = 50331652,
|
|
1327
|
+
} DittoErrorCode_t;
|
|
1328
|
+
|
|
1329
|
+
/** <No documentation available> */
|
|
1330
|
+
DittoErrorCode_t
|
|
1331
|
+
/* fn */ ditto_auth_client_set_peer_signed_info (
|
|
1332
|
+
CDitto_t const * ditto,
|
|
1333
|
+
slice_ref_uint8_t peer_info);
|
|
1334
|
+
|
|
1335
|
+
/** \brief
|
|
1336
|
+
* Set a validity listener.
|
|
1337
|
+
*/
|
|
1338
|
+
void
|
|
1339
|
+
/* fn */ ditto_auth_client_set_validity_listener (
|
|
1340
|
+
CDitto_t const * ditto,
|
|
1341
|
+
void * ctx,
|
|
1342
|
+
void (*retain)(void *),
|
|
1343
|
+
void (*release)(void *),
|
|
1344
|
+
void (*validity_update_cb)(void *, int32_t, int32_t));
|
|
1345
|
+
|
|
1346
|
+
/** <No documentation available> */
|
|
1347
|
+
char *
|
|
1348
|
+
/* fn */ ditto_auth_client_user_id (
|
|
1349
|
+
CDitto_t const * ditto);
|
|
1350
|
+
|
|
1351
|
+
/** <No documentation available> */
|
|
1352
|
+
void
|
|
1353
|
+
/* fn */ ditto_auth_login_provider_free (
|
|
1354
|
+
CLoginProvider_t * login_provider);
|
|
1355
|
+
|
|
1356
|
+
/** <No documentation available> */
|
|
1357
|
+
void
|
|
1358
|
+
/* fn */ ditto_auth_set_login_provider (
|
|
1359
|
+
CDitto_t const * ditto,
|
|
1360
|
+
CLoginProvider_t * login_provider);
|
|
1361
|
+
|
|
1362
|
+
/** <No documentation available> */
|
|
1363
|
+
void
|
|
1364
|
+
/* fn */ ditto_bus_close_stream (
|
|
1365
|
+
CDitto_t const * ditto,
|
|
1366
|
+
uint64_t stream_id);
|
|
1367
|
+
|
|
1368
|
+
/** <No documentation available> */
|
|
1369
|
+
void
|
|
1370
|
+
/* fn */ ditto_bus_enqueue_stream_message (
|
|
1371
|
+
CDitto_t const * ditto,
|
|
1372
|
+
uint64_t stream_id,
|
|
1373
|
+
slice_ref_uint8_t message);
|
|
1374
|
+
|
|
1375
|
+
/** <No documentation available> */
|
|
1376
|
+
typedef enum BusStreamEnqueueReadiness {
|
|
1377
|
+
/** <No documentation available> */
|
|
1378
|
+
BUS_STREAM_ENQUEUE_READINESS_READY,
|
|
1379
|
+
/** <No documentation available> */
|
|
1380
|
+
BUS_STREAM_ENQUEUE_READINESS_NOT_READY,
|
|
1381
|
+
/** <No documentation available> */
|
|
1382
|
+
BUS_STREAM_ENQUEUE_READINESS_ERROR,
|
|
1383
|
+
} BusStreamEnqueueReadiness_t;
|
|
1384
|
+
|
|
1385
|
+
/** <No documentation available> */
|
|
1386
|
+
BusStreamEnqueueReadiness_t
|
|
1387
|
+
/* fn */ ditto_bus_is_stream_ready_to_enqueue (
|
|
1388
|
+
CDitto_t const * ditto,
|
|
1389
|
+
uint64_t stream_id);
|
|
1390
|
+
|
|
1391
|
+
/** <No documentation available> */
|
|
1392
|
+
void
|
|
1393
|
+
/* fn */ ditto_bus_open_stream (
|
|
1394
|
+
CDitto_t const * ditto,
|
|
1395
|
+
slice_ref_uint8_t destination,
|
|
1396
|
+
ReliabilityMode_t reliability_mode,
|
|
1397
|
+
uint64_t open_ctx);
|
|
1398
|
+
|
|
1399
|
+
/** <No documentation available> */
|
|
1400
|
+
void
|
|
1401
|
+
/* fn */ ditto_bus_send_single_message (
|
|
1402
|
+
CDitto_t const * ditto,
|
|
1403
|
+
slice_ref_uint8_t destination,
|
|
1404
|
+
uint64_t send_ctx,
|
|
1405
|
+
ReliabilityMode_t reliability_mode,
|
|
1406
|
+
slice_ref_uint8_t message);
|
|
1407
|
+
|
|
1408
|
+
/** \brief
|
|
1409
|
+
* [`Box`][`rust::Box`]`<[T]>` (fat pointer to a slice),
|
|
1410
|
+
* but with a guaranteed `#[repr(C)]` layout.
|
|
1411
|
+
*
|
|
1412
|
+
* # C layout (for some given type T)
|
|
1413
|
+
*
|
|
1414
|
+
* ```c
|
|
1415
|
+
* typedef struct {
|
|
1416
|
+
* // Cannot be NULL
|
|
1417
|
+
* T * ptr;
|
|
1418
|
+
* size_t len;
|
|
1419
|
+
* } slice_T;
|
|
1420
|
+
* ```
|
|
1421
|
+
*
|
|
1422
|
+
* # Nullable pointer?
|
|
1423
|
+
*
|
|
1424
|
+
* If you want to support the above typedef, but where the `ptr` field is
|
|
1425
|
+
* allowed to be `NULL` (with the contents of `len` then being undefined)
|
|
1426
|
+
* use the `Option< slice_ptr<_> >` type.
|
|
1427
|
+
*/
|
|
1428
|
+
typedef struct slice_boxed_uint8 {
|
|
1429
|
+
/** \brief
|
|
1430
|
+
* Pointer to the first element (if any).
|
|
1431
|
+
*/
|
|
1432
|
+
uint8_t * ptr;
|
|
1433
|
+
|
|
1434
|
+
/** \brief
|
|
1435
|
+
* Element count
|
|
1436
|
+
*/
|
|
1437
|
+
size_t len;
|
|
1438
|
+
} slice_boxed_uint8_t;
|
|
1439
|
+
|
|
1440
|
+
/** \brief
|
|
1441
|
+
* Releases a byte array value returned by DittoStore.
|
|
1442
|
+
*
|
|
1443
|
+
* DittoStore manages its own memory allocations and it is not safe to release
|
|
1444
|
+
* such values with C's `free()`. That's why the structures it returns provide
|
|
1445
|
+
* their own associated `free` function.
|
|
1446
|
+
*
|
|
1447
|
+
* It should be used for values returned by functions like
|
|
1448
|
+
* `ditto_document_cbor`.
|
|
1449
|
+
*/
|
|
1450
|
+
void
|
|
1451
|
+
/* fn */ ditto_c_bytes_free (
|
|
1452
|
+
slice_boxed_uint8_t bytes);
|
|
1453
|
+
|
|
1454
|
+
/** \brief
|
|
1455
|
+
* Releases `char *` value returned by DittoStore.
|
|
1456
|
+
*
|
|
1457
|
+
* DittoStore manages its own memory allocations and it is not safe to release
|
|
1458
|
+
* such values with C's `free()`. That's why the structures it returns provide
|
|
1459
|
+
* their own associated `free` function and this is one we need for `char *`.
|
|
1460
|
+
*
|
|
1461
|
+
* It should be used for values returned by functions like
|
|
1462
|
+
* `ditto_document_id_query_compatible`.
|
|
1463
|
+
*/
|
|
1464
|
+
void
|
|
1465
|
+
/* fn */ ditto_c_string_free (
|
|
1466
|
+
char * s);
|
|
1467
|
+
|
|
1468
|
+
/** \brief
|
|
1469
|
+
* Empty error callback
|
|
1470
|
+
* (useful for passing to `err_cb` functions to ignore errors; use with
|
|
1471
|
+
* caution)
|
|
1472
|
+
*/
|
|
1473
|
+
void
|
|
1474
|
+
/* fn */ ditto_callback_err_nop (
|
|
1475
|
+
int32_t _code,
|
|
1476
|
+
char const * _err,
|
|
1477
|
+
void * _data);
|
|
1478
|
+
|
|
1479
|
+
/** \brief
|
|
1480
|
+
* Empty callback (useful for passing to `free` functions)
|
|
1481
|
+
*/
|
|
1482
|
+
void
|
|
1483
|
+
/* fn */ ditto_callback_nop (
|
|
1484
|
+
void const * _data);
|
|
1485
|
+
|
|
1486
|
+
/** <No documentation available> */
|
|
1487
|
+
typedef struct DittoCancellable DittoCancellable_t;
|
|
1488
|
+
|
|
1489
|
+
/** <No documentation available> */
|
|
1490
|
+
void
|
|
1491
|
+
/* fn */ ditto_cancel (
|
|
1492
|
+
DittoCancellable_t * _cancelable);
|
|
1493
|
+
|
|
1494
|
+
/** \brief
|
|
1495
|
+
* Cancels a resolve callback registered by ditto_resolve_attachment.
|
|
1496
|
+
*
|
|
1497
|
+
* Returns following error codes:
|
|
1498
|
+
*
|
|
1499
|
+
* * `0` -- no error
|
|
1500
|
+
* * `1` -- an error
|
|
1501
|
+
* * `2` -- invalid id
|
|
1502
|
+
* * `3` -- token not found
|
|
1503
|
+
*
|
|
1504
|
+
* In case of a non-zero return value, error message can be retrieved using
|
|
1505
|
+
* `ditto_error_message` function.
|
|
1506
|
+
*/
|
|
1507
|
+
uint32_t
|
|
1508
|
+
/* fn */ ditto_cancel_resolve_attachment (
|
|
1509
|
+
CDitto_t const * ditto,
|
|
1510
|
+
slice_ref_uint8_t id,
|
|
1511
|
+
uint64_t cancel_token);
|
|
1512
|
+
|
|
1513
|
+
/** \brief
|
|
1514
|
+
* The `PathAccessorType` enum allows you to specify (usually from the SDK side
|
|
1515
|
+
* of the FFI) what sort of type you’re trying to access. So for some of the
|
|
1516
|
+
* cases in the enum, e.g. `String`, `Bool`, etc, it’s quite straightforward
|
|
1517
|
+
* what you’re asking for. For something like `Int` it’s a little more complex
|
|
1518
|
+
* in that if the value at the path you’ve provided is an integer _or_ a float
|
|
1519
|
+
* (with no fractional part to it) then it’ll return an integer to you. For
|
|
1520
|
+
* `Array` or `Object` it’ll give you back an array or an object (respectively)
|
|
1521
|
+
* if either the value at the path provided is a `Register` containing an
|
|
1522
|
+
* array/object or if the value at the path provided is an `RGA`/`RWMap`,
|
|
1523
|
+
* respectively.
|
|
1524
|
+
*
|
|
1525
|
+
* There are then the explicit type accessor type cases in that enum, e.g.
|
|
1526
|
+
* `Counter`, `Register`, etc which will only return a value if the “active”
|
|
1527
|
+
* value (most recently updated) at the provided path is a CRDT of the
|
|
1528
|
+
* specified type, otherwise `None` will be returned.
|
|
1529
|
+
*/
|
|
1530
|
+
typedef enum PathAccessorType {
|
|
1531
|
+
/** <No documentation available> */
|
|
1532
|
+
PATH_ACCESSOR_TYPE_STRING,
|
|
1533
|
+
/** <No documentation available> */
|
|
1534
|
+
PATH_ACCESSOR_TYPE_NUMBER,
|
|
1535
|
+
/** <No documentation available> */
|
|
1536
|
+
PATH_ACCESSOR_TYPE_INT,
|
|
1537
|
+
/** <No documentation available> */
|
|
1538
|
+
PATH_ACCESSOR_TYPE_U_INT,
|
|
1539
|
+
/** <No documentation available> */
|
|
1540
|
+
PATH_ACCESSOR_TYPE_FLOAT,
|
|
1541
|
+
/** <No documentation available> */
|
|
1542
|
+
PATH_ACCESSOR_TYPE_DOUBLE,
|
|
1543
|
+
/** <No documentation available> */
|
|
1544
|
+
PATH_ACCESSOR_TYPE_BOOL,
|
|
1545
|
+
/** <No documentation available> */
|
|
1546
|
+
PATH_ACCESSOR_TYPE_NULL,
|
|
1547
|
+
/** <No documentation available> */
|
|
1548
|
+
PATH_ACCESSOR_TYPE_OBJECT,
|
|
1549
|
+
/** <No documentation available> */
|
|
1550
|
+
PATH_ACCESSOR_TYPE_ARRAY,
|
|
1551
|
+
/** <No documentation available> */
|
|
1552
|
+
PATH_ACCESSOR_TYPE_ANY,
|
|
1553
|
+
/** <No documentation available> */
|
|
1554
|
+
PATH_ACCESSOR_TYPE_COUNTER,
|
|
1555
|
+
/** <No documentation available> */
|
|
1556
|
+
PATH_ACCESSOR_TYPE_REGISTER,
|
|
1557
|
+
/** <No documentation available> */
|
|
1558
|
+
PATH_ACCESSOR_TYPE_ATTACHMENT,
|
|
1559
|
+
/** <No documentation available> */
|
|
1560
|
+
PATH_ACCESSOR_TYPE_R_W_MAP,
|
|
1561
|
+
} PathAccessorType_t;
|
|
1562
|
+
|
|
1563
|
+
/** <No documentation available> */
|
|
1564
|
+
typedef struct CBORPathResult {
|
|
1565
|
+
/** <No documentation available> */
|
|
1566
|
+
int32_t status_code;
|
|
1567
|
+
|
|
1568
|
+
/** <No documentation available> */
|
|
1569
|
+
slice_boxed_uint8_t cbor;
|
|
1570
|
+
} CBORPathResult_t;
|
|
1571
|
+
|
|
1572
|
+
/** \brief
|
|
1573
|
+
* Gets the CBOR value at the path in the provided CBOR and returns it if the
|
|
1574
|
+
* value found matches the type requested, otherwise `None` will be returned in
|
|
1575
|
+
* the result.
|
|
1576
|
+
*
|
|
1577
|
+
* If CBOR is returned in the result then the bytes have to be released with
|
|
1578
|
+
* `::ditto_c_bytes_free`.
|
|
1579
|
+
*/
|
|
1580
|
+
CBORPathResult_t
|
|
1581
|
+
/* fn */ ditto_cbor_get_cbor_with_path_type (
|
|
1582
|
+
slice_ref_uint8_t cbor,
|
|
1583
|
+
char const * path,
|
|
1584
|
+
PathAccessorType_t path_type);
|
|
1585
|
+
|
|
1586
|
+
/** \brief
|
|
1587
|
+
* Changes the passphrase and re-encrypts all data. This can take a while,
|
|
1588
|
+
* progress is reported via the progress callback. Returns a progress token
|
|
1589
|
+
* or 0 if a _synchronous_ error occured, in which case the `error_code` out
|
|
1590
|
+
* parameter is set (see error code table below).
|
|
1591
|
+
*
|
|
1592
|
+
* Note that errors can also occur while the operation is in progress. Those
|
|
1593
|
+
* are typically IO errors and are reported via the progress callback.
|
|
1594
|
+
* The combination of `passphrase` and `newPassphrase` have the following
|
|
1595
|
+
* effects:
|
|
1596
|
+
*
|
|
1597
|
+
* - `passphrase = NULL` & `newPassphrase = NULL` -> No-op if not encrypted, otherwise error code
|
|
1598
|
+
* 3.
|
|
1599
|
+
*
|
|
1600
|
+
* - `passphrase = "123"` & `newPassphrase = "123"` -> No-op if encrypted and password is correct,
|
|
1601
|
+
* error code 2 if not encrypted, and error code 1 if encrypted but `passphrase` invalid.
|
|
1602
|
+
*
|
|
1603
|
+
* - `passphrase = NULL` & `newPassphrase = "123"` -> Add encryption. No-op if already encrypted
|
|
1604
|
+
* and passphrase matches, error code 4 if already encrypted but passphrase does not match.
|
|
1605
|
+
*
|
|
1606
|
+
* - `passphrase = "123"` & `newPassphrase = NULL` -> Remove encryption. No op
|
|
1607
|
+
* - if not encrypted.
|
|
1608
|
+
*
|
|
1609
|
+
* - `passphrase = "123"` & `newPassphrase = "456"` -> Re-encrypt. Error code 1 if passphrase
|
|
1610
|
+
* invalid.
|
|
1611
|
+
*/
|
|
1612
|
+
DittoCancellable_t *
|
|
1613
|
+
/* fn */ ditto_change_passphrase (
|
|
1614
|
+
char const * _working_dir,
|
|
1615
|
+
char const * _old_passphrase,
|
|
1616
|
+
char const * _new_passphrase,
|
|
1617
|
+
void * _ctx,
|
|
1618
|
+
void (*_c_cb)(void *),
|
|
1619
|
+
DittoErrorCode_t * _error_code);
|
|
1620
|
+
|
|
1621
|
+
/** \brief
|
|
1622
|
+
* Deregister any presence callback, releasing the receiver on the SDK side.
|
|
1623
|
+
*/
|
|
1624
|
+
void
|
|
1625
|
+
/* fn */ ditto_clear_presence_callback (
|
|
1626
|
+
CDitto_t const * ditto);
|
|
1627
|
+
|
|
1628
|
+
/** \brief
|
|
1629
|
+
* Deregister v1 presence callback, releasing the receiver on the SDK side.
|
|
1630
|
+
*/
|
|
1631
|
+
void
|
|
1632
|
+
/* fn */ ditto_clear_presence_v1_callback (
|
|
1633
|
+
CDitto_t const * ditto);
|
|
1634
|
+
|
|
1635
|
+
/** \brief
|
|
1636
|
+
* Deregister v2 presence callback, releasing the receiver on the SDK side.
|
|
1637
|
+
*/
|
|
1638
|
+
void
|
|
1639
|
+
/* fn */ ditto_clear_presence_v2_callback (
|
|
1640
|
+
CDitto_t const * ditto);
|
|
1641
|
+
|
|
1642
|
+
/** \brief
|
|
1643
|
+
* Deregister v3 presence callback, releasing the receiver on the SDK side.
|
|
1644
|
+
*/
|
|
1645
|
+
void
|
|
1646
|
+
/* fn */ ditto_clear_presence_v3_callback (
|
|
1647
|
+
CDitto_t const * ditto);
|
|
1648
|
+
|
|
1649
|
+
/** <No documentation available> */
|
|
1650
|
+
int32_t
|
|
1651
|
+
/* fn */ ditto_collection (
|
|
1652
|
+
CDitto_t const * ditto,
|
|
1653
|
+
char const * name);
|
|
1654
|
+
|
|
1655
|
+
/** \brief
|
|
1656
|
+
* Write transaction synchronous API.
|
|
1657
|
+
*/
|
|
1658
|
+
typedef struct CWriteTransaction CWriteTransaction_t;
|
|
1659
|
+
|
|
1660
|
+
/** <No documentation available> */
|
|
1661
|
+
typedef struct BoolResult {
|
|
1662
|
+
/** <No documentation available> */
|
|
1663
|
+
int32_t status_code;
|
|
1664
|
+
|
|
1665
|
+
/** <No documentation available> */
|
|
1666
|
+
bool bool_value;
|
|
1667
|
+
} BoolResult_t;
|
|
1668
|
+
|
|
1669
|
+
/** \brief
|
|
1670
|
+
* Evict a document from the collection, using the provided write transaction.
|
|
1671
|
+
*
|
|
1672
|
+
* `was_evicted` is set to indicate whether the document was removed
|
|
1673
|
+
* successfully.
|
|
1674
|
+
*
|
|
1675
|
+
* * [js only] Returns -1 in case of outstanding non-`await`ed transaction operation.
|
|
1676
|
+
*/
|
|
1677
|
+
BoolResult_t
|
|
1678
|
+
/* fn */ ditto_collection_evict (
|
|
1679
|
+
CDitto_t const * ditto,
|
|
1680
|
+
char const * coll_name,
|
|
1681
|
+
CWriteTransaction_t * transaction,
|
|
1682
|
+
slice_ref_uint8_t id);
|
|
1683
|
+
|
|
1684
|
+
/** \brief
|
|
1685
|
+
* `&'lt [T]` but with a guaranteed `#[repr(C)]` layout.
|
|
1686
|
+
*
|
|
1687
|
+
* # C layout (for some given type T)
|
|
1688
|
+
*
|
|
1689
|
+
* ```c
|
|
1690
|
+
* typedef struct {
|
|
1691
|
+
* // Cannot be NULL
|
|
1692
|
+
* T * ptr;
|
|
1693
|
+
* size_t len;
|
|
1694
|
+
* } slice_T;
|
|
1695
|
+
* ```
|
|
1696
|
+
*
|
|
1697
|
+
* # Nullable pointer?
|
|
1698
|
+
*
|
|
1699
|
+
* If you want to support the above typedef, but where the `ptr` field is
|
|
1700
|
+
* allowed to be `NULL` (with the contents of `len` then being undefined)
|
|
1701
|
+
* use the `Option< slice_ptr<_> >` type.
|
|
1702
|
+
*/
|
|
1703
|
+
typedef struct slice_ref_slice_boxed_uint8 {
|
|
1704
|
+
/** \brief
|
|
1705
|
+
* Pointer to the first element (if any).
|
|
1706
|
+
*/
|
|
1707
|
+
slice_boxed_uint8_t const * ptr;
|
|
1708
|
+
|
|
1709
|
+
/** \brief
|
|
1710
|
+
* Element count
|
|
1711
|
+
*/
|
|
1712
|
+
size_t len;
|
|
1713
|
+
} slice_ref_slice_boxed_uint8_t;
|
|
1714
|
+
|
|
1715
|
+
/** \brief
|
|
1716
|
+
* Same as [`Vec<T>`][`rust::Vec`], but with guaranteed `#[repr(C)]` layout
|
|
1717
|
+
*/
|
|
1718
|
+
typedef struct Vec_slice_boxed_uint8 {
|
|
1719
|
+
/** <No documentation available> */
|
|
1720
|
+
slice_boxed_uint8_t * ptr;
|
|
1721
|
+
|
|
1722
|
+
/** <No documentation available> */
|
|
1723
|
+
size_t len;
|
|
1724
|
+
|
|
1725
|
+
/** <No documentation available> */
|
|
1726
|
+
size_t cap;
|
|
1727
|
+
} Vec_slice_boxed_uint8_t;
|
|
1728
|
+
|
|
1729
|
+
/** <No documentation available> */
|
|
1730
|
+
typedef struct DocIdsResult {
|
|
1731
|
+
/** <No documentation available> */
|
|
1732
|
+
int32_t status_code;
|
|
1733
|
+
|
|
1734
|
+
/** <No documentation available> */
|
|
1735
|
+
Vec_slice_boxed_uint8_t ids;
|
|
1736
|
+
} DocIdsResult_t;
|
|
1737
|
+
|
|
1738
|
+
/** \brief
|
|
1739
|
+
* Evict several documents from the collection, using the provided write transaction.
|
|
1740
|
+
*
|
|
1741
|
+
* Returns the list of successfully evicted document ids.
|
|
1742
|
+
*
|
|
1743
|
+
* * [js only] Returns -1 in case of outstanding non-`await`ed transaction operation.
|
|
1744
|
+
*/
|
|
1745
|
+
DocIdsResult_t
|
|
1746
|
+
/* fn */ ditto_collection_evict_by_ids (
|
|
1747
|
+
CDitto_t const * ditto,
|
|
1748
|
+
char const * coll_name,
|
|
1749
|
+
CWriteTransaction_t * transaction,
|
|
1750
|
+
slice_ref_slice_boxed_uint8_t ids);
|
|
1751
|
+
|
|
1752
|
+
/** \brief
|
|
1753
|
+
* Evict all documents returned by the specified query from a collection.
|
|
1754
|
+
*
|
|
1755
|
+
* `out_ids` is set to the list of IDs of all documents successfully evicted.
|
|
1756
|
+
*
|
|
1757
|
+
* [js only] Returns -2 in case of outstanding non-awaited transaction operation.
|
|
1758
|
+
*/
|
|
1759
|
+
DocIdsResult_t
|
|
1760
|
+
/* fn */ ditto_collection_evict_query_str (
|
|
1761
|
+
CDitto_t const * ditto,
|
|
1762
|
+
char const * coll_name,
|
|
1763
|
+
CWriteTransaction_t * transaction,
|
|
1764
|
+
char const * query,
|
|
1765
|
+
slice_ref_uint8_t query_args_cbor,
|
|
1766
|
+
slice_ref_COrderByParam_t order_by_params,
|
|
1767
|
+
int32_t limit,
|
|
1768
|
+
uint32_t offset);
|
|
1769
|
+
|
|
1770
|
+
/** \brief
|
|
1771
|
+
* Database document consisting of an associate `DocumentId` and
|
|
1772
|
+
* `ditto_crdt::Document` pair. Within the `store` crate the association of
|
|
1773
|
+
* these two elements are maintained together within this single structure,
|
|
1774
|
+
* while these elements may be stored separately in upstream or downstream
|
|
1775
|
+
* crates. This type corresponds to the `Record` type in the `replication`
|
|
1776
|
+
* crate, rather than a literal document.
|
|
1777
|
+
*/
|
|
1778
|
+
typedef struct CDocument CDocument_t;
|
|
1779
|
+
|
|
1780
|
+
/** \brief
|
|
1781
|
+
* Same as [`Vec<T>`][`rust::Vec`], but with guaranteed `#[repr(C)]` layout
|
|
1782
|
+
*/
|
|
1783
|
+
typedef struct Vec_CDocument_ptr {
|
|
1784
|
+
/** <No documentation available> */
|
|
1785
|
+
CDocument_t * * ptr;
|
|
1786
|
+
|
|
1787
|
+
/** <No documentation available> */
|
|
1788
|
+
size_t len;
|
|
1789
|
+
|
|
1790
|
+
/** <No documentation available> */
|
|
1791
|
+
size_t cap;
|
|
1792
|
+
} Vec_CDocument_ptr_t;
|
|
1793
|
+
|
|
1794
|
+
/** <No documentation available> */
|
|
1795
|
+
typedef struct DocumentsResult {
|
|
1796
|
+
/** <No documentation available> */
|
|
1797
|
+
int32_t status_code;
|
|
1798
|
+
|
|
1799
|
+
/** <No documentation available> */
|
|
1800
|
+
Vec_CDocument_ptr_t documents;
|
|
1801
|
+
} DocumentsResult_t;
|
|
1802
|
+
|
|
1803
|
+
/** \brief
|
|
1804
|
+
* Execute the specified query.
|
|
1805
|
+
*
|
|
1806
|
+
* `out_documents` is set to the list of all documents successfully retrieved
|
|
1807
|
+
* from the collection.
|
|
1808
|
+
*
|
|
1809
|
+
* [js only] Returns -2 in case of outstanding non-awaited transaction operation.
|
|
1810
|
+
*/
|
|
1811
|
+
DocumentsResult_t
|
|
1812
|
+
/* fn */ ditto_collection_exec_query_str (
|
|
1813
|
+
CDitto_t const * ditto,
|
|
1814
|
+
char const * coll_name,
|
|
1815
|
+
CWriteTransaction_t * txn,
|
|
1816
|
+
char const * query,
|
|
1817
|
+
slice_ref_uint8_t query_args_cbor,
|
|
1818
|
+
slice_ref_COrderByParam_t order_by_params,
|
|
1819
|
+
int32_t limit,
|
|
1820
|
+
uint32_t offset);
|
|
1821
|
+
|
|
1822
|
+
/** \brief
|
|
1823
|
+
* Read transaction synchronous API.
|
|
1824
|
+
*/
|
|
1825
|
+
typedef struct CReadTransaction CReadTransaction_t;
|
|
1826
|
+
|
|
1827
|
+
/** <No documentation available> */
|
|
1828
|
+
typedef struct DocumentsIdsResult {
|
|
1829
|
+
/** <No documentation available> */
|
|
1830
|
+
int32_t status_code;
|
|
1831
|
+
|
|
1832
|
+
/** <No documentation available> */
|
|
1833
|
+
Vec_CDocument_ptr_t documents;
|
|
1834
|
+
|
|
1835
|
+
/** <No documentation available> */
|
|
1836
|
+
Vec_slice_boxed_uint8_t ids;
|
|
1837
|
+
} DocumentsIdsResult_t;
|
|
1838
|
+
|
|
1839
|
+
/** \brief
|
|
1840
|
+
* [js only] Returns `-1` in case of outstanding non-`awaited` transaction operation.
|
|
1841
|
+
*/
|
|
1842
|
+
DocumentsIdsResult_t
|
|
1843
|
+
/* fn */ ditto_collection_find_by_ids (
|
|
1844
|
+
CDitto_t const * ditto,
|
|
1845
|
+
char const * coll_name,
|
|
1846
|
+
slice_ref_slice_boxed_uint8_t ids,
|
|
1847
|
+
CReadTransaction_t * transaction);
|
|
1848
|
+
|
|
1849
|
+
/** <No documentation available> */
|
|
1850
|
+
typedef struct DocumentResult {
|
|
1851
|
+
/** <No documentation available> */
|
|
1852
|
+
int32_t status_code;
|
|
1853
|
+
|
|
1854
|
+
/** <No documentation available> */
|
|
1855
|
+
CDocument_t * document;
|
|
1856
|
+
} DocumentResult_t;
|
|
1857
|
+
|
|
1858
|
+
/** \brief
|
|
1859
|
+
* [js only] Returns `-1` in case of outstanding non-`awaited` transaction operation.
|
|
1860
|
+
*/
|
|
1861
|
+
DocumentResult_t
|
|
1862
|
+
/* fn */ ditto_collection_get (
|
|
1863
|
+
CDitto_t const * ditto,
|
|
1864
|
+
char const * coll_name,
|
|
1865
|
+
slice_ref_uint8_t id,
|
|
1866
|
+
CReadTransaction_t * transaction);
|
|
1867
|
+
|
|
1868
|
+
/** <No documentation available> */
|
|
1869
|
+
typedef enum WriteStrategyRs {
|
|
1870
|
+
/** \brief
|
|
1871
|
+
* Create or merge with existing data
|
|
1872
|
+
*/
|
|
1873
|
+
WRITE_STRATEGY_RS_MERGE,
|
|
1874
|
+
/** \brief
|
|
1875
|
+
* Only insert if no document already exists with the same document ID
|
|
1876
|
+
*/
|
|
1877
|
+
WRITE_STRATEGY_RS_INSERT_IF_ABSENT,
|
|
1878
|
+
/** \brief
|
|
1879
|
+
* Insert as default data, only if no document already exists with the same
|
|
1880
|
+
* document ID
|
|
1881
|
+
*/
|
|
1882
|
+
WRITE_STRATEGY_RS_INSERT_DEFAULT_IF_ABSENT,
|
|
1883
|
+
/** \brief
|
|
1884
|
+
* This works as follows:
|
|
1885
|
+
* - If the document does not exist, it is created with the given value
|
|
1886
|
+
* - If the document exists, the value is compared to the document's current value, any
|
|
1887
|
+
* differing leaf's values in the Document are updated to match the given value. Nothing is
|
|
1888
|
+
* removed.
|
|
1889
|
+
*/
|
|
1890
|
+
WRITE_STRATEGY_RS_UPDATE_DIFFERENT_VALUES,
|
|
1891
|
+
} WriteStrategyRs_t;
|
|
1892
|
+
|
|
1893
|
+
/** <No documentation available> */
|
|
1894
|
+
typedef struct DocIdResult {
|
|
1895
|
+
/** <No documentation available> */
|
|
1896
|
+
int32_t status_code;
|
|
1897
|
+
|
|
1898
|
+
/** <No documentation available> */
|
|
1899
|
+
slice_boxed_uint8_t id;
|
|
1900
|
+
} DocIdResult_t;
|
|
1901
|
+
|
|
1902
|
+
/** \brief
|
|
1903
|
+
* Inserts a document into the store.
|
|
1904
|
+
*
|
|
1905
|
+
* If an ID is provided explicitly via the `doc_id` parameter then that will be
|
|
1906
|
+
* used as the document's ID. If an ID is provided implicitly via the
|
|
1907
|
+
* document's value (`doc_cbor`) then that will be used as the document's ID,
|
|
1908
|
+
* assuming no explicit ID was provided. If neither an explicit nor an implicit
|
|
1909
|
+
* document ID was provided then a new document ID will be generated and used
|
|
1910
|
+
* as the new document's ID.
|
|
1911
|
+
*
|
|
1912
|
+
* Return codes:
|
|
1913
|
+
*
|
|
1914
|
+
* * `0` -- success
|
|
1915
|
+
* * `1` -- improper CBOR provided for the document value
|
|
1916
|
+
* * `2` -- invalid CBOR for the document value (i.e. the CBOR could be parsed but it represented a
|
|
1917
|
+
* non-`Object` value)
|
|
1918
|
+
* * `3` -- unable to create document ID from value at `_id` key in document's value (`doc_cbor`
|
|
1919
|
+
* argument)
|
|
1920
|
+
* * `4` -- (js only) concurrent database operation (missing `await`?)
|
|
1921
|
+
*/
|
|
1922
|
+
DocIdResult_t
|
|
1923
|
+
/* fn */ ditto_collection_insert_value (
|
|
1924
|
+
CDitto_t const * ditto,
|
|
1925
|
+
char const * coll_name,
|
|
1926
|
+
slice_ref_uint8_t doc_cbor,
|
|
1927
|
+
WriteStrategyRs_t write_strategy,
|
|
1928
|
+
char const * log_hint,
|
|
1929
|
+
CWriteTransaction_t * txn);
|
|
1930
|
+
|
|
1931
|
+
/** \brief
|
|
1932
|
+
* Remove a document from the collection, using the provided write transaction.
|
|
1933
|
+
*
|
|
1934
|
+
* `was_removed` is set to indicate whether the document was removed
|
|
1935
|
+
* successfully.
|
|
1936
|
+
*
|
|
1937
|
+
* * [js only] Returns -1 in case of outstanding non-`await`ed transaction operation.
|
|
1938
|
+
*/
|
|
1939
|
+
BoolResult_t
|
|
1940
|
+
/* fn */ ditto_collection_remove (
|
|
1941
|
+
CDitto_t const * ditto,
|
|
1942
|
+
char const * coll_name,
|
|
1943
|
+
CWriteTransaction_t * transaction,
|
|
1944
|
+
slice_ref_uint8_t id);
|
|
1945
|
+
|
|
1946
|
+
/** \brief
|
|
1947
|
+
* Remove documents from the collection, using the provided write transaction.
|
|
1948
|
+
*
|
|
1949
|
+
* Return the list of successfully removed DocumentId
|
|
1950
|
+
*
|
|
1951
|
+
* Will return an error if the number of keys is greater than 1024.
|
|
1952
|
+
* * [js only] Returns -1 in case of outstanding non-`await`ed transaction operation.
|
|
1953
|
+
*/
|
|
1954
|
+
DocIdsResult_t
|
|
1955
|
+
/* fn */ ditto_collection_remove_by_ids (
|
|
1956
|
+
CDitto_t const * ditto,
|
|
1957
|
+
char const * coll_name,
|
|
1958
|
+
CWriteTransaction_t * transaction,
|
|
1959
|
+
slice_ref_slice_boxed_uint8_t ids);
|
|
1960
|
+
|
|
1961
|
+
/** \brief
|
|
1962
|
+
* Remove all documents returned by the specified query from a collection.
|
|
1963
|
+
*
|
|
1964
|
+
* `out_ids` is set to the list of IDs of all documents successfully removed.
|
|
1965
|
+
*
|
|
1966
|
+
* [js only] Returns -2 in case of outstanding non-awaited transaction operation.
|
|
1967
|
+
*/
|
|
1968
|
+
DocIdsResult_t
|
|
1969
|
+
/* fn */ ditto_collection_remove_query_str (
|
|
1970
|
+
CDitto_t const * ditto,
|
|
1971
|
+
char const * coll_name,
|
|
1972
|
+
CWriteTransaction_t * transaction,
|
|
1973
|
+
char const * query,
|
|
1974
|
+
slice_ref_uint8_t query_args_cbor,
|
|
1975
|
+
slice_ref_COrderByParam_t order_by_params,
|
|
1976
|
+
int32_t limit,
|
|
1977
|
+
uint32_t offset);
|
|
1978
|
+
|
|
1979
|
+
/** \brief
|
|
1980
|
+
* [js only] Returns -1 in case of outstanding non-awaited transaction operation.
|
|
1981
|
+
*/
|
|
1982
|
+
int32_t
|
|
1983
|
+
/* fn */ ditto_collection_update (
|
|
1984
|
+
CDitto_t const * ditto,
|
|
1985
|
+
char const * coll_name,
|
|
1986
|
+
CWriteTransaction_t * transaction,
|
|
1987
|
+
CDocument_t * document);
|
|
1988
|
+
|
|
1989
|
+
/** \brief
|
|
1990
|
+
* Update multiple documents in a collection, using the provided write
|
|
1991
|
+
* transaction.
|
|
1992
|
+
*
|
|
1993
|
+
* # Return Values
|
|
1994
|
+
*
|
|
1995
|
+
* - Returns `0` if all links were successfully updated in all documents.
|
|
1996
|
+
* - Returns `-1` if one or more documents' links fail to all update
|
|
1997
|
+
* successfully, but all documents themselves are successfully updated. Note
|
|
1998
|
+
* that in the event of an attachment failing to update, updates are still
|
|
1999
|
+
* attempted on the rest of the attachments and the rest of the documents.
|
|
2000
|
+
* - If a document fails to update, the appropriate error code is returned for
|
|
2001
|
+
* the cause of the failure. Note that if a document fails to update, no more
|
|
2002
|
+
* document updates are attempted.
|
|
2003
|
+
*/
|
|
2004
|
+
int32_t
|
|
2005
|
+
/* fn */ ditto_collection_update_multiple (
|
|
2006
|
+
CDitto_t const * ditto,
|
|
2007
|
+
char const * coll_name,
|
|
2008
|
+
CWriteTransaction_t * transaction,
|
|
2009
|
+
Vec_CDocument_ptr_t documents);
|
|
2010
|
+
|
|
2011
|
+
/** <No documentation available> */
|
|
2012
|
+
int32_t
|
|
2013
|
+
/* fn */ ditto_disable_sync_with_v3 (
|
|
2014
|
+
CDitto_t const * ditto);
|
|
2015
|
+
|
|
2016
|
+
/** \brief
|
|
2017
|
+
* List of components using the file storage system
|
|
2018
|
+
*/
|
|
2019
|
+
/** \remark Has the same ABI as `uint8_t` **/
|
|
2020
|
+
#ifdef DOXYGEN
|
|
2021
|
+
typedef
|
|
2022
|
+
#endif
|
|
2023
|
+
enum FsComponent {
|
|
2024
|
+
/** <No documentation available> */
|
|
2025
|
+
FS_COMPONENT_ROOT = 0,
|
|
2026
|
+
/** <No documentation available> */
|
|
2027
|
+
FS_COMPONENT_STORE,
|
|
2028
|
+
/** <No documentation available> */
|
|
2029
|
+
FS_COMPONENT_AUTH,
|
|
2030
|
+
/** <No documentation available> */
|
|
2031
|
+
FS_COMPONENT_REPLICATION,
|
|
2032
|
+
/** <No documentation available> */
|
|
2033
|
+
FS_COMPONENT_ATTACHMENT,
|
|
2034
|
+
}
|
|
2035
|
+
#ifndef DOXYGEN
|
|
2036
|
+
; typedef uint8_t
|
|
2037
|
+
#endif
|
|
2038
|
+
FsComponent_t;
|
|
2039
|
+
|
|
2040
|
+
/** \brief
|
|
2041
|
+
* Get a cbor repr of the disk usage
|
|
2042
|
+
*/
|
|
2043
|
+
slice_boxed_uint8_t
|
|
2044
|
+
/* fn */ ditto_disk_usage (
|
|
2045
|
+
CDitto_t const * ditto,
|
|
2046
|
+
FsComponent_t path);
|
|
2047
|
+
|
|
2048
|
+
/** \brief
|
|
2049
|
+
* Document's CBOR
|
|
2050
|
+
*/
|
|
2051
|
+
slice_boxed_uint8_t
|
|
2052
|
+
/* fn */ ditto_document_cbor (
|
|
2053
|
+
CDocument_t const * document);
|
|
2054
|
+
|
|
2055
|
+
/** \brief
|
|
2056
|
+
* Releases the document
|
|
2057
|
+
*/
|
|
2058
|
+
void
|
|
2059
|
+
/* fn */ ditto_document_free (
|
|
2060
|
+
CDocument_t * document);
|
|
2061
|
+
|
|
2062
|
+
/** \brief
|
|
2063
|
+
* Gets the CBOR value at the path in the provided document and returns it if
|
|
2064
|
+
* the value found matches the type requested, otherwise `None` will be
|
|
2065
|
+
* returned in the result.
|
|
2066
|
+
*
|
|
2067
|
+
* To understand how this is intended to be used it might be instructive to see
|
|
2068
|
+
* how things work in the DittoDocumentPath of the Swift SDK, for example:
|
|
2069
|
+
* <https://github.com/getditto/ditto/blob/v2/cocoa/DittoSwift/Store/DittoDocumentPath.swift#L63-L277>
|
|
2070
|
+
*
|
|
2071
|
+
* where the valueAtPathInDocumentWithType implementation looks like this:
|
|
2072
|
+
* <https://github.com/getditto/ditto/blob/259cfa64dd2c6b36ffee2e97514695ccbfff6755/cocoa/DittoSwift/Store/Internal/ValueAtPath.swift#L42-L49>
|
|
2073
|
+
*
|
|
2074
|
+
* Note: all the of the values returned by
|
|
2075
|
+
* `ditto_document_get_cbor_with_path_type` are untyped (i.e. there’s never an
|
|
2076
|
+
* object with `_value` and `_ditto_internal_type_jkb12973t4b` keys being
|
|
2077
|
+
* returned). For example, if you request a value at a path with a
|
|
2078
|
+
* `PathAccessorType` of `Counter` and there is indeed a counter at that path
|
|
2079
|
+
* then the value (as CBOR) that will be returned will be the `f64`/`double`
|
|
2080
|
+
* representation of the counter’s value, on its own.
|
|
2081
|
+
*
|
|
2082
|
+
* If CBOR is returned in the result then the bytes have to be released with
|
|
2083
|
+
* `::ditto_c_bytes_free`.
|
|
2084
|
+
*/
|
|
2085
|
+
CBORPathResult_t
|
|
2086
|
+
/* fn */ ditto_document_get_cbor_with_path_type (
|
|
2087
|
+
CDocument_t const * document,
|
|
2088
|
+
char const * pointer,
|
|
2089
|
+
PathAccessorType_t path_type);
|
|
2090
|
+
|
|
2091
|
+
/** \brief
|
|
2092
|
+
* Document's ID
|
|
2093
|
+
*
|
|
2094
|
+
* The resulting bytes have to be freed with `::ditto_c_bytes_free`
|
|
2095
|
+
*/
|
|
2096
|
+
slice_boxed_uint8_t
|
|
2097
|
+
/* fn */ ditto_document_id (
|
|
2098
|
+
CDocument_t const * document);
|
|
2099
|
+
|
|
2100
|
+
/** \brief
|
|
2101
|
+
* Defines how string primitives should be encoded. This is relevant if a
|
|
2102
|
+
* document ID was created from a string. There are occasions when we want the
|
|
2103
|
+
* stringified representation of the document ID do include quotes around the
|
|
2104
|
+
* string, for example when creating a query like `_id == "abc"`. However,
|
|
2105
|
+
* there are also times when we want to return the string as just a string, for
|
|
2106
|
+
* example when we're injecting a document ID into a document's value before
|
|
2107
|
+
* then serializing the document and sending those bytes across the FFI
|
|
2108
|
+
* boundary.
|
|
2109
|
+
*/
|
|
2110
|
+
typedef enum StringPrimitiveFormat {
|
|
2111
|
+
/** <No documentation available> */
|
|
2112
|
+
STRING_PRIMITIVE_FORMAT_WITH_QUOTES,
|
|
2113
|
+
/** <No documentation available> */
|
|
2114
|
+
STRING_PRIMITIVE_FORMAT_WITHOUT_QUOTES,
|
|
2115
|
+
} StringPrimitiveFormat_t;
|
|
2116
|
+
|
|
2117
|
+
/** \brief
|
|
2118
|
+
* Convert a document ID from CBOR bytes into a Ditto query language compatible
|
|
2119
|
+
* string.
|
|
2120
|
+
*
|
|
2121
|
+
* The resulting string has to be freed with `::ditto_c_string_free`
|
|
2122
|
+
*/
|
|
2123
|
+
char *
|
|
2124
|
+
/* fn */ ditto_document_id_query_compatible (
|
|
2125
|
+
slice_ref_uint8_t id,
|
|
2126
|
+
StringPrimitiveFormat_t string_primitive_format);
|
|
2127
|
+
|
|
2128
|
+
/** <No documentation available> */
|
|
2129
|
+
int32_t
|
|
2130
|
+
/* fn */ ditto_document_increment_counter (
|
|
2131
|
+
CDocument_t * document,
|
|
2132
|
+
char const * pointer,
|
|
2133
|
+
double amount);
|
|
2134
|
+
|
|
2135
|
+
/** \brief
|
|
2136
|
+
* Removes a value from a document. Only object properties can be removed. If the
|
|
2137
|
+
* `pointer` points to an array index, the removal will fail. To update an array
|
|
2138
|
+
* within a register, see `ditto_document_update`.
|
|
2139
|
+
*
|
|
2140
|
+
* # Arguments
|
|
2141
|
+
*
|
|
2142
|
+
* * `document` - A pointer to the document which was previously returned from a query.
|
|
2143
|
+
* * `pointer` - A JMESPath _pointer_ to a property within `document` which is to be removed.
|
|
2144
|
+
*
|
|
2145
|
+
* # Returns
|
|
2146
|
+
*
|
|
2147
|
+
* `0` if the remove was successful or non-zero to indicate failure. To
|
|
2148
|
+
* retrieve an error message in the case of failure, call
|
|
2149
|
+
* `ditto_error_message()`.
|
|
2150
|
+
*/
|
|
2151
|
+
int32_t
|
|
2152
|
+
/* fn */ ditto_document_remove (
|
|
2153
|
+
CDocument_t * document,
|
|
2154
|
+
char const * pointer);
|
|
2155
|
+
|
|
2156
|
+
/** <No documentation available> */
|
|
2157
|
+
int32_t
|
|
2158
|
+
/* fn */ ditto_document_set_cbor (
|
|
2159
|
+
CDocument_t * document,
|
|
2160
|
+
char const * pointer,
|
|
2161
|
+
slice_ref_uint8_t cbor);
|
|
2162
|
+
|
|
2163
|
+
/** <No documentation available> */
|
|
2164
|
+
int32_t
|
|
2165
|
+
/* fn */ ditto_document_set_cbor_with_timestamp (
|
|
2166
|
+
CDocument_t * document,
|
|
2167
|
+
char const * pointer,
|
|
2168
|
+
slice_ref_uint8_t cbor,
|
|
2169
|
+
uint32_t _timestamp);
|
|
2170
|
+
|
|
2171
|
+
/** \brief
|
|
2172
|
+
* Updates the document with values taken from provided CBOR data.
|
|
2173
|
+
*
|
|
2174
|
+
* Returns following error codes:
|
|
2175
|
+
*
|
|
2176
|
+
* * `0` -- no error
|
|
2177
|
+
* * `1` -- invalid CBOR data
|
|
2178
|
+
* * `2` -- CBOR data was not a map
|
|
2179
|
+
* * `3` -- update error
|
|
2180
|
+
* * `4` -- `_id` key provided
|
|
2181
|
+
* * `5` -- invalid value
|
|
2182
|
+
*
|
|
2183
|
+
* In case of a non-zero return value, error message can be retrieved using
|
|
2184
|
+
* `::ditto_error_message` function.
|
|
2185
|
+
*/
|
|
2186
|
+
int32_t
|
|
2187
|
+
/* fn */ ditto_document_update (
|
|
2188
|
+
CDocument_t * document,
|
|
2189
|
+
slice_ref_uint8_t cbor);
|
|
2190
|
+
|
|
2191
|
+
/** \brief
|
|
2192
|
+
* `&'lt [T]` but with a guaranteed `#[repr(C)]` layout.
|
|
2193
|
+
*
|
|
2194
|
+
* # C layout (for some given type T)
|
|
2195
|
+
*
|
|
2196
|
+
* ```c
|
|
2197
|
+
* typedef struct {
|
|
2198
|
+
* // Cannot be NULL
|
|
2199
|
+
* T * ptr;
|
|
2200
|
+
* size_t len;
|
|
2201
|
+
* } slice_T;
|
|
2202
|
+
* ```
|
|
2203
|
+
*
|
|
2204
|
+
* # Nullable pointer?
|
|
2205
|
+
*
|
|
2206
|
+
* If you want to support the above typedef, but where the `ptr` field is
|
|
2207
|
+
* allowed to be `NULL` (with the contents of `len` then being undefined)
|
|
2208
|
+
* use the `Option< slice_ptr<_> >` type.
|
|
2209
|
+
*/
|
|
2210
|
+
typedef struct slice_ref_CDocument_ptr {
|
|
2211
|
+
/** \brief
|
|
2212
|
+
* Pointer to the first element (if any).
|
|
2213
|
+
*/
|
|
2214
|
+
CDocument_t * const * ptr;
|
|
2215
|
+
|
|
2216
|
+
/** \brief
|
|
2217
|
+
* Element count
|
|
2218
|
+
*/
|
|
2219
|
+
size_t len;
|
|
2220
|
+
} slice_ref_CDocument_ptr_t;
|
|
2221
|
+
|
|
2222
|
+
/** <No documentation available> */
|
|
2223
|
+
typedef struct U64Result {
|
|
2224
|
+
/** <No documentation available> */
|
|
2225
|
+
int32_t status_code;
|
|
2226
|
+
|
|
2227
|
+
/** <No documentation available> */
|
|
2228
|
+
uint64_t u64;
|
|
2229
|
+
} U64Result_t;
|
|
2230
|
+
|
|
2231
|
+
/** <No documentation available> */
|
|
2232
|
+
U64Result_t
|
|
2233
|
+
/* fn */ ditto_documents_hash (
|
|
2234
|
+
slice_ref_CDocument_ptr_t documents);
|
|
2235
|
+
|
|
2236
|
+
/** <No documentation available> */
|
|
2237
|
+
BoxedCharPtrResult_t
|
|
2238
|
+
/* fn */ ditto_documents_hash_mnemonic (
|
|
2239
|
+
slice_ref_CDocument_ptr_t documents);
|
|
2240
|
+
|
|
2241
|
+
/** <No documentation available> */
|
|
2242
|
+
typedef struct CDqlResponse CDqlResponse_t;
|
|
2243
|
+
|
|
2244
|
+
/** <No documentation available> */
|
|
2245
|
+
slice_boxed_uint8_t
|
|
2246
|
+
/* fn */ ditto_dql_response_affected_document_id_at (
|
|
2247
|
+
CDqlResponse_t const * response,
|
|
2248
|
+
size_t idx);
|
|
2249
|
+
|
|
2250
|
+
/** <No documentation available> */
|
|
2251
|
+
size_t
|
|
2252
|
+
/* fn */ ditto_dql_response_affected_document_id_count (
|
|
2253
|
+
CDqlResponse_t const * response);
|
|
2254
|
+
|
|
2255
|
+
/** <No documentation available> */
|
|
2256
|
+
void
|
|
2257
|
+
/* fn */ ditto_dql_response_free (
|
|
2258
|
+
CDqlResponse_t * response);
|
|
2259
|
+
|
|
2260
|
+
/** <No documentation available> */
|
|
2261
|
+
typedef struct CDqlResult CDqlResult_t;
|
|
2262
|
+
|
|
2263
|
+
/** <No documentation available> */
|
|
2264
|
+
CDqlResult_t *
|
|
2265
|
+
/* fn */ ditto_dql_response_result_at (
|
|
2266
|
+
CDqlResponse_t const * response,
|
|
2267
|
+
size_t idx);
|
|
2268
|
+
|
|
2269
|
+
/** <No documentation available> */
|
|
2270
|
+
size_t
|
|
2271
|
+
/* fn */ ditto_dql_response_result_count (
|
|
2272
|
+
CDqlResponse_t const * response);
|
|
2273
|
+
|
|
2274
|
+
/** <No documentation available> */
|
|
2275
|
+
void
|
|
2276
|
+
/* fn */ ditto_dql_result_free (
|
|
2277
|
+
CDqlResult_t * result);
|
|
2278
|
+
|
|
2279
|
+
/** \brief
|
|
2280
|
+
* Retrieves last thread-local error message (used by some synchronous APIs)
|
|
2281
|
+
* and removes it. Subsequent call to this function (if nothing else has
|
|
2282
|
+
* happened) will always return `NULL`.
|
|
2283
|
+
*
|
|
2284
|
+
* Returns `NULL` if there was no error. A non-null result MUST be freed using
|
|
2285
|
+
* `ditto_c_string_free`.
|
|
2286
|
+
*/
|
|
2287
|
+
char *
|
|
2288
|
+
/* fn */ ditto_error_message (void);
|
|
2289
|
+
|
|
2290
|
+
/** \brief
|
|
2291
|
+
* Retrieves last thread-local error message (used by some synchronous APIs)
|
|
2292
|
+
* and retains ownership of it.
|
|
2293
|
+
*
|
|
2294
|
+
* Returns `NULL` if there was no error. A non-null result MUST be freed using
|
|
2295
|
+
* `ditto_c_string_free`.
|
|
2296
|
+
*/
|
|
2297
|
+
char *
|
|
2298
|
+
/* fn */ ditto_error_message_peek (void);
|
|
2299
|
+
|
|
2300
|
+
/** <No documentation available> */
|
|
2301
|
+
typedef struct UninitializedDitto UninitializedDitto_t;
|
|
2302
|
+
|
|
2303
|
+
/** <No documentation available> */
|
|
2304
|
+
typedef struct CIdentityConfig CIdentityConfig_t;
|
|
2305
|
+
|
|
2306
|
+
/** \brief
|
|
2307
|
+
* Whether or not history tracking is enabled.
|
|
2308
|
+
*/
|
|
2309
|
+
typedef enum HistoryTracking {
|
|
2310
|
+
/** <No documentation available> */
|
|
2311
|
+
HISTORY_TRACKING_ENABLED,
|
|
2312
|
+
/** <No documentation available> */
|
|
2313
|
+
HISTORY_TRACKING_DISABLED,
|
|
2314
|
+
} HistoryTracking_t;
|
|
2315
|
+
|
|
2316
|
+
/** \brief
|
|
2317
|
+
* Same as `ditto_make()`, only takes an additional `passphrase` and an out
|
|
2318
|
+
* `error_code` parameter.
|
|
2319
|
+
*
|
|
2320
|
+
* Returns the Ditto pointer on success. On failure, returns `NULL` and sets the
|
|
2321
|
+
* out `error_code` parameter (1 or 2 possible here, plus IO errors).
|
|
2322
|
+
*/
|
|
2323
|
+
CDitto_t *
|
|
2324
|
+
/* fn */ ditto_experimental_make_with_passphrase (
|
|
2325
|
+
UninitializedDitto_t * uninit_ditto,
|
|
2326
|
+
CIdentityConfig_t * identity_config,
|
|
2327
|
+
HistoryTracking_t history_tracking,
|
|
2328
|
+
char const * passphrase,
|
|
2329
|
+
DittoErrorCode_t * error_code);
|
|
2330
|
+
|
|
2331
|
+
/** \brief
|
|
2332
|
+
* Frees the `Ditto` object.
|
|
2333
|
+
*
|
|
2334
|
+
* It is expected that `ditto_shutdown` will have been called before this is called.
|
|
2335
|
+
*/
|
|
2336
|
+
void
|
|
2337
|
+
/* fn */ ditto_free (
|
|
2338
|
+
CDitto_t * ditto);
|
|
2339
|
+
|
|
2340
|
+
/** \brief
|
|
2341
|
+
* A shared read-only reference to an existing Attachment.
|
|
2342
|
+
*/
|
|
2343
|
+
typedef struct AttachmentHandle AttachmentHandle_t;
|
|
2344
|
+
|
|
2345
|
+
/** <No documentation available> */
|
|
2346
|
+
void
|
|
2347
|
+
/* fn */ ditto_free_attachment_handle (
|
|
2348
|
+
AttachmentHandle_t * handle);
|
|
2349
|
+
|
|
2350
|
+
/** \brief
|
|
2351
|
+
* Frees a `Vec_CDocument_ptr_t`, used in `c_cb_params`.
|
|
2352
|
+
*
|
|
2353
|
+
* \remark This functions frees both the backing buffer allocation and each
|
|
2354
|
+
* individual `Document` pointer. If ownership has been taken of the latter,
|
|
2355
|
+
* then you must ensure the `len` field of the struct is zeroed before calling
|
|
2356
|
+
* this function.
|
|
2357
|
+
*/
|
|
2358
|
+
void
|
|
2359
|
+
/* fn */ ditto_free_documents (
|
|
2360
|
+
Vec_CDocument_ptr_t documents);
|
|
2361
|
+
|
|
2362
|
+
/** \brief
|
|
2363
|
+
* [`Box`][`rust::Box`]`<[T]>` (fat pointer to a slice),
|
|
2364
|
+
* but with a guaranteed `#[repr(C)]` layout.
|
|
2365
|
+
*
|
|
2366
|
+
* # C layout (for some given type T)
|
|
2367
|
+
*
|
|
2368
|
+
* ```c
|
|
2369
|
+
* typedef struct {
|
|
2370
|
+
* // Cannot be NULL
|
|
2371
|
+
* T * ptr;
|
|
2372
|
+
* size_t len;
|
|
2373
|
+
* } slice_T;
|
|
2374
|
+
* ```
|
|
2375
|
+
*
|
|
2376
|
+
* # Nullable pointer?
|
|
2377
|
+
*
|
|
2378
|
+
* If you want to support the above typedef, but where the `ptr` field is
|
|
2379
|
+
* allowed to be `NULL` (with the contents of `len` then being undefined)
|
|
2380
|
+
* use the `Option< slice_ptr<_> >` type.
|
|
2381
|
+
*/
|
|
2382
|
+
typedef struct slice_boxed_size {
|
|
2383
|
+
/** \brief
|
|
2384
|
+
* Pointer to the first element (if any).
|
|
2385
|
+
*/
|
|
2386
|
+
size_t * ptr;
|
|
2387
|
+
|
|
2388
|
+
/** \brief
|
|
2389
|
+
* Element count
|
|
2390
|
+
*/
|
|
2391
|
+
size_t len;
|
|
2392
|
+
} slice_boxed_size_t;
|
|
2393
|
+
|
|
2394
|
+
/** \brief
|
|
2395
|
+
* Frees a `slice_box_size_t`, used in `c_cb_params`.
|
|
2396
|
+
*/
|
|
2397
|
+
void
|
|
2398
|
+
/* fn */ ditto_free_indices (
|
|
2399
|
+
slice_boxed_size_t indices);
|
|
2400
|
+
|
|
2401
|
+
/** <No documentation available> */
|
|
2402
|
+
typedef struct AttachmentHandleResult {
|
|
2403
|
+
/** <No documentation available> */
|
|
2404
|
+
int32_t status_code;
|
|
2405
|
+
|
|
2406
|
+
/** <No documentation available> */
|
|
2407
|
+
AttachmentHandle_t * handle;
|
|
2408
|
+
} AttachmentHandleResult_t;
|
|
2409
|
+
|
|
2410
|
+
/** <No documentation available> */
|
|
2411
|
+
AttachmentHandleResult_t
|
|
2412
|
+
/* fn */ ditto_get_attachment_status (
|
|
2413
|
+
CDitto_t * ditto,
|
|
2414
|
+
slice_ref_uint8_t id);
|
|
2415
|
+
|
|
2416
|
+
/** \brief
|
|
2417
|
+
* Same as [`Vec<T>`][`rust::Vec`], but with guaranteed `#[repr(C)]` layout
|
|
2418
|
+
*/
|
|
2419
|
+
typedef struct Vec_char_ptr {
|
|
2420
|
+
/** <No documentation available> */
|
|
2421
|
+
char * * ptr;
|
|
2422
|
+
|
|
2423
|
+
/** <No documentation available> */
|
|
2424
|
+
size_t len;
|
|
2425
|
+
|
|
2426
|
+
/** <No documentation available> */
|
|
2427
|
+
size_t cap;
|
|
2428
|
+
} Vec_char_ptr_t;
|
|
2429
|
+
|
|
2430
|
+
/** <No documentation available> */
|
|
2431
|
+
typedef struct CollectionNamesResult {
|
|
2432
|
+
/** <No documentation available> */
|
|
2433
|
+
int32_t status_code;
|
|
2434
|
+
|
|
2435
|
+
/** <No documentation available> */
|
|
2436
|
+
Vec_char_ptr_t names;
|
|
2437
|
+
} CollectionNamesResult_t;
|
|
2438
|
+
|
|
2439
|
+
/** <No documentation available> */
|
|
2440
|
+
CollectionNamesResult_t
|
|
2441
|
+
/* fn */ ditto_get_collection_names (
|
|
2442
|
+
CDitto_t const * ditto);
|
|
2443
|
+
|
|
2444
|
+
/** <No documentation available> */
|
|
2445
|
+
typedef struct AttachmentDataResult {
|
|
2446
|
+
/** <No documentation available> */
|
|
2447
|
+
int8_t status;
|
|
2448
|
+
|
|
2449
|
+
/** <No documentation available> */
|
|
2450
|
+
slice_boxed_uint8_t data;
|
|
2451
|
+
} AttachmentDataResult_t;
|
|
2452
|
+
|
|
2453
|
+
/** <No documentation available> */
|
|
2454
|
+
AttachmentDataResult_t
|
|
2455
|
+
/* fn */ ditto_get_complete_attachment_data (
|
|
2456
|
+
CDitto_t const * ditto,
|
|
2457
|
+
AttachmentHandle_t const * handle);
|
|
2458
|
+
|
|
2459
|
+
/** <No documentation available> */
|
|
2460
|
+
char *
|
|
2461
|
+
/* fn */ ditto_get_complete_attachment_path (
|
|
2462
|
+
CDitto_t const * ditto,
|
|
2463
|
+
AttachmentHandle_t const * handle);
|
|
2464
|
+
|
|
2465
|
+
/** \brief
|
|
2466
|
+
* Returns a human-readable SDK version string, including platform information.
|
|
2467
|
+
* While useful when logging, its exact format or contents ought not to be
|
|
2468
|
+
* relied on.
|
|
2469
|
+
*
|
|
2470
|
+
* The returned string must be freed.
|
|
2471
|
+
*/
|
|
2472
|
+
char *
|
|
2473
|
+
/* fn */ ditto_get_sdk_version (void);
|
|
2474
|
+
|
|
2475
|
+
/** \brief
|
|
2476
|
+
* This is a handle to a tokio oneshot sender that will act as a cross-FFI medium for the
|
|
2477
|
+
* onConnecting API, as the SDK side can send a signal to the with the connection decision
|
|
2478
|
+
* asynchronously, and independently of the the SDK is written in.
|
|
2479
|
+
*
|
|
2480
|
+
* It's used as the "token" which the SDK can pass back to `ditto_handle_on_connecting_response`
|
|
2481
|
+
* so that the handshake can unblock and react to the decision.
|
|
2482
|
+
*/
|
|
2483
|
+
typedef struct OnConnectingResponseHandle OnConnectingResponseHandle_t;
|
|
2484
|
+
|
|
2485
|
+
/** \brief
|
|
2486
|
+
* This is the asynchronous response companion to [`ditto_register_on_connecting`]. It takes the
|
|
2487
|
+
* [`OnConnectingResponseHandle`] given in the [`OnConnectingCallback`] callback and consumes the
|
|
2488
|
+
* handle to send a message to the Ditto core with the user's decision to connect or reject a peer.
|
|
2489
|
+
*/
|
|
2490
|
+
void
|
|
2491
|
+
/* fn */ ditto_handle_on_connecting_response (
|
|
2492
|
+
OnConnectingResponseHandle_t * handle,
|
|
2493
|
+
bool response);
|
|
2494
|
+
|
|
2495
|
+
/** <No documentation available> */
|
|
2496
|
+
typedef struct IdentityConfigResult {
|
|
2497
|
+
/** <No documentation available> */
|
|
2498
|
+
int32_t status_code;
|
|
2499
|
+
|
|
2500
|
+
/** <No documentation available> */
|
|
2501
|
+
CIdentityConfig_t * identity_config;
|
|
2502
|
+
} IdentityConfigResult_t;
|
|
2503
|
+
|
|
2504
|
+
/** <No documentation available> */
|
|
2505
|
+
IdentityConfigResult_t
|
|
2506
|
+
/* fn */ ditto_identity_config_make_manual (
|
|
2507
|
+
char const * manual_identity_str);
|
|
2508
|
+
|
|
2509
|
+
/** <No documentation available> */
|
|
2510
|
+
IdentityConfigResult_t
|
|
2511
|
+
/* fn */ ditto_identity_config_make_manual_v0 (
|
|
2512
|
+
char const * config_cbor_b64);
|
|
2513
|
+
|
|
2514
|
+
/** <No documentation available> */
|
|
2515
|
+
IdentityConfigResult_t
|
|
2516
|
+
/* fn */ ditto_identity_config_make_offline_playground (
|
|
2517
|
+
char const * app_id,
|
|
2518
|
+
uint64_t site_id);
|
|
2519
|
+
|
|
2520
|
+
/** <No documentation available> */
|
|
2521
|
+
IdentityConfigResult_t
|
|
2522
|
+
/* fn */ ditto_identity_config_make_online_playground (
|
|
2523
|
+
char const * app_id,
|
|
2524
|
+
char const * shared_token,
|
|
2525
|
+
char const * base_url);
|
|
2526
|
+
|
|
2527
|
+
/** <No documentation available> */
|
|
2528
|
+
IdentityConfigResult_t
|
|
2529
|
+
/* fn */ ditto_identity_config_make_online_with_authentication (
|
|
2530
|
+
char const * app_id,
|
|
2531
|
+
char const * base_url);
|
|
2532
|
+
|
|
2533
|
+
/** <No documentation available> */
|
|
2534
|
+
IdentityConfigResult_t
|
|
2535
|
+
/* fn */ ditto_identity_config_make_shared_key (
|
|
2536
|
+
char const * app_id,
|
|
2537
|
+
char const * key_der_b64,
|
|
2538
|
+
uint64_t site_id);
|
|
2539
|
+
|
|
2540
|
+
/** <No documentation available> */
|
|
2541
|
+
typedef enum Platform {
|
|
2542
|
+
/** <No documentation available> */
|
|
2543
|
+
PLATFORM_WINDOWS,
|
|
2544
|
+
/** <No documentation available> */
|
|
2545
|
+
PLATFORM_MAC,
|
|
2546
|
+
/** <No documentation available> */
|
|
2547
|
+
PLATFORM_IOS,
|
|
2548
|
+
/** <No documentation available> */
|
|
2549
|
+
PLATFORM_ANDROID,
|
|
2550
|
+
/** <No documentation available> */
|
|
2551
|
+
PLATFORM_LINUX,
|
|
2552
|
+
/** <No documentation available> */
|
|
2553
|
+
PLATFORM_WEB,
|
|
2554
|
+
/** <No documentation available> */
|
|
2555
|
+
PLATFORM_UNKNOWN,
|
|
2556
|
+
} Platform_t;
|
|
2557
|
+
|
|
2558
|
+
/** <No documentation available> */
|
|
2559
|
+
typedef enum Language {
|
|
2560
|
+
/** <No documentation available> */
|
|
2561
|
+
LANGUAGE_SWIFT,
|
|
2562
|
+
/** <No documentation available> */
|
|
2563
|
+
LANGUAGE_OBJECTIVE_C,
|
|
2564
|
+
/** <No documentation available> */
|
|
2565
|
+
LANGUAGE_C_PLUS_PLUS,
|
|
2566
|
+
/** <No documentation available> */
|
|
2567
|
+
LANGUAGE_C_SHARP,
|
|
2568
|
+
/** <No documentation available> */
|
|
2569
|
+
LANGUAGE_JAVA_SCRIPT,
|
|
2570
|
+
/** <No documentation available> */
|
|
2571
|
+
LANGUAGE_UNKNOWN,
|
|
2572
|
+
/** <No documentation available> */
|
|
2573
|
+
LANGUAGE_RUST,
|
|
2574
|
+
} Language_t;
|
|
2575
|
+
|
|
2576
|
+
/** <No documentation available> */
|
|
2577
|
+
void
|
|
2578
|
+
/* fn */ ditto_init_sdk_version (
|
|
2579
|
+
Platform_t platform,
|
|
2580
|
+
Language_t language,
|
|
2581
|
+
char const * sdk_semver);
|
|
2582
|
+
|
|
2583
|
+
typedef struct {
|
|
2584
|
+
uint8_t idx[8];
|
|
2585
|
+
} uint8_8_array_t;
|
|
2586
|
+
|
|
2587
|
+
/** \brief
|
|
2588
|
+
* Construct a new Timeseries Event from the following parts:
|
|
2589
|
+
* * `timestamp` - u64 Unix epoch seconds as 8 big endian bytes
|
|
2590
|
+
* * `nanos` - Number of nanoseconds offset into the current second
|
|
2591
|
+
* * `ts_name` - The name of the timeseries
|
|
2592
|
+
* * `cbor` - The cbor content for the event
|
|
2593
|
+
* * `txn` - An optional write transaction. If one is provided then it will not be committed. If
|
|
2594
|
+
* one is not provided then one will be obtained and it will be committed.
|
|
2595
|
+
*
|
|
2596
|
+
* Return codes:
|
|
2597
|
+
* * `0` -- success
|
|
2598
|
+
* * `1` -- invalid CBOR
|
|
2599
|
+
* * `2` -- `cbor` is not an object
|
|
2600
|
+
* * `3` -- (js only) concurrent database operation (missing `await`?)
|
|
2601
|
+
*/
|
|
2602
|
+
int32_t
|
|
2603
|
+
/* fn */ ditto_insert_timeseries_event (
|
|
2604
|
+
CDitto_t const * ditto,
|
|
2605
|
+
uint8_8_array_t timestamp,
|
|
2606
|
+
uint32_t nanos,
|
|
2607
|
+
char const * ts_name,
|
|
2608
|
+
slice_ref_uint8_t cbor,
|
|
2609
|
+
CWriteTransaction_t * txn);
|
|
2610
|
+
|
|
2611
|
+
/** <No documentation available> */
|
|
2612
|
+
void
|
|
2613
|
+
/* fn */ ditto_invalidate_tcp_listeners (
|
|
2614
|
+
CDitto_t const * ditto);
|
|
2615
|
+
|
|
2616
|
+
/** \brief
|
|
2617
|
+
* Returns `true` if Ditto data at that path is encrypted, otherwise
|
|
2618
|
+
* returns `false`
|
|
2619
|
+
*/
|
|
2620
|
+
bool
|
|
2621
|
+
/* fn */ ditto_is_encrypted (
|
|
2622
|
+
CDitto_t const * ditto);
|
|
2623
|
+
|
|
2624
|
+
/** \brief
|
|
2625
|
+
* Describes how a live query callback's availability should be treated.
|
|
2626
|
+
*
|
|
2627
|
+
* If `Always` is specified then as soon as a transaction is committed that
|
|
2628
|
+
* impacts the live query the consumer-provided callback will be called with
|
|
2629
|
+
* the relevant update information. This can be temporarily delayed if there's
|
|
2630
|
+
* a lot of activity leading to the event receivers lagging or if groups of
|
|
2631
|
+
* transactions are coalesced into a single live query update.
|
|
2632
|
+
*
|
|
2633
|
+
* If `WhenSignalled` is specified then the consumer-provided live query
|
|
2634
|
+
* callback will only be called when there is a transaction committed that
|
|
2635
|
+
* impacts the live query *and* the consumer has signalled that they are ready
|
|
2636
|
+
* to receive a new live query event (via the callback).
|
|
2637
|
+
*/
|
|
2638
|
+
typedef enum LiveQueryAvailability {
|
|
2639
|
+
/** <No documentation available> */
|
|
2640
|
+
LIVE_QUERY_AVAILABILITY_ALWAYS,
|
|
2641
|
+
/** <No documentation available> */
|
|
2642
|
+
LIVE_QUERY_AVAILABILITY_WHEN_SIGNALLED,
|
|
2643
|
+
} LiveQueryAvailability_t;
|
|
2644
|
+
|
|
2645
|
+
/** <No documentation available> */
|
|
2646
|
+
typedef struct c_cb_params {
|
|
2647
|
+
/** \brief
|
|
2648
|
+
* Must be freed with `ditto_free_documents`.
|
|
2649
|
+
*/
|
|
2650
|
+
Vec_CDocument_ptr_t documents;
|
|
2651
|
+
|
|
2652
|
+
/** <No documentation available> */
|
|
2653
|
+
bool is_initial;
|
|
2654
|
+
|
|
2655
|
+
/** \brief
|
|
2656
|
+
* Must be freed with `ditto_free_documents`.
|
|
2657
|
+
*/
|
|
2658
|
+
Vec_CDocument_ptr_t old_documents;
|
|
2659
|
+
|
|
2660
|
+
/** \brief
|
|
2661
|
+
* Must be freed using `ditto_free_indices`.
|
|
2662
|
+
*/
|
|
2663
|
+
slice_boxed_size_t insertions;
|
|
2664
|
+
|
|
2665
|
+
/** \brief
|
|
2666
|
+
* Must be freed using `ditto_free_indices`.
|
|
2667
|
+
*/
|
|
2668
|
+
slice_boxed_size_t deletions;
|
|
2669
|
+
|
|
2670
|
+
/** \brief
|
|
2671
|
+
* Must be freed using `ditto_free_indices`.
|
|
2672
|
+
*/
|
|
2673
|
+
slice_boxed_size_t updates;
|
|
2674
|
+
|
|
2675
|
+
/** \brief
|
|
2676
|
+
* Must be freed using `ditto_free_indices`.
|
|
2677
|
+
*/
|
|
2678
|
+
slice_boxed_size_t moves;
|
|
2679
|
+
} c_cb_params_t;
|
|
2680
|
+
|
|
2681
|
+
/** <No documentation available> */
|
|
2682
|
+
typedef struct I64Result {
|
|
2683
|
+
/** <No documentation available> */
|
|
2684
|
+
int32_t status_code;
|
|
2685
|
+
|
|
2686
|
+
/** <No documentation available> */
|
|
2687
|
+
int64_t i64;
|
|
2688
|
+
} I64Result_t;
|
|
2689
|
+
|
|
2690
|
+
/** \brief
|
|
2691
|
+
* Convenience function for `ditto_live_query_register`, so as not to require
|
|
2692
|
+
* pre-compiling the query.
|
|
2693
|
+
*/
|
|
2694
|
+
I64Result_t
|
|
2695
|
+
/* fn */ ditto_live_query_register_str (
|
|
2696
|
+
CDitto_t const * ditto,
|
|
2697
|
+
char const * coll_name,
|
|
2698
|
+
char const * query,
|
|
2699
|
+
slice_ref_uint8_t query_args_cbor,
|
|
2700
|
+
slice_ref_COrderByParam_t order_by,
|
|
2701
|
+
int32_t limit,
|
|
2702
|
+
uint32_t offset,
|
|
2703
|
+
LiveQueryAvailability_t lq_availability,
|
|
2704
|
+
void * ctx,
|
|
2705
|
+
void (*retain)(void *),
|
|
2706
|
+
void (*release)(void *),
|
|
2707
|
+
void (*c_cb)(void *, c_cb_params_t));
|
|
2708
|
+
|
|
2709
|
+
/** <No documentation available> */
|
|
2710
|
+
void
|
|
2711
|
+
/* fn */ ditto_live_query_signal_available_next (
|
|
2712
|
+
CDitto_t const * ditto,
|
|
2713
|
+
int64_t id);
|
|
2714
|
+
|
|
2715
|
+
/** <No documentation available> */
|
|
2716
|
+
int32_t
|
|
2717
|
+
/* fn */ ditto_live_query_start (
|
|
2718
|
+
CDitto_t const * ditto,
|
|
2719
|
+
int64_t id);
|
|
2720
|
+
|
|
2721
|
+
/** <No documentation available> */
|
|
2722
|
+
void
|
|
2723
|
+
/* fn */ ditto_live_query_stop (
|
|
2724
|
+
CDitto_t const * ditto,
|
|
2725
|
+
int64_t id);
|
|
2726
|
+
|
|
2727
|
+
/** <No documentation available> */
|
|
2728
|
+
int32_t
|
|
2729
|
+
/* fn */ ditto_live_query_webhook_generate_new_api_secret (
|
|
2730
|
+
CDitto_t const * ditto);
|
|
2731
|
+
|
|
2732
|
+
/** <No documentation available> */
|
|
2733
|
+
DocIdResult_t
|
|
2734
|
+
/* fn */ ditto_live_query_webhook_register_str (
|
|
2735
|
+
CDitto_t const * ditto,
|
|
2736
|
+
char const * coll_name,
|
|
2737
|
+
char const * query,
|
|
2738
|
+
slice_ref_COrderByParam_t order_by,
|
|
2739
|
+
int32_t limit,
|
|
2740
|
+
uint32_t offset,
|
|
2741
|
+
char const * url);
|
|
2742
|
+
|
|
2743
|
+
/** <No documentation available> */
|
|
2744
|
+
int32_t
|
|
2745
|
+
/* fn */ ditto_live_query_webhook_start_all (
|
|
2746
|
+
CDitto_t const * ditto);
|
|
2747
|
+
|
|
2748
|
+
/** <No documentation available> */
|
|
2749
|
+
int32_t
|
|
2750
|
+
/* fn */ ditto_live_query_webhook_start_by_id (
|
|
2751
|
+
CDitto_t const * ditto,
|
|
2752
|
+
slice_ref_uint8_t doc_id);
|
|
2753
|
+
|
|
2754
|
+
/** <No documentation available> */
|
|
2755
|
+
typedef enum CLogLevel {
|
|
2756
|
+
/** <No documentation available> */
|
|
2757
|
+
C_LOG_LEVEL_ERROR = 1,
|
|
2758
|
+
/** <No documentation available> */
|
|
2759
|
+
C_LOG_LEVEL_WARNING,
|
|
2760
|
+
/** <No documentation available> */
|
|
2761
|
+
C_LOG_LEVEL_INFO,
|
|
2762
|
+
/** <No documentation available> */
|
|
2763
|
+
C_LOG_LEVEL_DEBUG,
|
|
2764
|
+
/** <No documentation available> */
|
|
2765
|
+
C_LOG_LEVEL_VERBOSE,
|
|
2766
|
+
} CLogLevel_t;
|
|
2767
|
+
|
|
2768
|
+
/** \brief
|
|
2769
|
+
* Log function called over FFI such that logging can be grouped into a single
|
|
2770
|
+
* logging mechanism.
|
|
2771
|
+
*/
|
|
2772
|
+
void
|
|
2773
|
+
/* fn */ ditto_log (
|
|
2774
|
+
CLogLevel_t level,
|
|
2775
|
+
char const * msg);
|
|
2776
|
+
|
|
2777
|
+
/** \brief
|
|
2778
|
+
* Get the path to an on-disk log, collected through a rotating file writer.
|
|
2779
|
+
*
|
|
2780
|
+
* Returns `NULL` if there is no on-disk rotating file writer set up, or if the path could not be
|
|
2781
|
+
* converted to a string.
|
|
2782
|
+
*/
|
|
2783
|
+
char *
|
|
2784
|
+
/* fn */ ditto_logger_collect_on_disk_logs (void);
|
|
2785
|
+
|
|
2786
|
+
/** <No documentation available> */
|
|
2787
|
+
void
|
|
2788
|
+
/* fn */ ditto_logger_emoji_headings_enabled (
|
|
2789
|
+
bool enabled);
|
|
2790
|
+
|
|
2791
|
+
/** <No documentation available> */
|
|
2792
|
+
bool
|
|
2793
|
+
/* fn */ ditto_logger_emoji_headings_enabled_get (void);
|
|
2794
|
+
|
|
2795
|
+
/** <No documentation available> */
|
|
2796
|
+
void
|
|
2797
|
+
/* fn */ ditto_logger_enabled (
|
|
2798
|
+
bool enabled);
|
|
2799
|
+
|
|
2800
|
+
/** <No documentation available> */
|
|
2801
|
+
bool
|
|
2802
|
+
/* fn */ ditto_logger_enabled_get (void);
|
|
2803
|
+
|
|
2804
|
+
/** \brief
|
|
2805
|
+
* Initializes and registers the global Ditto logger.
|
|
2806
|
+
*/
|
|
2807
|
+
void
|
|
2808
|
+
/* fn */ ditto_logger_init (void);
|
|
2809
|
+
|
|
2810
|
+
/** <No documentation available> */
|
|
2811
|
+
void
|
|
2812
|
+
/* fn */ ditto_logger_minimum_log_level (
|
|
2813
|
+
CLogLevel_t log_level);
|
|
2814
|
+
|
|
2815
|
+
/** <No documentation available> */
|
|
2816
|
+
CLogLevel_t
|
|
2817
|
+
/* fn */ ditto_logger_minimum_log_level_get (void);
|
|
2818
|
+
|
|
2819
|
+
/** \brief
|
|
2820
|
+
* Registers a custom logging callback to be called whenever Ditto wants to
|
|
2821
|
+
* issue a log (on _top_ of emitting the log to the console).
|
|
2822
|
+
*
|
|
2823
|
+
* Care should be taken not to perform any Ditto operations within this
|
|
2824
|
+
* callback, since those could emit new ditto logs, leading to a recursive
|
|
2825
|
+
* situation. More specifically, this should not be fed `ditto_log`.
|
|
2826
|
+
*
|
|
2827
|
+
* A `NULL` may be fed to provide no callback (thus unregistering any
|
|
2828
|
+
* previously registered one).
|
|
2829
|
+
*/
|
|
2830
|
+
void
|
|
2831
|
+
/* fn */ ditto_logger_set_custom_log_cb (
|
|
2832
|
+
void (*custom_log_cb)(CLogLevel_t, char const *));
|
|
2833
|
+
|
|
2834
|
+
/** \brief
|
|
2835
|
+
* Registers a file path where logs will be written to, whenever Ditto wants
|
|
2836
|
+
* to issue a log (on _top_ of emitting the log to the console).
|
|
2837
|
+
*
|
|
2838
|
+
* The path, if any, must be within an already existing directory.
|
|
2839
|
+
*
|
|
2840
|
+
* A `NULL` may be fed to provide no file (thus unregistering any previously
|
|
2841
|
+
* registered one).
|
|
2842
|
+
*
|
|
2843
|
+
* Returns `0` on success, and `-1` otherwise (and the thread local error
|
|
2844
|
+
* message is set accordingly).
|
|
2845
|
+
*/
|
|
2846
|
+
int8_t
|
|
2847
|
+
/* fn */ ditto_logger_set_log_file (
|
|
2848
|
+
char const * log_file);
|
|
2849
|
+
|
|
2850
|
+
/** \brief
|
|
2851
|
+
* Make a Ditto object as an opaque pointer. The Ditto object creates the Tokio
|
|
2852
|
+
* runtime and starts internal threads. The return value is a raw pointer whose
|
|
2853
|
+
* only use is to supply as an argument to other ditto_* functions. The Ditto
|
|
2854
|
+
* object must be stopped and freed with ditto_free().
|
|
2855
|
+
*/
|
|
2856
|
+
CDitto_t *
|
|
2857
|
+
/* fn */ ditto_make (
|
|
2858
|
+
UninitializedDitto_t * uninit_ditto,
|
|
2859
|
+
CIdentityConfig_t * identity_config,
|
|
2860
|
+
HistoryTracking_t history_tracking);
|
|
2861
|
+
|
|
2862
|
+
/** <No documentation available> */
|
|
2863
|
+
typedef struct CAttachment {
|
|
2864
|
+
/** <No documentation available> */
|
|
2865
|
+
slice_boxed_uint8_t id;
|
|
2866
|
+
|
|
2867
|
+
/** <No documentation available> */
|
|
2868
|
+
uint64_t len;
|
|
2869
|
+
|
|
2870
|
+
/** <No documentation available> */
|
|
2871
|
+
AttachmentHandle_t * handle;
|
|
2872
|
+
} CAttachment_t;
|
|
2873
|
+
|
|
2874
|
+
/** \brief
|
|
2875
|
+
* Creates new Attachment from a blob of bytes link it to the given Document.
|
|
2876
|
+
*
|
|
2877
|
+
* Returns following error codes:
|
|
2878
|
+
*
|
|
2879
|
+
* * `0` -- no error
|
|
2880
|
+
* * `1` -- an error
|
|
2881
|
+
*
|
|
2882
|
+
* In case of a non-zero return value, error message can be retrieved using
|
|
2883
|
+
* `ditto_error_message` function.
|
|
2884
|
+
*/
|
|
2885
|
+
uint32_t
|
|
2886
|
+
/* fn */ ditto_new_attachment_from_bytes (
|
|
2887
|
+
CDitto_t const * ditto,
|
|
2888
|
+
slice_ref_uint8_t bytes,
|
|
2889
|
+
CAttachment_t * out_attachment);
|
|
2890
|
+
|
|
2891
|
+
/** \brief
|
|
2892
|
+
* Describes how an attachment file should be handled by our Rust code.
|
|
2893
|
+
*
|
|
2894
|
+
* In most cases copying the file will be desirable but with the Android SDK,
|
|
2895
|
+
* for example, we sometimes want to create a tempfile from an InputStream
|
|
2896
|
+
* associated with the attachment file and then move that tempfile rather than
|
|
2897
|
+
* copy it, so as to not make unnecessary copies.
|
|
2898
|
+
*/
|
|
2899
|
+
typedef enum AttachmentFileOperation {
|
|
2900
|
+
/** <No documentation available> */
|
|
2901
|
+
ATTACHMENT_FILE_OPERATION_COPY = 1,
|
|
2902
|
+
/** <No documentation available> */
|
|
2903
|
+
ATTACHMENT_FILE_OPERATION_MOVE,
|
|
2904
|
+
} AttachmentFileOperation_t;
|
|
2905
|
+
|
|
2906
|
+
/** \brief
|
|
2907
|
+
* Creates new Attachment from a file and link it to the given Document.
|
|
2908
|
+
*
|
|
2909
|
+
* Returns following error codes:
|
|
2910
|
+
*
|
|
2911
|
+
* * `0` -- no error
|
|
2912
|
+
* * `1` -- an error
|
|
2913
|
+
* * `2` -- file not found
|
|
2914
|
+
* * `3` -- permission denied
|
|
2915
|
+
*
|
|
2916
|
+
* In case of a non-zero return value, error message can be retrieved using
|
|
2917
|
+
* `ditto_error_message` function.
|
|
2918
|
+
*/
|
|
2919
|
+
uint32_t
|
|
2920
|
+
/* fn */ ditto_new_attachment_from_file (
|
|
2921
|
+
CDitto_t const * ditto,
|
|
2922
|
+
char const * source_path,
|
|
2923
|
+
AttachmentFileOperation_t file_operation,
|
|
2924
|
+
CAttachment_t * out_attachment);
|
|
2925
|
+
|
|
2926
|
+
/** \brief
|
|
2927
|
+
* Allow to free the Vector without dropping the Documents
|
|
2928
|
+
*/
|
|
2929
|
+
void
|
|
2930
|
+
/* fn */ ditto_only_vec_documents_free (
|
|
2931
|
+
Vec_CDocument_ptr_t docs);
|
|
2932
|
+
|
|
2933
|
+
/** \brief
|
|
2934
|
+
* Request data showing who we are connected to in a user-friendly way.
|
|
2935
|
+
*/
|
|
2936
|
+
char *
|
|
2937
|
+
/* fn */ ditto_presence_v1 (
|
|
2938
|
+
CDitto_t const * ditto);
|
|
2939
|
+
|
|
2940
|
+
/** \brief
|
|
2941
|
+
* Request data showing who we are connected to in a user-friendly way.
|
|
2942
|
+
*/
|
|
2943
|
+
char *
|
|
2944
|
+
/* fn */ ditto_presence_v2 (
|
|
2945
|
+
CDitto_t const * ditto);
|
|
2946
|
+
|
|
2947
|
+
/** \brief
|
|
2948
|
+
* Request data showing who we are connected to in a user-friendly way.
|
|
2949
|
+
*/
|
|
2950
|
+
char *
|
|
2951
|
+
/* fn */ ditto_presence_v3 (
|
|
2952
|
+
CDitto_t const * ditto);
|
|
2953
|
+
|
|
2954
|
+
/** \brief
|
|
2955
|
+
* `&'lt [T]` but with a guaranteed `#[repr(C)]` layout.
|
|
2956
|
+
*
|
|
2957
|
+
* # C layout (for some given type T)
|
|
2958
|
+
*
|
|
2959
|
+
* ```c
|
|
2960
|
+
* typedef struct {
|
|
2961
|
+
* // Cannot be NULL
|
|
2962
|
+
* T * ptr;
|
|
2963
|
+
* size_t len;
|
|
2964
|
+
* } slice_T;
|
|
2965
|
+
* ```
|
|
2966
|
+
*
|
|
2967
|
+
* # Nullable pointer?
|
|
2968
|
+
*
|
|
2969
|
+
* If you want to support the above typedef, but where the `ptr` field is
|
|
2970
|
+
* allowed to be `NULL` (with the contents of `len` then being undefined)
|
|
2971
|
+
* use the `Option< slice_ptr<_> >` type.
|
|
2972
|
+
*/
|
|
2973
|
+
typedef struct slice_ref_char_const_ptr {
|
|
2974
|
+
/** \brief
|
|
2975
|
+
* Pointer to the first element (if any).
|
|
2976
|
+
*/
|
|
2977
|
+
char const * const * ptr;
|
|
2978
|
+
|
|
2979
|
+
/** \brief
|
|
2980
|
+
* Element count
|
|
2981
|
+
*/
|
|
2982
|
+
size_t len;
|
|
2983
|
+
} slice_ref_char_const_ptr_t;
|
|
2984
|
+
|
|
2985
|
+
/** <No documentation available> */
|
|
2986
|
+
U64Result_t
|
|
2987
|
+
/* fn */ ditto_queries_hash (
|
|
2988
|
+
CDitto_t const * ditto,
|
|
2989
|
+
slice_ref_char_const_ptr_t coll_names,
|
|
2990
|
+
slice_ref_char_const_ptr_t queries);
|
|
2991
|
+
|
|
2992
|
+
/** <No documentation available> */
|
|
2993
|
+
BoxedCharPtrResult_t
|
|
2994
|
+
/* fn */ ditto_queries_hash_mnemonic (
|
|
2995
|
+
CDitto_t const * ditto,
|
|
2996
|
+
slice_ref_char_const_ptr_t coll_names,
|
|
2997
|
+
slice_ref_char_const_ptr_t queries);
|
|
2998
|
+
|
|
2999
|
+
/** <No documentation available> */
|
|
3000
|
+
typedef struct CReadTransactionResult {
|
|
3001
|
+
/** <No documentation available> */
|
|
3002
|
+
int32_t status_code;
|
|
3003
|
+
|
|
3004
|
+
/** <No documentation available> */
|
|
3005
|
+
CReadTransaction_t * txn;
|
|
3006
|
+
} CReadTransactionResult_t;
|
|
3007
|
+
|
|
3008
|
+
/** <No documentation available> */
|
|
3009
|
+
CReadTransactionResult_t
|
|
3010
|
+
/* fn */ ditto_read_transaction (
|
|
3011
|
+
CDitto_t const * ditto);
|
|
3012
|
+
|
|
3013
|
+
/** <No documentation available> */
|
|
3014
|
+
void
|
|
3015
|
+
/* fn */ ditto_read_transaction_free (
|
|
3016
|
+
CReadTransaction_t * transaction);
|
|
3017
|
+
|
|
3018
|
+
/** \brief
|
|
3019
|
+
* Holder of the disk usage callback
|
|
3020
|
+
* Drop this to stop the callback
|
|
3021
|
+
*/
|
|
3022
|
+
typedef struct DiskUsageObserver DiskUsageObserver_t;
|
|
3023
|
+
|
|
3024
|
+
/** \brief
|
|
3025
|
+
* Register a function that will be called every time
|
|
3026
|
+
* the given path directory or file is updated.
|
|
3027
|
+
* Return a handle that should be given to ditto_release_disk_usage_callback
|
|
3028
|
+
* to drop the callback
|
|
3029
|
+
*/
|
|
3030
|
+
DiskUsageObserver_t *
|
|
3031
|
+
/* fn */ ditto_register_disk_usage_callback (
|
|
3032
|
+
CDitto_t const * ditto,
|
|
3033
|
+
FsComponent_t component,
|
|
3034
|
+
void * ctx,
|
|
3035
|
+
void (*retain)(void *),
|
|
3036
|
+
void (*release)(void *),
|
|
3037
|
+
void (*c_cb)(void *, slice_ref_uint8_t));
|
|
3038
|
+
|
|
3039
|
+
/** \brief
|
|
3040
|
+
* Register a server that can authenticate client requests for an identity.
|
|
3041
|
+
*
|
|
3042
|
+
* Its route will be included in the HTTP server transport, if configured.
|
|
3043
|
+
*/
|
|
3044
|
+
int32_t
|
|
3045
|
+
/* fn */ ditto_register_local_auth_server (
|
|
3046
|
+
CDitto_t * ditto,
|
|
3047
|
+
char const * signing_key_pem,
|
|
3048
|
+
slice_ref_char_const_ptr_t verifying_keys_pem,
|
|
3049
|
+
char const * ca_key_pem,
|
|
3050
|
+
void * ctx,
|
|
3051
|
+
void (*retain)(void *),
|
|
3052
|
+
void (*release)(void *),
|
|
3053
|
+
void (*auth_cb)(void *, CAuthServerAuthRequest_t *, slice_ref_uint8_t),
|
|
3054
|
+
void (*refresh_cb)(void *, CAuthServerRefreshRequest_t *, slice_ref_uint8_t));
|
|
3055
|
+
|
|
3056
|
+
/** \brief
|
|
3057
|
+
* Register a function that will be called every time a peer connection attempt is made.
|
|
3058
|
+
* The function can return true to continue connecting, and false to reject the connection,
|
|
3059
|
+
* based on the supplied metadata about the peer.
|
|
3060
|
+
*/
|
|
3061
|
+
void
|
|
3062
|
+
/* fn */ ditto_register_on_connecting (
|
|
3063
|
+
CDitto_t const * ditto,
|
|
3064
|
+
void * ctx,
|
|
3065
|
+
void (*retain)(void *),
|
|
3066
|
+
void (*release)(void *),
|
|
3067
|
+
void (*c_cb)(void *, slice_ref_uint8_t, OnConnectingResponseHandle_t *));
|
|
3068
|
+
|
|
3069
|
+
/** \brief
|
|
3070
|
+
* Register a function that will be called every time the connection state
|
|
3071
|
+
* of remote peers changes.
|
|
3072
|
+
*/
|
|
3073
|
+
void
|
|
3074
|
+
/* fn */ ditto_register_presence_callback_v3 (
|
|
3075
|
+
CDitto_t const * ditto,
|
|
3076
|
+
void * ctx,
|
|
3077
|
+
void (*retain)(void *),
|
|
3078
|
+
void (*release)(void *),
|
|
3079
|
+
void (*c_cb)(void *, char const *));
|
|
3080
|
+
|
|
3081
|
+
/** \brief
|
|
3082
|
+
* Register a function that will be called every time the connection state
|
|
3083
|
+
* of remote peers changes.
|
|
3084
|
+
* REMOVE THIS IN V4
|
|
3085
|
+
*/
|
|
3086
|
+
void
|
|
3087
|
+
/* fn */ ditto_register_presence_v1_callback (
|
|
3088
|
+
CDitto_t const * ditto,
|
|
3089
|
+
void * ctx,
|
|
3090
|
+
void (*retain)(void *),
|
|
3091
|
+
void (*release)(void *),
|
|
3092
|
+
void (*c_cb)(void *, char const *));
|
|
3093
|
+
|
|
3094
|
+
/** \brief
|
|
3095
|
+
* Register a function that will be called every time the connection state
|
|
3096
|
+
* of remote peers changes.
|
|
3097
|
+
* REMOVE THIS IN V4
|
|
3098
|
+
*/
|
|
3099
|
+
void
|
|
3100
|
+
/* fn */ ditto_register_presence_v2_callback (
|
|
3101
|
+
CDitto_t const * ditto,
|
|
3102
|
+
void * ctx,
|
|
3103
|
+
void (*retain)(void *),
|
|
3104
|
+
void (*release)(void *),
|
|
3105
|
+
void (*c_cb)(void *, char const *));
|
|
3106
|
+
|
|
3107
|
+
/** \brief
|
|
3108
|
+
* User-friendly categories describing where condition events arose
|
|
3109
|
+
*/
|
|
3110
|
+
typedef enum ConditionSource {
|
|
3111
|
+
/** <No documentation available> */
|
|
3112
|
+
CONDITION_SOURCE_BLUETOOTH,
|
|
3113
|
+
/** <No documentation available> */
|
|
3114
|
+
CONDITION_SOURCE_TCP,
|
|
3115
|
+
/** <No documentation available> */
|
|
3116
|
+
CONDITION_SOURCE_AWDL,
|
|
3117
|
+
/** <No documentation available> */
|
|
3118
|
+
CONDITION_SOURCE_MDNS,
|
|
3119
|
+
/** <No documentation available> */
|
|
3120
|
+
CONDITION_SOURCE_WIFI_AWARE,
|
|
3121
|
+
} ConditionSource_t;
|
|
3122
|
+
|
|
3123
|
+
/** \brief
|
|
3124
|
+
* Register a function that will be called every time a transport changes
|
|
3125
|
+
* condition.
|
|
3126
|
+
*
|
|
3127
|
+
* This should drive UI indicators to indicate overall connectivity via methods
|
|
3128
|
+
* such as BLE, WiFi, or an internet-based server on a dedicated
|
|
3129
|
+
* WsConnectTransport.
|
|
3130
|
+
*/
|
|
3131
|
+
void
|
|
3132
|
+
/* fn */ ditto_register_transport_condition_changed_callback (
|
|
3133
|
+
CDitto_t const * ditto,
|
|
3134
|
+
void * ctx,
|
|
3135
|
+
void (*retain)(void *),
|
|
3136
|
+
void (*release)(void *),
|
|
3137
|
+
void (*c_cb)(void *, ConditionSource_t, TransportCondition_t));
|
|
3138
|
+
|
|
3139
|
+
/** \brief
|
|
3140
|
+
* Release the disk usage observer obtained from `ditto_register_disk_usage_callback`
|
|
3141
|
+
*/
|
|
3142
|
+
void
|
|
3143
|
+
/* fn */ ditto_release_disk_usage_callback (
|
|
3144
|
+
DiskUsageObserver_t * _handle);
|
|
3145
|
+
|
|
3146
|
+
/** \brief
|
|
3147
|
+
* Release the disk usage observer obtained from `ditto_register_disk_usage_callback`
|
|
3148
|
+
*/
|
|
3149
|
+
void
|
|
3150
|
+
/* fn */ ditto_release_response_handle (
|
|
3151
|
+
OnConnectingResponseHandle_t * _handle);
|
|
3152
|
+
|
|
3153
|
+
/** <No documentation available> */
|
|
3154
|
+
void
|
|
3155
|
+
/* fn */ ditto_remove_multicast_transport (
|
|
3156
|
+
CDitto_t const * ditto);
|
|
3157
|
+
|
|
3158
|
+
/** <No documentation available> */
|
|
3159
|
+
int32_t
|
|
3160
|
+
/* fn */ ditto_remove_subscription (
|
|
3161
|
+
CDitto_t const * ditto,
|
|
3162
|
+
char const * collection,
|
|
3163
|
+
char const * query,
|
|
3164
|
+
slice_ref_uint8_t query_args_cbor,
|
|
3165
|
+
slice_ref_COrderByParam_t order_by,
|
|
3166
|
+
int32_t limit,
|
|
3167
|
+
uint32_t offset);
|
|
3168
|
+
|
|
3169
|
+
/** <No documentation available> */
|
|
3170
|
+
typedef struct CancelTokenResult {
|
|
3171
|
+
/** <No documentation available> */
|
|
3172
|
+
int32_t status_code;
|
|
3173
|
+
|
|
3174
|
+
/** <No documentation available> */
|
|
3175
|
+
int64_t cancel_token;
|
|
3176
|
+
} CancelTokenResult_t;
|
|
3177
|
+
|
|
3178
|
+
/** \brief
|
|
3179
|
+
* Register a new callback to resolve the attachment.
|
|
3180
|
+
*
|
|
3181
|
+
* The callback status could be:
|
|
3182
|
+
* * `0` -- complete, with a handle that can be used in ditto_get_complete_attachment_path
|
|
3183
|
+
* * `1` -- progress, with additional info about bytes downloaded and total bytes to download
|
|
3184
|
+
* * `2` -- deleted, as the attachment ceased to exist in the doc database
|
|
3185
|
+
*
|
|
3186
|
+
* A cancel token with value `0` represents nil/invalid. This means either an error
|
|
3187
|
+
* occured, or the token has already been fetched or deleted. Note that in this case
|
|
3188
|
+
* the `on_complete_cb` and `on_deleted_cb` callbacks _may_ be called synchronously
|
|
3189
|
+
* even before this function completes.
|
|
3190
|
+
*
|
|
3191
|
+
* Returns following error codes:
|
|
3192
|
+
*
|
|
3193
|
+
* * `0` -- no error
|
|
3194
|
+
* * `1` -- an error
|
|
3195
|
+
* * `2` -- invalid id
|
|
3196
|
+
* * `3` -- attachment not found
|
|
3197
|
+
*
|
|
3198
|
+
* In case of a non-zero status code, error message can be retrieved using
|
|
3199
|
+
* `ditto_error_message` function.
|
|
3200
|
+
*/
|
|
3201
|
+
CancelTokenResult_t
|
|
3202
|
+
/* fn */ ditto_resolve_attachment (
|
|
3203
|
+
CDitto_t const * ditto,
|
|
3204
|
+
slice_ref_uint8_t id,
|
|
3205
|
+
void * ctx,
|
|
3206
|
+
void (*retain)(void *),
|
|
3207
|
+
void (*release)(void *),
|
|
3208
|
+
void (*on_complete_cb)(void *, AttachmentHandle_t *),
|
|
3209
|
+
void (*on_progress_cb)(void *, uint64_t, uint64_t),
|
|
3210
|
+
void (*on_deleted_cb)(void *));
|
|
3211
|
+
|
|
3212
|
+
/** <No documentation available> */
|
|
3213
|
+
slice_boxed_uint8_t
|
|
3214
|
+
/* fn */ ditto_result_cbor (
|
|
3215
|
+
CDqlResult_t const * result);
|
|
3216
|
+
|
|
3217
|
+
/** <No documentation available> */
|
|
3218
|
+
char *
|
|
3219
|
+
/* fn */ ditto_result_json (
|
|
3220
|
+
CDqlResult_t const * result);
|
|
3221
|
+
|
|
3222
|
+
/** <No documentation available> */
|
|
3223
|
+
uint32_t
|
|
3224
|
+
/* fn */ ditto_run_garbage_collection (
|
|
3225
|
+
CDitto_t const * ditto);
|
|
3226
|
+
|
|
3227
|
+
/** <No documentation available> */
|
|
3228
|
+
bool
|
|
3229
|
+
/* fn */ ditto_sdk_transports_android_is_inited (void);
|
|
3230
|
+
|
|
3231
|
+
/** <No documentation available> */
|
|
3232
|
+
char *
|
|
3233
|
+
/* fn */ ditto_sdk_transports_android_missing_permissions (void);
|
|
3234
|
+
|
|
3235
|
+
/** <No documentation available> */
|
|
3236
|
+
void *
|
|
3237
|
+
/* fn */ ditto_sdk_transports_android_missing_permissions_jni_array (void);
|
|
3238
|
+
|
|
3239
|
+
/** <No documentation available> */
|
|
3240
|
+
void
|
|
3241
|
+
/* fn */ ditto_sdk_transports_android_shutdown (void);
|
|
3242
|
+
|
|
3243
|
+
/** <No documentation available> */
|
|
3244
|
+
typedef enum DittoSdkTransportsError {
|
|
3245
|
+
/** <No documentation available> */
|
|
3246
|
+
DITTO_SDK_TRANSPORTS_ERROR_NONE = 0,
|
|
3247
|
+
/** <No documentation available> */
|
|
3248
|
+
DITTO_SDK_TRANSPORTS_ERROR_GENERIC = 1,
|
|
3249
|
+
/** <No documentation available> */
|
|
3250
|
+
DITTO_SDK_TRANSPORTS_ERROR_UNAVAILABLE = 2,
|
|
3251
|
+
} DittoSdkTransportsError_t;
|
|
3252
|
+
|
|
3253
|
+
/** <No documentation available> */
|
|
3254
|
+
void *
|
|
3255
|
+
/* fn */ ditto_sdk_transports_awdl_create (
|
|
3256
|
+
CDitto_t const * ditto,
|
|
3257
|
+
DittoSdkTransportsError_t * out_error);
|
|
3258
|
+
|
|
3259
|
+
/** <No documentation available> */
|
|
3260
|
+
bool
|
|
3261
|
+
/* fn */ ditto_sdk_transports_awdl_destroy (
|
|
3262
|
+
void * awdl,
|
|
3263
|
+
DittoSdkTransportsError_t * out_error);
|
|
3264
|
+
|
|
3265
|
+
/** <No documentation available> */
|
|
3266
|
+
bool
|
|
3267
|
+
/* fn */ ditto_sdk_transports_awdl_is_available (
|
|
3268
|
+
CDitto_t const * _ditto);
|
|
3269
|
+
|
|
3270
|
+
/** <No documentation available> */
|
|
3271
|
+
void *
|
|
3272
|
+
/* fn */ ditto_sdk_transports_ble_create (
|
|
3273
|
+
CDitto_t const * ditto,
|
|
3274
|
+
DittoSdkTransportsError_t * out_error);
|
|
3275
|
+
|
|
3276
|
+
/** <No documentation available> */
|
|
3277
|
+
bool
|
|
3278
|
+
/* fn */ ditto_sdk_transports_ble_destroy (
|
|
3279
|
+
void * ble,
|
|
3280
|
+
DittoSdkTransportsError_t * out_error);
|
|
3281
|
+
|
|
3282
|
+
/** <No documentation available> */
|
|
3283
|
+
bool
|
|
3284
|
+
/* fn */ ditto_sdk_transports_ble_is_available (
|
|
3285
|
+
CDitto_t const * _ditto);
|
|
3286
|
+
|
|
3287
|
+
/** <No documentation available> */
|
|
3288
|
+
char *
|
|
3289
|
+
/* fn */ ditto_sdk_transports_error_description (
|
|
3290
|
+
DittoSdkTransportsError_t error);
|
|
3291
|
+
|
|
3292
|
+
/** \brief
|
|
3293
|
+
* Frees the output of `ditto_sdk_transports_error_new`.
|
|
3294
|
+
*/
|
|
3295
|
+
void
|
|
3296
|
+
/* fn */ ditto_sdk_transports_error_free (
|
|
3297
|
+
DittoSdkTransportsError_t * it);
|
|
3298
|
+
|
|
3299
|
+
/** \brief
|
|
3300
|
+
* Obtain a fresh heap-allocated pointer to a (dummy) `DittoSdkTransportsError`.
|
|
3301
|
+
*
|
|
3302
|
+
* This is useful for languages with no access to inline/stack allocations and/or unable
|
|
3303
|
+
* to produce pointers themselves.
|
|
3304
|
+
*/
|
|
3305
|
+
DittoSdkTransportsError_t *
|
|
3306
|
+
/* fn */ ditto_sdk_transports_error_new (void);
|
|
3307
|
+
|
|
3308
|
+
/** \brief
|
|
3309
|
+
* Frees the output of `ditto_sdk_transports_new_error`.
|
|
3310
|
+
*/
|
|
3311
|
+
DittoSdkTransportsError_t
|
|
3312
|
+
/* fn */ ditto_sdk_transports_error_value (
|
|
3313
|
+
DittoSdkTransportsError_t const * it);
|
|
3314
|
+
|
|
3315
|
+
/** <No documentation available> */
|
|
3316
|
+
bool
|
|
3317
|
+
/* fn */ ditto_sdk_transports_init (
|
|
3318
|
+
DittoSdkTransportsError_t * out_error);
|
|
3319
|
+
|
|
3320
|
+
/** <No documentation available> */
|
|
3321
|
+
void *
|
|
3322
|
+
/* fn */ ditto_sdk_transports_lan_create (
|
|
3323
|
+
CDitto_t const * ditto,
|
|
3324
|
+
DittoSdkTransportsError_t * out_error);
|
|
3325
|
+
|
|
3326
|
+
/** <No documentation available> */
|
|
3327
|
+
bool
|
|
3328
|
+
/* fn */ ditto_sdk_transports_lan_destroy (
|
|
3329
|
+
void * lan,
|
|
3330
|
+
DittoSdkTransportsError_t * out_error);
|
|
3331
|
+
|
|
3332
|
+
/** <No documentation available> */
|
|
3333
|
+
bool
|
|
3334
|
+
/* fn */ ditto_sdk_transports_lan_is_available (
|
|
3335
|
+
CDitto_t const * _ditto);
|
|
3336
|
+
|
|
3337
|
+
/** <No documentation available> */
|
|
3338
|
+
bool
|
|
3339
|
+
/* fn */ ditto_sdk_transports_set_android_context (
|
|
3340
|
+
void * env,
|
|
3341
|
+
void * context);
|
|
3342
|
+
|
|
3343
|
+
/** <No documentation available> */
|
|
3344
|
+
void *
|
|
3345
|
+
/* fn */ ditto_sdk_transports_wifi_aware_create (
|
|
3346
|
+
CDitto_t const * ditto,
|
|
3347
|
+
DittoSdkTransportsError_t * out_error);
|
|
3348
|
+
|
|
3349
|
+
/** <No documentation available> */
|
|
3350
|
+
bool
|
|
3351
|
+
/* fn */ ditto_sdk_transports_wifi_aware_destroy (
|
|
3352
|
+
void * wifi_aware,
|
|
3353
|
+
DittoSdkTransportsError_t * out_error);
|
|
3354
|
+
|
|
3355
|
+
/** <No documentation available> */
|
|
3356
|
+
bool
|
|
3357
|
+
/* fn */ ditto_sdk_transports_wifi_aware_is_available (
|
|
3358
|
+
CDitto_t const * _ditto);
|
|
3359
|
+
|
|
3360
|
+
/** <No documentation available> */
|
|
3361
|
+
void
|
|
3362
|
+
/* fn */ ditto_set_connect_retry_interval (
|
|
3363
|
+
CDitto_t const * ditto,
|
|
3364
|
+
uint32_t retry_interval_millis);
|
|
3365
|
+
|
|
3366
|
+
/** <No documentation available> */
|
|
3367
|
+
void
|
|
3368
|
+
/* fn */ ditto_set_device_name (
|
|
3369
|
+
CDitto_t const * ditto,
|
|
3370
|
+
char const * device_name);
|
|
3371
|
+
|
|
3372
|
+
/** <No documentation available> */
|
|
3373
|
+
void
|
|
3374
|
+
/* fn */ ditto_set_max_outgoing_ble_peers (
|
|
3375
|
+
uint32_t count);
|
|
3376
|
+
|
|
3377
|
+
/** <No documentation available> */
|
|
3378
|
+
uint32_t
|
|
3379
|
+
/* fn */ ditto_set_priority_for_query_overlap_group (
|
|
3380
|
+
CDitto_t const * ditto,
|
|
3381
|
+
uint8_t prio,
|
|
3382
|
+
uint8_t query_overlap_group);
|
|
3383
|
+
|
|
3384
|
+
/** <No documentation available> */
|
|
3385
|
+
uint32_t
|
|
3386
|
+
/* fn */ ditto_set_query_overlap_group (
|
|
3387
|
+
CDitto_t const * ditto,
|
|
3388
|
+
uint8_t query_overlap_group);
|
|
3389
|
+
|
|
3390
|
+
/** <No documentation available> */
|
|
3391
|
+
void
|
|
3392
|
+
/* fn */ ditto_set_static_tcp_clients (
|
|
3393
|
+
CDitto_t const * ditto,
|
|
3394
|
+
slice_ref_char_const_ptr_t list_of_servers);
|
|
3395
|
+
|
|
3396
|
+
/** \brief
|
|
3397
|
+
* configure tcp clients, updates and maintains list of active Websocket peer clients only
|
|
3398
|
+
*/
|
|
3399
|
+
void
|
|
3400
|
+
/* fn */ ditto_set_static_websocket_clients (
|
|
3401
|
+
CDitto_t const * ditto,
|
|
3402
|
+
slice_ref_char_const_ptr_t list_of_servers,
|
|
3403
|
+
uint32_t routing_hint);
|
|
3404
|
+
|
|
3405
|
+
/** <No documentation available> */
|
|
3406
|
+
void
|
|
3407
|
+
/* fn */ ditto_set_sync_group (
|
|
3408
|
+
CDitto_t const * ditto,
|
|
3409
|
+
uint32_t sync_group);
|
|
3410
|
+
|
|
3411
|
+
/** \brief
|
|
3412
|
+
* Shut down Ditto.
|
|
3413
|
+
*
|
|
3414
|
+
* All of the `Peer`'s subsystems are told to shut down, which includes, but is not limited to, the
|
|
3415
|
+
* following happening:
|
|
3416
|
+
* - all advertisers shut down
|
|
3417
|
+
* - all servers stopped
|
|
3418
|
+
* - all TCP listeners stopped
|
|
3419
|
+
* - outbound replication stopped
|
|
3420
|
+
*
|
|
3421
|
+
* All of the live queries associated with the Ditto instance are also stopped. Any file lock
|
|
3422
|
+
* handles are dropped once any long-running tasks have had a chance to complete.
|
|
3423
|
+
*/
|
|
3424
|
+
void
|
|
3425
|
+
/* fn */ ditto_shutdown (
|
|
3426
|
+
CDitto_t const * ditto);
|
|
3427
|
+
|
|
3428
|
+
/** \brief
|
|
3429
|
+
* Indicates whether small peer info feature is currently enabled.
|
|
3430
|
+
*
|
|
3431
|
+
* `true` if enabled, and `false` if currently disabled. Small peer info
|
|
3432
|
+
* consists of information scraped into a system collection at repeated
|
|
3433
|
+
* interval.
|
|
3434
|
+
*
|
|
3435
|
+
* Note: whether the background ingestion process is enabled or not is a
|
|
3436
|
+
* separate decision to whether this information is allowed to sync to other
|
|
3437
|
+
* peers (including the big peer). This is controlled by [`SyncScope`]s. For
|
|
3438
|
+
* the FFI function to get the current sync scope, see
|
|
3439
|
+
* [`ditto_small_peer_info_get_sync_scope`]. By default, the small peer info
|
|
3440
|
+
* document will not sync to any other peers. To sync this document with the
|
|
3441
|
+
* big peer for dashboard and debugging purposes, set a sync scope of
|
|
3442
|
+
* `BigPeerOnly`.
|
|
3443
|
+
*
|
|
3444
|
+
* [`SyncScope`]: DittoSmallPeerInfoSyncScope
|
|
3445
|
+
*/
|
|
3446
|
+
bool
|
|
3447
|
+
/* fn */ ditto_small_peer_info_get_is_enabled (
|
|
3448
|
+
CDitto_t const * ditto);
|
|
3449
|
+
|
|
3450
|
+
/** \brief
|
|
3451
|
+
* Gets the JSON metadata being used in the small peer info document.
|
|
3452
|
+
*
|
|
3453
|
+
* The metadata is free-form, user-provided JSON data that is inserted into
|
|
3454
|
+
* the small peer info system doc at each collection interval. The data has no
|
|
3455
|
+
* schema so it is returned as a c_string. We validated the incoming data with
|
|
3456
|
+
* our constraints, and we do not modify this data, so the same constraints
|
|
3457
|
+
* hold. The validation constraints are:
|
|
3458
|
+
* 1. The size of the metadata does not exceed [`SMALL_PEER_INFO_METADATA_SIZE_BYTES_MAX`]
|
|
3459
|
+
* 2. The metadata can be parsed as a JSON string and its max depth does not exceed
|
|
3460
|
+
* [`SMALL_PEER_INFO_METADATA_DEPTH_MAX`]
|
|
3461
|
+
* 3. The metadata represents a JSON object that can be deserialized into a Map<String, Value>
|
|
3462
|
+
*
|
|
3463
|
+
* An empty JSON object string is returned if the data has not been set.
|
|
3464
|
+
*
|
|
3465
|
+
* This does not return the metadata from persistent storage. It only returns
|
|
3466
|
+
* the data that has been set to be used by the collector
|
|
3467
|
+
* (via [`ditto_small_peer_info_set_metadata`]) at each collector
|
|
3468
|
+
*/
|
|
3469
|
+
char *
|
|
3470
|
+
/* fn */ ditto_small_peer_info_get_metadata (
|
|
3471
|
+
CDitto_t const * ditto);
|
|
3472
|
+
|
|
3473
|
+
/** \brief
|
|
3474
|
+
* Which peers to replicate the `__small_peer_info` collection to.
|
|
3475
|
+
*
|
|
3476
|
+
* The syncing behavior is dictated by internal [`SyncScope`]s.
|
|
3477
|
+
*
|
|
3478
|
+
* By default, the small peer info does not sync to other peers as dictated by
|
|
3479
|
+
* the default `LocalPeerOnly` scope. To enable syncing small peer info to the
|
|
3480
|
+
* big peer, set the `BigPeerOnly` scope.
|
|
3481
|
+
*
|
|
3482
|
+
* NOTE: Currently SDKs can only set [`BigPeerOnly`] or [`LocalPeerOnly`]
|
|
3483
|
+
* sync scopes. [`AllPeers`] and [`SmallPeersOnly`] sync scopes are currently
|
|
3484
|
+
* unsupported. Support for `AllPeers` and `SmallPeersOnly` will be added in the
|
|
3485
|
+
* future, but for that we will need an API for users to subscribe to the small
|
|
3486
|
+
* peer info of other peers.
|
|
3487
|
+
*
|
|
3488
|
+
* [`SyncScope`]: ::ditto_store::sync_scope::SyncScope
|
|
3489
|
+
* [`BigPeerOnly`]: ::ditto_store::sync_scope::SyncScope::BigPeerOnly
|
|
3490
|
+
* [`LocalPeerOnly`]: ::ditto_store::sync_scope::SyncScope::LocalPeerOnly
|
|
3491
|
+
* [`AllPeers`]: ::ditto_store::sync_scope::SyncScope::AllPeers
|
|
3492
|
+
* [`SmallPeersOnly`]: ::ditto_store::sync_scope::SyncScope::SmallPeersOnly
|
|
3493
|
+
*/
|
|
3494
|
+
typedef enum DittoSmallPeerInfoSyncScope {
|
|
3495
|
+
/** <No documentation available> */
|
|
3496
|
+
DITTO_SMALL_PEER_INFO_SYNC_SCOPE_BIG_PEER_ONLY,
|
|
3497
|
+
/** <No documentation available> */
|
|
3498
|
+
DITTO_SMALL_PEER_INFO_SYNC_SCOPE_LOCAL_PEER_ONLY,
|
|
3499
|
+
} DittoSmallPeerInfoSyncScope_t;
|
|
3500
|
+
|
|
3501
|
+
/** \brief
|
|
3502
|
+
* Gets the sync scope for the Small Peer Info collection.
|
|
3503
|
+
*
|
|
3504
|
+
* A collection's [SyncScope] determines which "kind" of peers it will
|
|
3505
|
+
* replicate to. The collection does not need to exist locally for this
|
|
3506
|
+
* function to succeed. If no custom sync scope has been set or if the
|
|
3507
|
+
* collection does not exist, the returned scope will be the default
|
|
3508
|
+
* [`LocalPeerOnly`]. Currently, only [`BigPeerOnly`] and [`LocalPeerOnly`] are
|
|
3509
|
+
* supported for small peer info; see [`DittoSmallPeerInfoSyncScope`] for
|
|
3510
|
+
* details.
|
|
3511
|
+
*
|
|
3512
|
+
* # Return Values
|
|
3513
|
+
*
|
|
3514
|
+
* - Always returns a sync scope - either the custom override set by the user, or the default
|
|
3515
|
+
* scope.
|
|
3516
|
+
*
|
|
3517
|
+
* The function currently has no error conditions.
|
|
3518
|
+
*
|
|
3519
|
+
* [`SyncScope`]: DittoSmallPeerInfoSyncScope
|
|
3520
|
+
* [`BigPeerOnly`]: DittoSmallPeerInfoSyncScope::BigPeerOnly
|
|
3521
|
+
* [`LocalPeerOnly`]: DittoSmallPeerInfoSyncScope::LocalPeerOnly
|
|
3522
|
+
*/
|
|
3523
|
+
DittoSmallPeerInfoSyncScope_t
|
|
3524
|
+
/* fn */ ditto_small_peer_info_get_sync_scope (
|
|
3525
|
+
CDitto_t const * ditto);
|
|
3526
|
+
|
|
3527
|
+
/** \brief
|
|
3528
|
+
* Enables or disables the small peer info feature.
|
|
3529
|
+
*
|
|
3530
|
+
* Small peer info consists of information scraped into a system collection at
|
|
3531
|
+
* repeated intervals.
|
|
3532
|
+
*
|
|
3533
|
+
* Note: whether the background ingestion process is enabled or not is a
|
|
3534
|
+
* separate decision to whether this information is allowed to sync to other
|
|
3535
|
+
* peers (including the big peer). This is controlled by [`SyncScope`]s. For
|
|
3536
|
+
* the FFI function to set sync scopes, see
|
|
3537
|
+
* [`ditto_small_peer_info_set_sync_scope`]. By default, the small peer info
|
|
3538
|
+
* document will not sync to any other peers. To sync this document with the
|
|
3539
|
+
* big peer for dashboard and debugging purposes, set a sync scope of
|
|
3540
|
+
* `BigPeerOnly`.
|
|
3541
|
+
*
|
|
3542
|
+
* [`SyncScope`]: DittoSmallPeerInfoSyncScope
|
|
3543
|
+
*/
|
|
3544
|
+
void
|
|
3545
|
+
/* fn */ ditto_small_peer_info_set_enabled (
|
|
3546
|
+
CDitto_t const * ditto,
|
|
3547
|
+
bool set_enabled);
|
|
3548
|
+
|
|
3549
|
+
/** \brief
|
|
3550
|
+
* Sets the JSON metadata to be used in the small peer info document.
|
|
3551
|
+
*
|
|
3552
|
+
* The metadata is free-form, user-provided JSON data that is inserted into
|
|
3553
|
+
* the small peer info system doc at each collection interval. The data has no
|
|
3554
|
+
* schema and is provided as a char_p, so data validation must be performed
|
|
3555
|
+
* here. We validate:
|
|
3556
|
+
* 1. The size of the metadata does not exceed [`SMALL_PEER_INFO_METADATA_SIZE_BYTES_MAX`]
|
|
3557
|
+
* 2. The metadata can be parsed as a JSON string and its max depth does not exceed
|
|
3558
|
+
* [`SMALL_PEER_INFO_METADATA_DEPTH_MAX`]
|
|
3559
|
+
* 3. The metadata represents a JSON object that can be deserialized into a Map<String, Value>
|
|
3560
|
+
*
|
|
3561
|
+
* # Return Values
|
|
3562
|
+
*
|
|
3563
|
+
* - Returns `0` if the input passes validation and is successfully set to be
|
|
3564
|
+
* used in the small peer info document.
|
|
3565
|
+
* - Returns `-1` in case the observability subsystem is unavailable (which
|
|
3566
|
+
* should never be the case for the small peer).
|
|
3567
|
+
* - Returns `1` if the amount of data is too large according to our
|
|
3568
|
+
* self-imposed limits.
|
|
3569
|
+
* - Returns `2` if the amount of JSON data is too nested according to our
|
|
3570
|
+
* self-imposed limits, or if the data cannot be parsed to determine the depth.
|
|
3571
|
+
* - Returns `3` if the data cannot be parsed as a Map<String, Value>
|
|
3572
|
+
*/
|
|
3573
|
+
int32_t
|
|
3574
|
+
/* fn */ ditto_small_peer_info_set_metadata (
|
|
3575
|
+
CDitto_t const * ditto,
|
|
3576
|
+
char const * metadata);
|
|
3577
|
+
|
|
3578
|
+
/** \brief
|
|
3579
|
+
* Set the sync scope for the Small Peer Info collection.
|
|
3580
|
+
*
|
|
3581
|
+
* A collection's [SyncScope] determines which "kind" of peers it will
|
|
3582
|
+
* replicate to. This function can be used even if the Small Peer Info
|
|
3583
|
+
* collection does not yet exist. Currently, only [`BigPeerOnly`] and
|
|
3584
|
+
* [`LocalPeerOnly`] sync scopes are supported for small peer info; see
|
|
3585
|
+
* [`DittoSmallPeerInfoSyncScope`] for details.
|
|
3586
|
+
*
|
|
3587
|
+
* The function currently has no error conditions.
|
|
3588
|
+
*
|
|
3589
|
+
* [`SyncScope`]: DittoSmallPeerInfoSyncScope
|
|
3590
|
+
* [`BigPeerOnly`]: DittoSmallPeerInfoSyncScope::BigPeerOnly
|
|
3591
|
+
* [`LocalPeerOnly`]: DittoSmallPeerInfoSyncScope::LocalPeerOnly
|
|
3592
|
+
*/
|
|
3593
|
+
void
|
|
3594
|
+
/* fn */ ditto_small_peer_info_set_sync_scope (
|
|
3595
|
+
CDitto_t const * ditto,
|
|
3596
|
+
DittoSmallPeerInfoSyncScope_t scope);
|
|
3597
|
+
|
|
3598
|
+
/** \brief
|
|
3599
|
+
* Sets the transport config data contained in the small peer info.
|
|
3600
|
+
*
|
|
3601
|
+
* Important note: This is not configuration data used to configure the SDK
|
|
3602
|
+
* (yet) - it's simply another info field inserted into the small peer info
|
|
3603
|
+
* document.
|
|
3604
|
+
*
|
|
3605
|
+
* It's assumed that CBOR deserialization will succeed. If it fails then we'll
|
|
3606
|
+
* panic. This is because this isn't something that should happen any time
|
|
3607
|
+
* other than at (our (Ditto's)) development time.
|
|
3608
|
+
*/
|
|
3609
|
+
void
|
|
3610
|
+
/* fn */ ditto_small_peer_info_set_transport_config_data (
|
|
3611
|
+
CDitto_t const * ditto,
|
|
3612
|
+
slice_ref_uint8_t cbor);
|
|
3613
|
+
|
|
3614
|
+
/** \brief
|
|
3615
|
+
* Whether or not to offer a WebSocket sync server on the HTTP server.
|
|
3616
|
+
*/
|
|
3617
|
+
typedef enum WebSocketMode {
|
|
3618
|
+
/** <No documentation available> */
|
|
3619
|
+
WEB_SOCKET_MODE_ENABLED,
|
|
3620
|
+
/** <No documentation available> */
|
|
3621
|
+
WEB_SOCKET_MODE_DISABLED,
|
|
3622
|
+
} WebSocketMode_t;
|
|
3623
|
+
|
|
3624
|
+
/** \brief
|
|
3625
|
+
* Start the WebSocket server
|
|
3626
|
+
*
|
|
3627
|
+
* * `bind` - optional bind string of the form "ip:port"
|
|
3628
|
+
* * `static_path` - optional absolute path to content on disk that should be served from `/`
|
|
3629
|
+
* * `enable_websocket` - whether to enable a WebSocket server at the reserved path `/_ditto/ws`
|
|
3630
|
+
* * `tls_cert_path` - path to this server's TLS certificate file, or null if not using TLS
|
|
3631
|
+
* * `tls_key_path` - path to this server's TLS private key file, or null if not using TLS
|
|
3632
|
+
*/
|
|
3633
|
+
int32_t
|
|
3634
|
+
/* fn */ ditto_start_http_server (
|
|
3635
|
+
CDitto_t const * ditto,
|
|
3636
|
+
char const * bind,
|
|
3637
|
+
char const * static_path,
|
|
3638
|
+
WebSocketMode_t enable_websocket,
|
|
3639
|
+
char const * tls_cert_path,
|
|
3640
|
+
char const * tls_key_path);
|
|
3641
|
+
|
|
3642
|
+
/** \brief
|
|
3643
|
+
* Start the WebSocket server
|
|
3644
|
+
*/
|
|
3645
|
+
int32_t
|
|
3646
|
+
/* fn */ ditto_start_tcp_server (
|
|
3647
|
+
CDitto_t const * ditto,
|
|
3648
|
+
char const * bind);
|
|
3649
|
+
|
|
3650
|
+
/** <No documentation available> */
|
|
3651
|
+
int32_t
|
|
3652
|
+
/* fn */ ditto_stop_http_server (
|
|
3653
|
+
CDitto_t const * ditto);
|
|
3654
|
+
|
|
3655
|
+
/** <No documentation available> */
|
|
3656
|
+
int32_t
|
|
3657
|
+
/* fn */ ditto_stop_tcp_server (
|
|
3658
|
+
CDitto_t const * ditto);
|
|
3659
|
+
|
|
3660
|
+
/** \brief
|
|
3661
|
+
* Listen address of `tcp_listen_transport`.
|
|
3662
|
+
*
|
|
3663
|
+
* Must be called after `transport_go_online()`.
|
|
3664
|
+
* The return value must be freed with `ditto_c_string_free()`.
|
|
3665
|
+
*/
|
|
3666
|
+
char *
|
|
3667
|
+
/* fn */ ditto_tcp_server_listen_addr (
|
|
3668
|
+
CDitto_t const * ditto);
|
|
3669
|
+
|
|
3670
|
+
/** \brief
|
|
3671
|
+
* Request bulk status information about the transports. Intended mostly for
|
|
3672
|
+
* statistical or debugging purposes.
|
|
3673
|
+
*/
|
|
3674
|
+
char *
|
|
3675
|
+
/* fn */ ditto_transports_diagnostics (
|
|
3676
|
+
CDitto_t const * ditto);
|
|
3677
|
+
|
|
3678
|
+
/** <No documentation available> */
|
|
3679
|
+
void
|
|
3680
|
+
/* fn */ ditto_unregister_local_auth_server (
|
|
3681
|
+
CDitto_t * ditto);
|
|
3682
|
+
|
|
3683
|
+
/** <No documentation available> */
|
|
3684
|
+
uint32_t
|
|
3685
|
+
/* fn */ ditto_validate_document_id (
|
|
3686
|
+
slice_ref_uint8_t cbor,
|
|
3687
|
+
slice_boxed_uint8_t * out_cbor);
|
|
3688
|
+
|
|
3689
|
+
/** <No documentation available> */
|
|
3690
|
+
void
|
|
3691
|
+
/* fn */ ditto_vec_char_ptr_free (
|
|
3692
|
+
Vec_char_ptr_t char_p);
|
|
3693
|
+
|
|
3694
|
+
/** <No documentation available> */
|
|
3695
|
+
void
|
|
3696
|
+
/* fn */ ditto_vec_slice_boxed_uint8_t_free (
|
|
3697
|
+
Vec_slice_boxed_uint8_t slice_boxed);
|
|
3698
|
+
|
|
3699
|
+
/** \brief
|
|
3700
|
+
* Same as [`Vec<T>`][`rust::Vec`], but with guaranteed `#[repr(C)]` layout
|
|
3701
|
+
*/
|
|
3702
|
+
typedef struct Vec_size {
|
|
3703
|
+
/** <No documentation available> */
|
|
3704
|
+
size_t * ptr;
|
|
3705
|
+
|
|
3706
|
+
/** <No documentation available> */
|
|
3707
|
+
size_t len;
|
|
3708
|
+
|
|
3709
|
+
/** <No documentation available> */
|
|
3710
|
+
size_t cap;
|
|
3711
|
+
} Vec_size_t;
|
|
3712
|
+
|
|
3713
|
+
/** <No documentation available> */
|
|
3714
|
+
void
|
|
3715
|
+
/* fn */ ditto_vec_usizes_free (
|
|
3716
|
+
Vec_size_t usizes);
|
|
3717
|
+
|
|
3718
|
+
/** \brief
|
|
3719
|
+
* The SDK requests to drop its handle to the WifiAware discovery transport
|
|
3720
|
+
*
|
|
3721
|
+
* At some point dropping this events channel will effectively shut down and
|
|
3722
|
+
* remove the Transport. At time of writing, the Transport is still owned
|
|
3723
|
+
* within Peer.
|
|
3724
|
+
*/
|
|
3725
|
+
void
|
|
3726
|
+
/* fn */ ditto_wifi_aware_client_free_handle (
|
|
3727
|
+
TransportHandle_WifiAwareClientPlatformEvent_t * handle);
|
|
3728
|
+
|
|
3729
|
+
/** \brief
|
|
3730
|
+
* The platform advises Rust that we have resolved a peer's hostname and port
|
|
3731
|
+
*/
|
|
3732
|
+
void
|
|
3733
|
+
/* fn */ ditto_wifi_aware_client_network_did_create (
|
|
3734
|
+
TransportHandle_WifiAwareClientPlatformEvent_t const * handle,
|
|
3735
|
+
char const * announce_string,
|
|
3736
|
+
char const * hostname,
|
|
3737
|
+
uint16_t port);
|
|
3738
|
+
|
|
3739
|
+
/** \brief
|
|
3740
|
+
* The platform advises Rust that a peer has been identified.
|
|
3741
|
+
*/
|
|
3742
|
+
void
|
|
3743
|
+
/* fn */ ditto_wifi_aware_client_peer_appeared (
|
|
3744
|
+
TransportHandle_WifiAwareClientPlatformEvent_t const * handle,
|
|
3745
|
+
char const * announce_string);
|
|
3746
|
+
|
|
3747
|
+
/** \brief
|
|
3748
|
+
* The platform advises Rust that we failed to resolve a peer's hostname and
|
|
3749
|
+
* port
|
|
3750
|
+
*/
|
|
3751
|
+
void
|
|
3752
|
+
/* fn */ ditto_wifi_aware_client_peer_did_not_connect (
|
|
3753
|
+
TransportHandle_WifiAwareClientPlatformEvent_t const * handle,
|
|
3754
|
+
char const * announce_string);
|
|
3755
|
+
|
|
3756
|
+
/** \brief
|
|
3757
|
+
* The platform advises Rust that a peer's service has disappeared from WifiAware.
|
|
3758
|
+
*/
|
|
3759
|
+
void
|
|
3760
|
+
/* fn */ ditto_wifi_aware_client_peer_disappeared (
|
|
3761
|
+
TransportHandle_WifiAwareClientPlatformEvent_t const * handle,
|
|
3762
|
+
char const * announce_string);
|
|
3763
|
+
|
|
3764
|
+
/** \brief
|
|
3765
|
+
* The platform advises Rust that the status of searching for services has
|
|
3766
|
+
* changed.
|
|
3767
|
+
*/
|
|
3768
|
+
void
|
|
3769
|
+
/* fn */ ditto_wifi_aware_client_scanning_state_changed (
|
|
3770
|
+
TransportHandle_WifiAwareClientPlatformEvent_t const * handle,
|
|
3771
|
+
OnlineState_t state,
|
|
3772
|
+
TransportCondition_t condition);
|
|
3773
|
+
|
|
3774
|
+
/** \brief
|
|
3775
|
+
* The platform advises Rust that the status of publishing our service has
|
|
3776
|
+
* changed.
|
|
3777
|
+
*/
|
|
3778
|
+
void
|
|
3779
|
+
/* fn */ ditto_wifi_aware_server_advertising_state_changed (
|
|
3780
|
+
TransportHandle_WifiAwareServerPlatformEvent_t const * handle,
|
|
3781
|
+
OnlineState_t state,
|
|
3782
|
+
TransportCondition_t condition);
|
|
3783
|
+
|
|
3784
|
+
/** \brief
|
|
3785
|
+
* The SDK requests to drop its handle to the WifiAware advertising service.
|
|
3786
|
+
*
|
|
3787
|
+
* Ideally this should remove the advertiser automatically.
|
|
3788
|
+
* At time of writing now this must be done manually through Peer.
|
|
3789
|
+
*/
|
|
3790
|
+
void
|
|
3791
|
+
/* fn */ ditto_wifi_aware_server_free_handle (
|
|
3792
|
+
TransportHandle_WifiAwareServerPlatformEvent_t * handle);
|
|
3793
|
+
|
|
3794
|
+
/** <No documentation available> */
|
|
3795
|
+
typedef struct CWriteTransactionResult {
|
|
3796
|
+
/** <No documentation available> */
|
|
3797
|
+
int32_t status_code;
|
|
3798
|
+
|
|
3799
|
+
/** <No documentation available> */
|
|
3800
|
+
CWriteTransaction_t * txn;
|
|
3801
|
+
} CWriteTransactionResult_t;
|
|
3802
|
+
|
|
3803
|
+
/** <No documentation available> */
|
|
3804
|
+
CWriteTransactionResult_t
|
|
3805
|
+
/* fn */ ditto_write_transaction (
|
|
3806
|
+
CDitto_t const * ditto,
|
|
3807
|
+
char const * log_hint);
|
|
3808
|
+
|
|
3809
|
+
/** \brief
|
|
3810
|
+
* Sets some arbitrary metadata on a write transaction.
|
|
3811
|
+
*
|
|
3812
|
+
* This is currently only useful and relevant if history tracking is enabled in
|
|
3813
|
+
* the store that the write transaction relates to. If history tracking is
|
|
3814
|
+
* enabled and metadata is set on a write transaction then the document
|
|
3815
|
+
* inserted into the `__history` collection will have (at least) the provided
|
|
3816
|
+
* metadata stored under the `meta` key of the document.
|
|
3817
|
+
*
|
|
3818
|
+
* Return codes:
|
|
3819
|
+
*
|
|
3820
|
+
* * `0` -- success
|
|
3821
|
+
* * `1` -- invalid metadata CBOR
|
|
3822
|
+
* * `-1` -- valid metadata CBOR but the CBOR does not represent an object
|
|
3823
|
+
* * `-2` -- [js only] missing `await`s
|
|
3824
|
+
*/
|
|
3825
|
+
int32_t
|
|
3826
|
+
/* fn */ ditto_write_transaction_add_metadata (
|
|
3827
|
+
CWriteTransaction_t * transaction,
|
|
3828
|
+
slice_ref_uint8_t metadata_cbor);
|
|
3829
|
+
|
|
3830
|
+
/** \brief
|
|
3831
|
+
* Commits the given txn.
|
|
3832
|
+
*
|
|
3833
|
+
* [js only]: returns -1 on failure, in case of missing `await`s.
|
|
3834
|
+
*/
|
|
3835
|
+
int32_t
|
|
3836
|
+
/* fn */ ditto_write_transaction_commit (
|
|
3837
|
+
CDitto_t const * ditto,
|
|
3838
|
+
CWriteTransaction_t * transaction);
|
|
3839
|
+
|
|
3840
|
+
/** \brief
|
|
3841
|
+
* Frees the txn handle, *falling back* to a rollback, which requires
|
|
3842
|
+
* `async`-in-drop. Only useful as a safeguard for RAII-with-proper-ownership
|
|
3843
|
+
* languages, _i.e._, the Rust SDK.
|
|
3844
|
+
*
|
|
3845
|
+
* For other languages, favor using `ditto_write_transaction_rollback`
|
|
3846
|
+
*/
|
|
3847
|
+
void
|
|
3848
|
+
/* fn */ ditto_write_transaction_free (
|
|
3849
|
+
CWriteTransaction_t * transaction);
|
|
3850
|
+
|
|
3851
|
+
/** \brief
|
|
3852
|
+
* For SDKs using the batched/scoped write-txn APIs, if an error occurs
|
|
3853
|
+
* mid-operation (_e.g._, customer callback throwing an exception), then the
|
|
3854
|
+
* txn must not be committed, but it ought to be disposed of, _via_ a rollback.
|
|
3855
|
+
*
|
|
3856
|
+
* [js only]: returns -1 on failure, in case of missing `await`s.
|
|
3857
|
+
*/
|
|
3858
|
+
int32_t
|
|
3859
|
+
/* fn */ ditto_write_transaction_rollback (
|
|
3860
|
+
CDitto_t const * _ditto,
|
|
3861
|
+
CWriteTransaction_t * transaction);
|
|
3862
|
+
|
|
3863
|
+
/** \brief
|
|
3864
|
+
* The ditto error type, opaque.
|
|
3865
|
+
*/
|
|
3866
|
+
typedef struct dittoffi_error dittoffi_error_t;
|
|
3867
|
+
|
|
3868
|
+
/** \brief
|
|
3869
|
+
* The error codes for `ditto_error_t`
|
|
3870
|
+
*/
|
|
3871
|
+
typedef enum dittoffi_error_code {
|
|
3872
|
+
/** \brief
|
|
3873
|
+
* Invalid CBOR-encoded input.
|
|
3874
|
+
*/
|
|
3875
|
+
DITTOFFI_ERROR_CODE_CBOR_INVALID,
|
|
3876
|
+
/** \brief
|
|
3877
|
+
* Unsupported CBOR type.
|
|
3878
|
+
*/
|
|
3879
|
+
DITTOFFI_ERROR_CODE_CBOR_UNSUPPORTED,
|
|
3880
|
+
/** \brief
|
|
3881
|
+
* Found an invalid document id.
|
|
3882
|
+
*/
|
|
3883
|
+
DITTOFFI_ERROR_CODE_STORE_DOCUMENT_ID,
|
|
3884
|
+
/** \brief
|
|
3885
|
+
* The requested document could not be found.
|
|
3886
|
+
*/
|
|
3887
|
+
DITTOFFI_ERROR_CODE_STORE_DOCUMENT_NOT_FOUND,
|
|
3888
|
+
/** <No documentation available> */
|
|
3889
|
+
DITTOFFI_ERROR_CODE_STORE_DATABASE,
|
|
3890
|
+
/** <No documentation available> */
|
|
3891
|
+
DITTOFFI_ERROR_CODE_STORE_QUERY,
|
|
3892
|
+
/** <No documentation available> */
|
|
3893
|
+
DITTOFFI_ERROR_CODE_CRDT,
|
|
3894
|
+
/** \brief
|
|
3895
|
+
* Javascript only. Missing `await` on outstanding store operation.
|
|
3896
|
+
*/
|
|
3897
|
+
DITTOFFI_ERROR_CODE_JS_FLOATING_STORE_OPERATION,
|
|
3898
|
+
/** \brief
|
|
3899
|
+
* Failed to compile the given query.
|
|
3900
|
+
*
|
|
3901
|
+
* For more information on Ditto's query language see:
|
|
3902
|
+
* <https://docs.ditto.live/dql-guide>
|
|
3903
|
+
*/
|
|
3904
|
+
DITTOFFI_ERROR_CODE_DQL_QUERY_COMPILATION,
|
|
3905
|
+
/** \brief
|
|
3906
|
+
* Invalid CBOR-encoded query arguments.
|
|
3907
|
+
*/
|
|
3908
|
+
DITTOFFI_ERROR_CODE_DQL_INVALID_QUERY_ARGS,
|
|
3909
|
+
/** \brief
|
|
3910
|
+
* Unsupported features were used in a DQL statement or query.
|
|
3911
|
+
*/
|
|
3912
|
+
DITTOFFI_ERROR_CODE_DQL_UNSUPPORTED,
|
|
3913
|
+
} dittoffi_error_code_t;
|
|
3914
|
+
|
|
3915
|
+
/** <No documentation available> */
|
|
3916
|
+
dittoffi_error_code_t
|
|
3917
|
+
/* fn */ dittoffi_error_code (
|
|
3918
|
+
dittoffi_error_t const * error);
|
|
3919
|
+
|
|
3920
|
+
/** <No documentation available> */
|
|
3921
|
+
char *
|
|
3922
|
+
/* fn */ dittoffi_error_description (
|
|
3923
|
+
dittoffi_error_t const * error);
|
|
3924
|
+
|
|
3925
|
+
/** <No documentation available> */
|
|
3926
|
+
void
|
|
3927
|
+
/* fn */ dittoffi_error_free (
|
|
3928
|
+
dittoffi_error_t * error);
|
|
3929
|
+
|
|
3930
|
+
/** \brief
|
|
3931
|
+
* Returns a human-readable SDK version string, restricted to the SemVer
|
|
3932
|
+
* "number" (including the pre-release specifier, if any).
|
|
3933
|
+
*
|
|
3934
|
+
* The returned string must be freed.
|
|
3935
|
+
*/
|
|
3936
|
+
char *
|
|
3937
|
+
/* fn */ dittoffi_get_sdk_semver (void);
|
|
3938
|
+
|
|
3939
|
+
/** <No documentation available> */
|
|
3940
|
+
typedef struct dittoffi_result_void {
|
|
3941
|
+
/** \brief
|
|
3942
|
+
* Non-`NULL` pointer to opaque object on error, `NULL` otherwise.
|
|
3943
|
+
*/
|
|
3944
|
+
dittoffi_error_t * error;
|
|
3945
|
+
} dittoffi_result_void_t;
|
|
3946
|
+
|
|
3947
|
+
/** <No documentation available> */
|
|
3948
|
+
dittoffi_result_void_t
|
|
3949
|
+
/* fn */ dittoffi_try_add_subscription (
|
|
3950
|
+
CDitto_t const * ditto,
|
|
3951
|
+
char const * collection,
|
|
3952
|
+
char const * query,
|
|
3953
|
+
slice_ref_uint8_t query_args_cbor,
|
|
3954
|
+
slice_ref_COrderByParam_t order_by,
|
|
3955
|
+
int32_t limit,
|
|
3956
|
+
uint32_t offset);
|
|
3957
|
+
|
|
3958
|
+
/** <No documentation available> */
|
|
3959
|
+
dittoffi_result_void_t
|
|
3960
|
+
/* fn */ dittoffi_try_collection (
|
|
3961
|
+
CDitto_t const * ditto,
|
|
3962
|
+
char const * name);
|
|
3963
|
+
|
|
3964
|
+
/** <No documentation available> */
|
|
3965
|
+
typedef struct dittoffi_result_bool {
|
|
3966
|
+
/** \brief
|
|
3967
|
+
* Non-`NULL` pointer to opaque object on error, `NULL` otherwise.
|
|
3968
|
+
*/
|
|
3969
|
+
dittoffi_error_t * error;
|
|
3970
|
+
|
|
3971
|
+
/** \brief
|
|
3972
|
+
* When no error occurred, the success value payload can be retrieved here.
|
|
3973
|
+
*
|
|
3974
|
+
* Otherwise, the value is to be ignored.
|
|
3975
|
+
*/
|
|
3976
|
+
bool success;
|
|
3977
|
+
} dittoffi_result_bool_t;
|
|
3978
|
+
|
|
3979
|
+
/** <No documentation available> */
|
|
3980
|
+
dittoffi_result_bool_t
|
|
3981
|
+
/* fn */ dittoffi_try_collection_evict (
|
|
3982
|
+
CDitto_t const * ditto,
|
|
3983
|
+
char const * coll_name,
|
|
3984
|
+
CWriteTransaction_t * transaction,
|
|
3985
|
+
slice_ref_uint8_t id);
|
|
3986
|
+
|
|
3987
|
+
/** <No documentation available> */
|
|
3988
|
+
typedef struct dittoffi_result_Vec_slice_boxed_uint8 {
|
|
3989
|
+
/** \brief
|
|
3990
|
+
* Non-`NULL` pointer to opaque object on error, `NULL` otherwise.
|
|
3991
|
+
*/
|
|
3992
|
+
dittoffi_error_t * error;
|
|
3993
|
+
|
|
3994
|
+
/** \brief
|
|
3995
|
+
* When no error occurred, the success value payload can be retrieved here.
|
|
3996
|
+
*
|
|
3997
|
+
* Otherwise, the value is to be ignored.
|
|
3998
|
+
*/
|
|
3999
|
+
Vec_slice_boxed_uint8_t success;
|
|
4000
|
+
} dittoffi_result_Vec_slice_boxed_uint8_t;
|
|
4001
|
+
|
|
4002
|
+
/** <No documentation available> */
|
|
4003
|
+
dittoffi_result_Vec_slice_boxed_uint8_t
|
|
4004
|
+
/* fn */ dittoffi_try_collection_evict_by_ids (
|
|
4005
|
+
CDitto_t const * ditto,
|
|
4006
|
+
char const * coll_name,
|
|
4007
|
+
CWriteTransaction_t * transaction,
|
|
4008
|
+
slice_ref_slice_boxed_uint8_t ids);
|
|
4009
|
+
|
|
4010
|
+
/** <No documentation available> */
|
|
4011
|
+
dittoffi_result_Vec_slice_boxed_uint8_t
|
|
4012
|
+
/* fn */ dittoffi_try_collection_evict_query_str (
|
|
4013
|
+
CDitto_t const * ditto,
|
|
4014
|
+
char const * coll_name,
|
|
4015
|
+
CWriteTransaction_t * transaction,
|
|
4016
|
+
char const * query,
|
|
4017
|
+
slice_ref_uint8_t query_args_cbor,
|
|
4018
|
+
slice_ref_COrderByParam_t order_by_params,
|
|
4019
|
+
int32_t limit,
|
|
4020
|
+
uint32_t offset);
|
|
4021
|
+
|
|
4022
|
+
/** <No documentation available> */
|
|
4023
|
+
typedef struct docs_and_ids {
|
|
4024
|
+
/** <No documentation available> */
|
|
4025
|
+
Vec_CDocument_ptr_t documents;
|
|
4026
|
+
|
|
4027
|
+
/** <No documentation available> */
|
|
4028
|
+
Vec_slice_boxed_uint8_t ids;
|
|
4029
|
+
} docs_and_ids_t;
|
|
4030
|
+
|
|
4031
|
+
/** <No documentation available> */
|
|
4032
|
+
typedef struct dittoffi_result_docs_and_ids {
|
|
4033
|
+
/** \brief
|
|
4034
|
+
* Non-`NULL` pointer to opaque object on error, `NULL` otherwise.
|
|
4035
|
+
*/
|
|
4036
|
+
dittoffi_error_t * error;
|
|
4037
|
+
|
|
4038
|
+
/** \brief
|
|
4039
|
+
* When no error occurred, the success value payload can be retrieved here.
|
|
4040
|
+
*
|
|
4041
|
+
* Otherwise, the value is to be ignored.
|
|
4042
|
+
*/
|
|
4043
|
+
docs_and_ids_t success;
|
|
4044
|
+
} dittoffi_result_docs_and_ids_t;
|
|
4045
|
+
|
|
4046
|
+
/** <No documentation available> */
|
|
4047
|
+
dittoffi_result_docs_and_ids_t
|
|
4048
|
+
/* fn */ dittoffi_try_collection_find_by_ids (
|
|
4049
|
+
CDitto_t const * ditto,
|
|
4050
|
+
char const * coll_name,
|
|
4051
|
+
slice_ref_slice_boxed_uint8_t ids,
|
|
4052
|
+
CReadTransaction_t * transaction);
|
|
4053
|
+
|
|
4054
|
+
/** <No documentation available> */
|
|
4055
|
+
typedef struct dittoffi_result_CDocument_ptr {
|
|
4056
|
+
/** \brief
|
|
4057
|
+
* Non-`NULL` pointer to opaque object on error, `NULL` otherwise.
|
|
4058
|
+
*/
|
|
4059
|
+
dittoffi_error_t * error;
|
|
4060
|
+
|
|
4061
|
+
/** \brief
|
|
4062
|
+
* When no error occurred, the success value payload can be retrieved here.
|
|
4063
|
+
*
|
|
4064
|
+
* Otherwise, the value is to be ignored.
|
|
4065
|
+
*/
|
|
4066
|
+
CDocument_t * success;
|
|
4067
|
+
} dittoffi_result_CDocument_ptr_t;
|
|
4068
|
+
|
|
4069
|
+
/** \brief
|
|
4070
|
+
* [js only] Returns `-1` in case of outstanding non-`awaited` transaction operation.
|
|
4071
|
+
*/
|
|
4072
|
+
dittoffi_result_CDocument_ptr_t
|
|
4073
|
+
/* fn */ dittoffi_try_collection_get (
|
|
4074
|
+
CDitto_t const * ditto,
|
|
4075
|
+
char const * coll_name,
|
|
4076
|
+
slice_ref_uint8_t id,
|
|
4077
|
+
CReadTransaction_t * transaction);
|
|
4078
|
+
|
|
4079
|
+
/** <No documentation available> */
|
|
4080
|
+
typedef struct dittoffi_result_slice_boxed_uint8 {
|
|
4081
|
+
/** \brief
|
|
4082
|
+
* Non-`NULL` pointer to opaque object on error, `NULL` otherwise.
|
|
4083
|
+
*/
|
|
4084
|
+
dittoffi_error_t * error;
|
|
4085
|
+
|
|
4086
|
+
/** \brief
|
|
4087
|
+
* When no error occurred, the success value payload can be retrieved here.
|
|
4088
|
+
*
|
|
4089
|
+
* Otherwise, the value is to be ignored.
|
|
4090
|
+
*/
|
|
4091
|
+
slice_boxed_uint8_t success;
|
|
4092
|
+
} dittoffi_result_slice_boxed_uint8_t;
|
|
4093
|
+
|
|
4094
|
+
/** <No documentation available> */
|
|
4095
|
+
dittoffi_result_slice_boxed_uint8_t
|
|
4096
|
+
/* fn */ dittoffi_try_collection_insert_value (
|
|
4097
|
+
CDitto_t const * ditto,
|
|
4098
|
+
char const * coll_name,
|
|
4099
|
+
slice_ref_uint8_t doc_cbor,
|
|
4100
|
+
WriteStrategyRs_t write_strategy,
|
|
4101
|
+
char const * log_hint,
|
|
4102
|
+
CWriteTransaction_t * txn);
|
|
4103
|
+
|
|
4104
|
+
/** <No documentation available> */
|
|
4105
|
+
dittoffi_result_bool_t
|
|
4106
|
+
/* fn */ dittoffi_try_collection_remove (
|
|
4107
|
+
CDitto_t const * ditto,
|
|
4108
|
+
char const * coll_name,
|
|
4109
|
+
CWriteTransaction_t * transaction,
|
|
4110
|
+
slice_ref_uint8_t id);
|
|
4111
|
+
|
|
4112
|
+
/** <No documentation available> */
|
|
4113
|
+
dittoffi_result_Vec_slice_boxed_uint8_t
|
|
4114
|
+
/* fn */ dittoffi_try_collection_remove_by_ids (
|
|
4115
|
+
CDitto_t const * ditto,
|
|
4116
|
+
char const * coll_name,
|
|
4117
|
+
CWriteTransaction_t * transaction,
|
|
4118
|
+
slice_ref_slice_boxed_uint8_t ids);
|
|
4119
|
+
|
|
4120
|
+
/** <No documentation available> */
|
|
4121
|
+
dittoffi_result_Vec_slice_boxed_uint8_t
|
|
4122
|
+
/* fn */ dittoffi_try_collection_remove_query_str (
|
|
4123
|
+
CDitto_t const * ditto,
|
|
4124
|
+
char const * coll_name,
|
|
4125
|
+
CWriteTransaction_t * transaction,
|
|
4126
|
+
char const * query,
|
|
4127
|
+
slice_ref_uint8_t query_args_cbor,
|
|
4128
|
+
slice_ref_COrderByParam_t order_by_params,
|
|
4129
|
+
int32_t limit,
|
|
4130
|
+
uint32_t offset);
|
|
4131
|
+
|
|
4132
|
+
/** <No documentation available> */
|
|
4133
|
+
dittoffi_result_void_t
|
|
4134
|
+
/* fn */ dittoffi_try_collection_update (
|
|
4135
|
+
CDitto_t const * ditto,
|
|
4136
|
+
char const * coll_name,
|
|
4137
|
+
CWriteTransaction_t * transaction,
|
|
4138
|
+
CDocument_t * document);
|
|
4139
|
+
|
|
4140
|
+
/** <No documentation available> */
|
|
4141
|
+
dittoffi_result_void_t
|
|
4142
|
+
/* fn */ dittoffi_try_collection_update_multiple (
|
|
4143
|
+
CDitto_t const * ditto,
|
|
4144
|
+
char const * coll_name,
|
|
4145
|
+
CWriteTransaction_t * transaction,
|
|
4146
|
+
Vec_CDocument_ptr_t documents);
|
|
4147
|
+
|
|
4148
|
+
/** <No documentation available> */
|
|
4149
|
+
dittoffi_result_slice_boxed_uint8_t
|
|
4150
|
+
/* fn */ dittoffi_try_document_get_cbor_with_path_type (
|
|
4151
|
+
CDocument_t const * document,
|
|
4152
|
+
char const * pointer,
|
|
4153
|
+
PathAccessorType_t path_type);
|
|
4154
|
+
|
|
4155
|
+
/** \brief
|
|
4156
|
+
* Adds a DQL subscription.
|
|
4157
|
+
*
|
|
4158
|
+
* Only `SELECT` queries are supported here.
|
|
4159
|
+
*
|
|
4160
|
+
* Returns no meaningful value but for the resulting potential `.error`.
|
|
4161
|
+
*/
|
|
4162
|
+
dittoffi_result_void_t
|
|
4163
|
+
/* fn */ dittoffi_try_experimental_add_dql_subscription (
|
|
4164
|
+
CDitto_t const * ditto,
|
|
4165
|
+
char const * query,
|
|
4166
|
+
slice_ref_uint8_t query_args_cbor);
|
|
4167
|
+
|
|
4168
|
+
/** <No documentation available> */
|
|
4169
|
+
typedef struct dittoffi_result_CDqlResponse_ptr {
|
|
4170
|
+
/** \brief
|
|
4171
|
+
* Non-`NULL` pointer to opaque object on error, `NULL` otherwise.
|
|
4172
|
+
*/
|
|
4173
|
+
dittoffi_error_t * error;
|
|
4174
|
+
|
|
4175
|
+
/** \brief
|
|
4176
|
+
* When no error occurred, the success value payload can be retrieved here.
|
|
4177
|
+
*
|
|
4178
|
+
* Otherwise, the value is to be ignored.
|
|
4179
|
+
*/
|
|
4180
|
+
CDqlResponse_t * success;
|
|
4181
|
+
} dittoffi_result_CDqlResponse_ptr_t;
|
|
4182
|
+
|
|
4183
|
+
/** \brief
|
|
4184
|
+
* Execute specified DQL statement
|
|
4185
|
+
*
|
|
4186
|
+
* Returns a DqlResponse, which contains vector of DqlResuls.
|
|
4187
|
+
* DqlResult contains values of Register field currently.
|
|
4188
|
+
*
|
|
4189
|
+
* This is replacement for the old FFI, which was returning documents.
|
|
4190
|
+
*/
|
|
4191
|
+
dittoffi_result_CDqlResponse_ptr_t
|
|
4192
|
+
/* fn */ dittoffi_try_experimental_exec_statement_str (
|
|
4193
|
+
CDitto_t const * ditto,
|
|
4194
|
+
CWriteTransaction_t * txn,
|
|
4195
|
+
char const * statement,
|
|
4196
|
+
slice_ref_uint8_t args_cbor);
|
|
4197
|
+
|
|
4198
|
+
/** <No documentation available> */
|
|
4199
|
+
typedef struct ChangeHandlerWithQueryResult {
|
|
4200
|
+
/** \brief
|
|
4201
|
+
* Must be freed with `ditto_dql_response_free`.
|
|
4202
|
+
*/
|
|
4203
|
+
CDqlResponse_t * query_result;
|
|
4204
|
+
} ChangeHandlerWithQueryResult_t;
|
|
4205
|
+
|
|
4206
|
+
/** <No documentation available> */
|
|
4207
|
+
typedef struct dittoffi_result_int64 {
|
|
4208
|
+
/** \brief
|
|
4209
|
+
* Non-`NULL` pointer to opaque object on error, `NULL` otherwise.
|
|
4210
|
+
*/
|
|
4211
|
+
dittoffi_error_t * error;
|
|
4212
|
+
|
|
4213
|
+
/** \brief
|
|
4214
|
+
* When no error occurred, the success value payload can be retrieved here.
|
|
4215
|
+
*
|
|
4216
|
+
* Otherwise, the value is to be ignored.
|
|
4217
|
+
*/
|
|
4218
|
+
int64_t success;
|
|
4219
|
+
} dittoffi_result_int64_t;
|
|
4220
|
+
|
|
4221
|
+
/** <No documentation available> */
|
|
4222
|
+
dittoffi_result_int64_t
|
|
4223
|
+
/* fn */ dittoffi_try_experimental_register_change_observer_str (
|
|
4224
|
+
CDitto_t const * ditto,
|
|
4225
|
+
char const * query,
|
|
4226
|
+
slice_ref_uint8_t query_args_cbor,
|
|
4227
|
+
LiveQueryAvailability_t lq_availability,
|
|
4228
|
+
void * ctx,
|
|
4229
|
+
void (*retain)(void *),
|
|
4230
|
+
void (*release)(void *),
|
|
4231
|
+
void (*c_cb)(void *, ChangeHandlerWithQueryResult_t));
|
|
4232
|
+
|
|
4233
|
+
/** \brief
|
|
4234
|
+
* Removes a DQL subscription.
|
|
4235
|
+
*
|
|
4236
|
+
* The arguments should be identical to the ones used during adding the subscription.
|
|
4237
|
+
* Returns no meaningful value but for the resulting potential `.error`.
|
|
4238
|
+
*/
|
|
4239
|
+
dittoffi_result_void_t
|
|
4240
|
+
/* fn */ dittoffi_try_experimental_remove_dql_subscription (
|
|
4241
|
+
CDitto_t const * ditto,
|
|
4242
|
+
char const * query,
|
|
4243
|
+
slice_ref_uint8_t query_args_cbor);
|
|
4244
|
+
|
|
4245
|
+
/** <No documentation available> */
|
|
4246
|
+
dittoffi_result_slice_boxed_uint8_t
|
|
4247
|
+
/* fn */ dittoffi_try_experimental_webhook_register_dql_live_query_str (
|
|
4248
|
+
CDitto_t const * ditto,
|
|
4249
|
+
char const * query,
|
|
4250
|
+
slice_ref_uint8_t query_args_cbor,
|
|
4251
|
+
char const * url);
|
|
4252
|
+
|
|
4253
|
+
/** <No documentation available> */
|
|
4254
|
+
typedef struct dittoffi_result_Vec_char_ptr {
|
|
4255
|
+
/** \brief
|
|
4256
|
+
* Non-`NULL` pointer to opaque object on error, `NULL` otherwise.
|
|
4257
|
+
*/
|
|
4258
|
+
dittoffi_error_t * error;
|
|
4259
|
+
|
|
4260
|
+
/** \brief
|
|
4261
|
+
* When no error occurred, the success value payload can be retrieved here.
|
|
4262
|
+
*
|
|
4263
|
+
* Otherwise, the value is to be ignored.
|
|
4264
|
+
*/
|
|
4265
|
+
Vec_char_ptr_t success;
|
|
4266
|
+
} dittoffi_result_Vec_char_ptr_t;
|
|
4267
|
+
|
|
4268
|
+
/** <No documentation available> */
|
|
4269
|
+
dittoffi_result_Vec_char_ptr_t
|
|
4270
|
+
/* fn */ dittoffi_try_get_collection_names (
|
|
4271
|
+
CDitto_t const * ditto);
|
|
4272
|
+
|
|
4273
|
+
/** <No documentation available> */
|
|
4274
|
+
dittoffi_result_int64_t
|
|
4275
|
+
/* fn */ dittoffi_try_live_query_register_str (
|
|
4276
|
+
CDitto_t const * ditto,
|
|
4277
|
+
char const * coll_name,
|
|
4278
|
+
char const * query,
|
|
4279
|
+
slice_ref_uint8_t query_args_cbor,
|
|
4280
|
+
slice_ref_COrderByParam_t order_by,
|
|
4281
|
+
int32_t limit,
|
|
4282
|
+
uint32_t offset,
|
|
4283
|
+
LiveQueryAvailability_t lq_availability,
|
|
4284
|
+
void * ctx,
|
|
4285
|
+
void (*retain)(void *),
|
|
4286
|
+
void (*release)(void *),
|
|
4287
|
+
void (*c_cb)(void *, c_cb_params_t));
|
|
4288
|
+
|
|
4289
|
+
/** <No documentation available> */
|
|
4290
|
+
dittoffi_result_void_t
|
|
4291
|
+
/* fn */ dittoffi_try_live_query_start (
|
|
4292
|
+
CDitto_t const * ditto,
|
|
4293
|
+
int64_t id);
|
|
4294
|
+
|
|
4295
|
+
/** <No documentation available> */
|
|
4296
|
+
dittoffi_result_void_t
|
|
4297
|
+
/* fn */ dittoffi_try_live_query_webhook_generate_new_api_secret (
|
|
4298
|
+
CDitto_t const * ditto);
|
|
4299
|
+
|
|
4300
|
+
/** <No documentation available> */
|
|
4301
|
+
dittoffi_result_slice_boxed_uint8_t
|
|
4302
|
+
/* fn */ dittoffi_try_live_query_webhook_register_str (
|
|
4303
|
+
CDitto_t const * ditto,
|
|
4304
|
+
char const * coll_name,
|
|
4305
|
+
char const * query,
|
|
4306
|
+
slice_ref_COrderByParam_t order_by,
|
|
4307
|
+
int32_t limit,
|
|
4308
|
+
uint32_t offset,
|
|
4309
|
+
char const * url);
|
|
4310
|
+
|
|
4311
|
+
/** <No documentation available> */
|
|
4312
|
+
dittoffi_result_void_t
|
|
4313
|
+
/* fn */ dittoffi_try_live_query_webhook_start_all (
|
|
4314
|
+
CDitto_t const * ditto);
|
|
4315
|
+
|
|
4316
|
+
/** <No documentation available> */
|
|
4317
|
+
dittoffi_result_void_t
|
|
4318
|
+
/* fn */ dittoffi_try_live_query_webhook_start_by_id (
|
|
4319
|
+
CDitto_t const * ditto,
|
|
4320
|
+
slice_ref_uint8_t doc_id);
|
|
4321
|
+
|
|
4322
|
+
/** <No documentation available> */
|
|
4323
|
+
typedef struct dittoffi_result_uint64 {
|
|
4324
|
+
/** \brief
|
|
4325
|
+
* Non-`NULL` pointer to opaque object on error, `NULL` otherwise.
|
|
4326
|
+
*/
|
|
4327
|
+
dittoffi_error_t * error;
|
|
4328
|
+
|
|
4329
|
+
/** \brief
|
|
4330
|
+
* When no error occurred, the success value payload can be retrieved here.
|
|
4331
|
+
*
|
|
4332
|
+
* Otherwise, the value is to be ignored.
|
|
4333
|
+
*/
|
|
4334
|
+
uint64_t success;
|
|
4335
|
+
} dittoffi_result_uint64_t;
|
|
4336
|
+
|
|
4337
|
+
/** <No documentation available> */
|
|
4338
|
+
dittoffi_result_uint64_t
|
|
4339
|
+
/* fn */ dittoffi_try_queries_hash (
|
|
4340
|
+
CDitto_t const * ditto,
|
|
4341
|
+
slice_ref_char_const_ptr_t coll_names,
|
|
4342
|
+
slice_ref_char_const_ptr_t queries);
|
|
4343
|
+
|
|
4344
|
+
/** <No documentation available> */
|
|
4345
|
+
typedef struct dittoffi_result_char_ptr {
|
|
4346
|
+
/** \brief
|
|
4347
|
+
* Non-`NULL` pointer to opaque object on error, `NULL` otherwise.
|
|
4348
|
+
*/
|
|
4349
|
+
dittoffi_error_t * error;
|
|
4350
|
+
|
|
4351
|
+
/** \brief
|
|
4352
|
+
* When no error occurred, the success value payload can be retrieved here.
|
|
4353
|
+
*
|
|
4354
|
+
* Otherwise, the value is to be ignored.
|
|
4355
|
+
*/
|
|
4356
|
+
char * success;
|
|
4357
|
+
} dittoffi_result_char_ptr_t;
|
|
4358
|
+
|
|
4359
|
+
/** <No documentation available> */
|
|
4360
|
+
dittoffi_result_char_ptr_t
|
|
4361
|
+
/* fn */ dittoffi_try_queries_hash_mnemonic (
|
|
4362
|
+
CDitto_t const * ditto,
|
|
4363
|
+
slice_ref_char_const_ptr_t coll_names,
|
|
4364
|
+
slice_ref_char_const_ptr_t queries);
|
|
4365
|
+
|
|
4366
|
+
/** <No documentation available> */
|
|
4367
|
+
dittoffi_result_void_t
|
|
4368
|
+
/* fn */ dittoffi_try_remove_subscription (
|
|
4369
|
+
CDitto_t const * ditto,
|
|
4370
|
+
char const * collection,
|
|
4371
|
+
char const * query,
|
|
4372
|
+
slice_ref_uint8_t query_args_cbor,
|
|
4373
|
+
slice_ref_COrderByParam_t order_by,
|
|
4374
|
+
int32_t limit,
|
|
4375
|
+
uint32_t offset);
|
|
4376
|
+
|
|
4377
|
+
/** <No documentation available> */
|
|
4378
|
+
void
|
|
4379
|
+
/* fn */ free_c_string_vec (
|
|
4380
|
+
Vec_char_ptr_t * strings);
|
|
4381
|
+
|
|
4382
|
+
/** \brief
|
|
4383
|
+
* The platform advises Rust that the status of publishing our service has
|
|
4384
|
+
* changed.
|
|
4385
|
+
*/
|
|
4386
|
+
void
|
|
4387
|
+
/* fn */ mdns_advertising_state_changed (
|
|
4388
|
+
TransportHandle_MdnsServerPlatformEvent_t const * handle,
|
|
4389
|
+
OnlineState_t state,
|
|
4390
|
+
TransportCondition_t condition);
|
|
4391
|
+
|
|
4392
|
+
/** \brief
|
|
4393
|
+
* The SDK requests to drop its handle to the mDNS discovery transport
|
|
4394
|
+
*
|
|
4395
|
+
* At some point dropping this events channel will effectively shut down and
|
|
4396
|
+
* remove the Transport. At time of writing, the Transport is still owned
|
|
4397
|
+
* within Peer.
|
|
4398
|
+
*/
|
|
4399
|
+
void
|
|
4400
|
+
/* fn */ mdns_client_free_handle (
|
|
4401
|
+
TransportHandle_MdnsClientPlatformEvent_t * handle);
|
|
4402
|
+
|
|
4403
|
+
/** \brief
|
|
4404
|
+
* The platform advises Rust that a peer has been identified.
|
|
4405
|
+
*/
|
|
4406
|
+
void
|
|
4407
|
+
/* fn */ mdns_platform_peer_appeared (
|
|
4408
|
+
TransportHandle_MdnsClientPlatformEvent_t const * handle,
|
|
4409
|
+
char const * announce_string);
|
|
4410
|
+
|
|
4411
|
+
/** \brief
|
|
4412
|
+
* The platform advises Rust that a peer's service has disappeared from mDNS.
|
|
4413
|
+
*/
|
|
4414
|
+
void
|
|
4415
|
+
/* fn */ mdns_platform_peer_disappeared (
|
|
4416
|
+
TransportHandle_MdnsClientPlatformEvent_t const * handle,
|
|
4417
|
+
char const * announce_string);
|
|
4418
|
+
|
|
4419
|
+
/** \brief
|
|
4420
|
+
* The platform advises Rust that the status of searching for services has
|
|
4421
|
+
* changed.
|
|
4422
|
+
*/
|
|
4423
|
+
void
|
|
4424
|
+
/* fn */ mdns_scanning_state_changed (
|
|
4425
|
+
TransportHandle_MdnsClientPlatformEvent_t const * handle,
|
|
4426
|
+
OnlineState_t state,
|
|
4427
|
+
TransportCondition_t condition);
|
|
4428
|
+
|
|
4429
|
+
/** \brief
|
|
4430
|
+
* The SDK requests to drop its handle to the mDNS advertising service.
|
|
4431
|
+
*
|
|
4432
|
+
* Ideally this should remove the advertiser automatically.
|
|
4433
|
+
* At time of writing now this must be done manually through Peer.
|
|
4434
|
+
*/
|
|
4435
|
+
void
|
|
4436
|
+
/* fn */ mdns_server_free_handle (
|
|
4437
|
+
TransportHandle_MdnsServerPlatformEvent_t * handle);
|
|
4438
|
+
|
|
4439
|
+
/** \brief
|
|
4440
|
+
* The platform advises Rust that we failed to resolve a peer's hostname and
|
|
4441
|
+
* port
|
|
4442
|
+
*/
|
|
4443
|
+
void
|
|
4444
|
+
/* fn */ mdns_service_did_not_resolve (
|
|
4445
|
+
TransportHandle_MdnsClientPlatformEvent_t const * handle,
|
|
4446
|
+
char const * announce_string);
|
|
4447
|
+
|
|
4448
|
+
/** \brief
|
|
4449
|
+
* The platform advises Rust that we have resolved a peer's hostname and port
|
|
4450
|
+
*/
|
|
4451
|
+
void
|
|
4452
|
+
/* fn */ mdns_service_did_resolve (
|
|
4453
|
+
TransportHandle_MdnsClientPlatformEvent_t const * handle,
|
|
4454
|
+
char const * announce_string,
|
|
4455
|
+
char const * hostname,
|
|
4456
|
+
uint16_t port);
|
|
4457
|
+
|
|
4458
|
+
/** <No documentation available> */
|
|
4459
|
+
Vec_char_ptr_t *
|
|
4460
|
+
/* fn */ new_c_string_vec (void);
|
|
4461
|
+
|
|
4462
|
+
/** <No documentation available> */
|
|
4463
|
+
typedef struct Erased Erased_t;
|
|
4464
|
+
|
|
4465
|
+
/** \brief
|
|
4466
|
+
* An FFI-safe `Poll<()>`.
|
|
4467
|
+
*/
|
|
4468
|
+
/** \remark Has the same ABI as `int8_t` **/
|
|
4469
|
+
#ifdef DOXYGEN
|
|
4470
|
+
typedef
|
|
4471
|
+
#endif
|
|
4472
|
+
enum PollFuture {
|
|
4473
|
+
/** <No documentation available> */
|
|
4474
|
+
POLL_FUTURE_COMPLETED = 0,
|
|
4475
|
+
/** <No documentation available> */
|
|
4476
|
+
POLL_FUTURE_PENDING = -1,
|
|
4477
|
+
}
|
|
4478
|
+
#ifndef DOXYGEN
|
|
4479
|
+
; typedef int8_t
|
|
4480
|
+
#endif
|
|
4481
|
+
PollFuture_t;
|
|
4482
|
+
|
|
4483
|
+
/** \brief
|
|
4484
|
+
* The layout of `core::task::wake::Context` is opaque/subject to changes.
|
|
4485
|
+
*/
|
|
4486
|
+
typedef struct Opaque_Context Opaque_Context_t;
|
|
4487
|
+
|
|
4488
|
+
/** <No documentation available> */
|
|
4489
|
+
typedef struct FfiFutureVTable {
|
|
4490
|
+
/** <No documentation available> */
|
|
4491
|
+
void (*release_vptr)(Erased_t *);
|
|
4492
|
+
|
|
4493
|
+
/** <No documentation available> */
|
|
4494
|
+
PollFuture_t (*dyn_poll)(Erased_t *, Opaque_Context_t *);
|
|
4495
|
+
} FfiFutureVTable_t;
|
|
4496
|
+
|
|
4497
|
+
/** <No documentation available> */
|
|
4498
|
+
typedef struct VirtualPtr__Erased_ptr_FfiFutureVTable {
|
|
4499
|
+
/** <No documentation available> */
|
|
4500
|
+
Erased_t * ptr;
|
|
4501
|
+
|
|
4502
|
+
/** <No documentation available> */
|
|
4503
|
+
FfiFutureVTable_t vtable;
|
|
4504
|
+
} VirtualPtr__Erased_ptr_FfiFutureVTable_t;
|
|
4505
|
+
|
|
4506
|
+
/** \brief
|
|
4507
|
+
* `Box<dyn 'static + Send + FnMut() -> Ret>`
|
|
4508
|
+
*/
|
|
4509
|
+
typedef struct BoxDynFnMut0_void {
|
|
4510
|
+
/** <No documentation available> */
|
|
4511
|
+
void * env_ptr;
|
|
4512
|
+
|
|
4513
|
+
/** <No documentation available> */
|
|
4514
|
+
void (*call)(void *);
|
|
4515
|
+
|
|
4516
|
+
/** <No documentation available> */
|
|
4517
|
+
void (*free)(void *);
|
|
4518
|
+
} BoxDynFnMut0_void_t;
|
|
4519
|
+
|
|
4520
|
+
/** <No documentation available> */
|
|
4521
|
+
typedef struct DropGlueVTable {
|
|
4522
|
+
/** <No documentation available> */
|
|
4523
|
+
void (*release_vptr)(Erased_t *);
|
|
4524
|
+
} DropGlueVTable_t;
|
|
4525
|
+
|
|
4526
|
+
/** <No documentation available> */
|
|
4527
|
+
typedef struct VirtualPtr__Erased_ptr_DropGlueVTable {
|
|
4528
|
+
/** <No documentation available> */
|
|
4529
|
+
Erased_t * ptr;
|
|
4530
|
+
|
|
4531
|
+
/** <No documentation available> */
|
|
4532
|
+
DropGlueVTable_t vtable;
|
|
4533
|
+
} VirtualPtr__Erased_ptr_DropGlueVTable_t;
|
|
4534
|
+
|
|
4535
|
+
/** <No documentation available> */
|
|
4536
|
+
typedef struct FfiFutureExecutorVTable {
|
|
4537
|
+
/** <No documentation available> */
|
|
4538
|
+
void (*release_vptr)(Erased_t *);
|
|
4539
|
+
|
|
4540
|
+
/** <No documentation available> */
|
|
4541
|
+
Erased_t * (*retain_vptr)(Erased_t const *);
|
|
4542
|
+
|
|
4543
|
+
/** <No documentation available> */
|
|
4544
|
+
VirtualPtr__Erased_ptr_FfiFutureVTable_t (*dyn_spawn)(Erased_t const *, VirtualPtr__Erased_ptr_FfiFutureVTable_t);
|
|
4545
|
+
|
|
4546
|
+
/** <No documentation available> */
|
|
4547
|
+
VirtualPtr__Erased_ptr_FfiFutureVTable_t (*dyn_spawn_blocking)(Erased_t const *, BoxDynFnMut0_void_t);
|
|
4548
|
+
|
|
4549
|
+
/** <No documentation available> */
|
|
4550
|
+
void (*dyn_block_on)(Erased_t const *, VirtualPtr__Erased_ptr_FfiFutureVTable_t);
|
|
4551
|
+
|
|
4552
|
+
/** <No documentation available> */
|
|
4553
|
+
VirtualPtr__Erased_ptr_DropGlueVTable_t (*dyn_enter)(Erased_t const *);
|
|
4554
|
+
} FfiFutureExecutorVTable_t;
|
|
4555
|
+
|
|
4556
|
+
/** <No documentation available> */
|
|
4557
|
+
typedef struct VirtualPtr__Erased_ptr_FfiFutureExecutorVTable {
|
|
4558
|
+
/** <No documentation available> */
|
|
4559
|
+
Erased_t * ptr;
|
|
4560
|
+
|
|
4561
|
+
/** <No documentation available> */
|
|
4562
|
+
FfiFutureExecutorVTable_t vtable;
|
|
4563
|
+
} VirtualPtr__Erased_ptr_FfiFutureExecutorVTable_t;
|
|
4564
|
+
|
|
4565
|
+
/** <No documentation available> */
|
|
4566
|
+
typedef struct FfiFnMutVTable {
|
|
4567
|
+
/** <No documentation available> */
|
|
4568
|
+
void (*release_vptr)(Erased_t *);
|
|
4569
|
+
|
|
4570
|
+
/** <No documentation available> */
|
|
4571
|
+
void (*call)(Erased_t *);
|
|
4572
|
+
} FfiFnMutVTable_t;
|
|
4573
|
+
|
|
4574
|
+
/** <No documentation available> */
|
|
4575
|
+
typedef struct VirtualPtr__Erased_ptr_FfiFnMutVTable {
|
|
4576
|
+
/** <No documentation available> */
|
|
4577
|
+
Erased_t * ptr;
|
|
4578
|
+
|
|
4579
|
+
/** <No documentation available> */
|
|
4580
|
+
FfiFnMutVTable_t vtable;
|
|
4581
|
+
} VirtualPtr__Erased_ptr_FfiFnMutVTable_t;
|
|
4582
|
+
|
|
4583
|
+
/** \brief
|
|
4584
|
+
* Keep in sync with `/rust/dittolive-ditto/dittoffi.rs`
|
|
4585
|
+
*/
|
|
4586
|
+
typedef struct ExecutorFunctions {
|
|
4587
|
+
/** <No documentation available> */
|
|
4588
|
+
VirtualPtr__Erased_ptr_FfiFutureExecutorVTable_t (*get_current_handle)(void);
|
|
4589
|
+
|
|
4590
|
+
/** <No documentation available> */
|
|
4591
|
+
void (*block_in_place)(VirtualPtr__Erased_ptr_FfiFnMutVTable_t);
|
|
4592
|
+
} ExecutorFunctions_t;
|
|
4593
|
+
|
|
4594
|
+
/** <No documentation available> */
|
|
4595
|
+
void
|
|
4596
|
+
/* fn */ register_executor_functions (
|
|
4597
|
+
ExecutorFunctions_t fns);
|
|
4598
|
+
|
|
4599
|
+
/** \brief
|
|
4600
|
+
* The SDK requests to drop its handle to this TCP Client transport
|
|
4601
|
+
*/
|
|
4602
|
+
void
|
|
4603
|
+
/* fn */ static_tcp_client_free_handle (
|
|
4604
|
+
TransportHandle_StaticTcpClientPlatformEvent_t * handle);
|
|
4605
|
+
|
|
4606
|
+
/** \brief
|
|
4607
|
+
* Make an UninitializedDitto object as an opaque pointer.
|
|
4608
|
+
*
|
|
4609
|
+
* This object serves as an intermediate object that allows database access.
|
|
4610
|
+
* This allows the SDK to check if a pre-existing site ID has been persisted.
|
|
4611
|
+
*/
|
|
4612
|
+
UninitializedDitto_t *
|
|
4613
|
+
/* fn */ uninitialized_ditto_make (
|
|
4614
|
+
char const * working_dir);
|
|
4615
|
+
|
|
4616
|
+
/** <No documentation available> */
|
|
4617
|
+
typedef struct StaticDropGlueVTable {
|
|
4618
|
+
/** <No documentation available> */
|
|
4619
|
+
void (*release_vptr)(Erased_t *);
|
|
4620
|
+
|
|
4621
|
+
/** <No documentation available> */
|
|
4622
|
+
Erased_t * (*retain_vptr)(Erased_t const *);
|
|
4623
|
+
} StaticDropGlueVTable_t;
|
|
4624
|
+
|
|
4625
|
+
/** <No documentation available> */
|
|
4626
|
+
typedef struct VirtualPtr__Erased_ptr_StaticDropGlueVTable {
|
|
4627
|
+
/** <No documentation available> */
|
|
4628
|
+
Erased_t * ptr;
|
|
4629
|
+
|
|
4630
|
+
/** <No documentation available> */
|
|
4631
|
+
StaticDropGlueVTable_t vtable;
|
|
4632
|
+
} VirtualPtr__Erased_ptr_StaticDropGlueVTable_t;
|
|
4633
|
+
|
|
4634
|
+
/** \brief
|
|
4635
|
+
* A `dyn` type-erased (and thus completely layout agnostic
|
|
4636
|
+
* (_e.g._, tokio-agnostic)) and yet FFI-compatible version of an `async`
|
|
4637
|
+
* runtime executor.
|
|
4638
|
+
*
|
|
4639
|
+
* Keep it in sync with `rust/dittolive-ditto-sys/lib.rs`!
|
|
4640
|
+
*/
|
|
4641
|
+
typedef struct DynExecutor {
|
|
4642
|
+
/** \brief
|
|
4643
|
+
* The main object used to spawn futures and whatnot.
|
|
4644
|
+
*/
|
|
4645
|
+
VirtualPtr__Erased_ptr_FfiFutureExecutorVTable_t handle;
|
|
4646
|
+
|
|
4647
|
+
/** \brief
|
|
4648
|
+
* The drop glue potentially driving the shutdown of the runtime.
|
|
4649
|
+
*/
|
|
4650
|
+
VirtualPtr__Erased_ptr_StaticDropGlueVTable_t _runtime;
|
|
4651
|
+
} DynExecutor_t;
|
|
4652
|
+
|
|
4653
|
+
/** <No documentation available> */
|
|
4654
|
+
UninitializedDitto_t *
|
|
4655
|
+
/* fn */ uninitialized_ditto_make_with_executor (
|
|
4656
|
+
char const * working_dir,
|
|
4657
|
+
DynExecutor_t executor);
|
|
4658
|
+
|
|
4659
|
+
/** <No documentation available> */
|
|
4660
|
+
typedef enum LicenseVerificationResult {
|
|
4661
|
+
/** <No documentation available> */
|
|
4662
|
+
LICENSE_VERIFICATION_RESULT_LICENSE_OK = 0,
|
|
4663
|
+
/** <No documentation available> */
|
|
4664
|
+
LICENSE_VERIFICATION_RESULT_VERIFICATION_FAILED = -1,
|
|
4665
|
+
/** <No documentation available> */
|
|
4666
|
+
LICENSE_VERIFICATION_RESULT_LICENSE_EXPIRED = -2,
|
|
4667
|
+
/** <No documentation available> */
|
|
4668
|
+
LICENSE_VERIFICATION_RESULT_UNSUPPORTED_FUTURE_VERSION = -3,
|
|
4669
|
+
} LicenseVerificationResult_t;
|
|
4670
|
+
|
|
4671
|
+
/** \brief
|
|
4672
|
+
* Verify a base64 encoded license string
|
|
4673
|
+
*
|
|
4674
|
+
* # Parameters
|
|
4675
|
+
* - `license`: A base64 encoded license string. This should be the output of
|
|
4676
|
+
* `ditto_licenser::license_mgr::generate()`.
|
|
4677
|
+
* - `out_error_msg`: An optional error message out parameter which will be written to if the
|
|
4678
|
+
* license verification. This error message is simplified and appropriate to show directly to an
|
|
4679
|
+
* SDK user.
|
|
4680
|
+
*/
|
|
4681
|
+
LicenseVerificationResult_t
|
|
4682
|
+
/* fn */ verify_license (
|
|
4683
|
+
char const * license,
|
|
4684
|
+
char * * out_err_msg);
|
|
4685
|
+
|
|
4686
|
+
/** \brief
|
|
4687
|
+
* The SDK requests to drop its handle to this WebSocket Client transport
|
|
4688
|
+
*/
|
|
4689
|
+
void
|
|
4690
|
+
/* fn */ websocket_client_free_handle (
|
|
4691
|
+
TransportHandle_WebsocketClientPlatformEvent_t * handle);
|
|
4692
|
+
|
|
4693
|
+
|
|
4694
|
+
#ifdef __cplusplus
|
|
4695
|
+
} /* extern \"C\" */
|
|
4696
|
+
#endif
|
|
4697
|
+
|
|
4698
|
+
#endif /* __RUST_DITTOFFI__ */
|