ANN: Invitation to try LiteCore (the 2.0 client engine in development)

Happy New Year! I know most of you are focused on developing and supporting your own apps using Couchbase Mobile, rather than experimenting with bleeding-edge code. But for those of you who may be interested in exploring…

We have a project called couchbase-lite-core, or LiteCore, which will be the engine of Couchbase Lite 2.0 across all platforms. It’s written in C++ so that it can be cross-platform and fast. It exposes a C API, which will then be called by the language/platform-specific public 2.0 APIs that developers will use.

Using shared core code will speed up our development, improve feature parity, and generally improve compatibility between platforms. It also makes it easier to support new languages — we don’t have current plans to add any ourselves, but if someone wanted to create Couchbase Lite bindings for Python or Rust, it would be pretty straightforward.

Did I mention “fast”? For CRUD operations, LiteCore is around ten times faster than Couchbase Lite 1.x on iOS. Going through platform API bindings will reduce speed somewhat due to impedance mismatch, but I still see at least 5x speedup going through experimental Objective-C APIs. LiteCore also includes a new query engine that supports “SELECT”-style queries, and which is much faster than map/reduce.

(I talked about LiteCore in my half of the “Future Of Couchbase Lite” session at Couchbase Connect 2016; you can watch the video.)

LiteCore is roughly at the alpha stage — it’s nearing feature-complete, and builds and runs on Apple platforms, Windows, Ubuntu, [update: and CentOS] and Android. It’s definitely useable! But the caveats are:

  • Under heavy construction; things may break from one commit to the next, and APIs may change.
  • Has not yet been extensively tested.
  • No replicator yet; this will be added later.
  • No REST API yet; ditto. (So no PhoneGap support.)
  • The C API is not the most convenient to use, if you’re used to cushy OO frameworks. (But there are experimental/unofficial Objective-C and Swift bindings included. Also some C# bindings, but I don’t know how functional they are yet.)

I realize that may be kind of off-putting, especially the lack of replicator! But if you’re still interested in trying out LiteCore, or even helping us complete it, you’re welcome to. Couchbase Lite has already been greatly helped by open-source contributors like you, ever since it was a tiny baby called TouchDB back in 2012.

—Jens

PS: Some of you probably want to know when this will ship! We don’t have a public release date to announce yet for Couchbase Lite 2.0. When we do, we’ll post it here.

The C# Interop folder contains all the P/Invoke definitions for the C API. The API folder is meant to contain some wrappers that will makes things more C#ish (i.e. make use of IEnumerator to make iteration easier and neatly wrap up the native object creation / disposal) and this API will be used by the 2.0 public API.

Also, LiteCore also builds and runs on CentOS in addition to the other platforms.

@jens

Will we still be able to leverage the Couchbase Lite Viewer in the future?
The Viewer is a great way to debug in development.

Sure, the viewer app will just need to be updated to use the new API and link with 2.0.