datastore: refactor transaction & datastore.

Hello again!

I rearranged a few things, hopefully for the better. I'll leave comments. :)
This is `lib/datastore/index.js` - it is now in charge of building the "require('datastore')" object (formerly defined in `lib/index.js`, which shouldn't be aware of the implementation of datastore.