On Wed, Oct 18, 2017 at 6:10 AM, Jens Alfke <[email protected]> wrote:

>
>
> On Oct 17, 2017, at 4:13 PM, Matias Piipari <[email protected]>
> wrote:
>
> Creating an equivalent higher level API in Node.js executable ES7 (or
> TypeScript) which behind the scenes calls to the same C++ APIs, using the
> public Swift API as a guide for API design should not be impossible.
>
>
> I agree. I’m not sure how the actual inter-language glue would work; I
> have some experience with binding V8 to C++ but that was back in 2009.
> Hopefully it can be automated to the extent of exposing JS functions
> corresponding to the C API.
>

The two options that strike as the best ones for me are:
1. Writing the JS bridge in C++ using the N-API (
https://nodejs.org/api/n-api.html), i.e. to expose objects to the
JavaScript environment that are backed by native code. This should work
with the Chackra JS engine as well, not just V8 (there is of course also a
C++ API still for V8 that would let one do the same thing).
2. Using the couchbase-lite-core C API and an FFI bridge.

Option #2 likely yields a prototype easier and faster and #1 is a better
long term solution.

What's the status of the C / C++ APIs, in that they are at least not noted
to intended as the "public" API? Does that mean that they are to go
substantial changes and some stabler / smaller subset is to be introduced
still? Or have I just hit some out of date documentatioN/


>
> I guess a key question is whether it's a sensible time to try such a thing
> (the README in the CBL repo states that the CBL API is in flux, in early
> stage of development etc). Should I wait?
>
>
> The CBL 2 API has mostly settled down by now. There are some changes to
> the Document API we’re discussing internally, to make thread-safety easier
> to achieve and to simplify naming, but they shouldn’t have a big impact on
> a JS binding.
>

The precise way in which V8 handles thread isolation I bet will actually
cause some pain. If the threading behaviour was like in CBL for iOS / macOS
1.x like I have potential solutions in mind. Could you explain more about
the threading model, and what you describe as making threadsafety easier,
in couchbase-lite-core?


>
> —Jens
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Couchbase Mobile" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/mobile-couchbase/4B6RDHriNak/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/mobile-couchbase/D20031DF-FA96-4C19-BAA5-
> 42E35F624CAB%40couchbase.com
> <https://groups.google.com/d/msgid/mobile-couchbase/D20031DF-FA96-4C19-BAA5-42E35F624CAB%40couchbase.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
- - - - -
Matias Piipari, PhD
http://twitter.com/mz2

Manuscripts - A writing tool like nothing you have seen before
http://manuscriptsapp.com

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/CAJUwHJh%2BNbu0UCvY3catU9_StiHYWFWK-uUDyRBdzoqLCd4smQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to