Quantcast
Channel: Mobile - Couchbase Forums
Viewing all articles
Browse latest Browse all 1117

Document.exists private API in C SDK

$
0
0

Could you recommend a way to call or implement this Document.exists logic from the CBL C SDK using pure C functions?

The function is used throughout DocumentTest in my Kotlin Multiplatform library, which mirrors the Java SDK. The JVM implementation calls the package private Java API. The Objective-C implementation calls the c4Doc Objective-C private API.

In the C SDK, CBLDocument.exists is implemented in C++, but Kotlin native is unable to call C++ APIs, only pure C APIs. The C4Document is also only accessible through a C++ API.

If a CBLDocument_Exists function could be added to CBLPrivate.h and CBLDocument_CAPI.cc, calling through to the C++ APIs similar to CBLDocument_Generation, this would be really helpful for my usage.

My current native C implementation is super fragile and I expected it to break at some point, which it did in the 3.1.7 SDK release. I figured out the memory offsets to access the C4Document. For anything more than tests, this obviously wouldn’t fly. I also want to avoid recalculating and maintaining the memory offsets.

5 posts - 3 participants

Read full topic


Viewing all articles
Browse latest Browse all 1117

Trending Articles