Restructure database module

* Remove unnnecessary double-namespacing
* Allow better for different database backends
* Implement a MockDatabase which is in-memory only, for testing purposes

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Remove unused methods from db class

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>