Update DB API

The current KV database API isn't good for concurrent edits or efficiency of IO to the database.

Previously we explored the option of using Cassandra as the main backend but due to uncertainty in code stability and operational experience decided to pursue a SQL backend first. The DB API should *allow* for a Cassandra backend in the future.

This supersedes #184