Make File and Psql storage threaded

This also splits Storage into Storage(), which is a public storage
interface, and StorageBackend(), which is a more internal interface.
The various storage classes (File, Psql, Memory) are now StorageBackend
implementations.