Scope of Project:

Build an implementation of the Cloud Sync Service (CSS) storage interface that works with CouchDB, and test it with unit tests.

Background :

As of writing this, MongoDB is the only production capable database that can be configured for Cloud Sync Service storage. Mongo recently changed their licensing terms, making it harder to consume the open-horizon platform into a commercial product. This project will extend the sync service to support CouchDB as an alternative.

The storage component of the sync-service has a Golang interface that is used by the core to persist object metadata and the objects themselves. The task is to provide an implementation of that interface that works with CouchDB.

Assumptions:

Specifications:

CouchDB notable fundamentals:

  1. To update/delete an object in CouchDB, the first step is always to GET() the object. This is because the current 'rev' i.e 'revision' is needed to perform any modifications. Due to this - there are no direct or in-built methods to delete/update objects based on queries.
  2. While updating an object that has an attachment, the 'stub' value must be set as true in the object when calling PUT, otherwise, the attachment will be removed in the updated object. This is handled by kivik implicitly but is a notable behaviour.

Concepts:

A CSS object consists of metadata, binary data, and some other properties. This section documents how CSS concepts relate to CouchDB concepts.