Abstract interface for storage of operational data

Refactor storage of operational data away from a hard-coded PostgreSQL database to an abstract interface. The existing PostgreSQL support has largely been refactored into this new API.

Also includes stubs, but not an implementation, of an in-memory store. This should be completed and the test suites refactored to use it instead of the createdb/query/dropdb cycle it currently uses.