cloudant/CDTDatastore — pull request #24 by mikerhodes (2014-04-28 10:11:30+00:00)
Title: Add attachments CRUD API 27994

This PR adds a CRUD API on top of the existing attachments functionality in TouchDB.

In brief, it provides:
- An API to create, read, update and delete attachments in CDTDatastore+Attachments.h/m.
- Updates happen in transactions, and should fail if:
- document update fails.
- attachments fail to be read from their streams (bad file path, network connection etc.).
- attachment database updates fail.
- Exposed the internal TouchDB database to the CDT* classes, as TouchDB's attachments implementation wasn't compatible with the API we wanted to use.

This is the first code we're written which interacts directly and significantly with TouchDB's database, so it's worth a closer check on how that's been done.

This PR deals purely with local CRUD. Given we modify TouchDB's internal structures in what looks like the correct manner, attachment replication should work fine, however, this is to be tested in a future PR by adding tests to the ReplicationAcceptance project.