New txn package

Introduce a new state/txn package which contains the transaction functionality extracted from state/State. A new TransactionRunner interface is implemented which provides methods to i) run transactions directly without retries, ii) invoke a callback to get transactions to run and retry if there is contention. All the hooks and other related functionality is moved out of State. The new txn runner can now be used standalone outside of the State instance, and is also embedded in State.

The various callsites are all migrated to use the new infrastructure. A few unit tests are also added for the hooks functionality - these were missing before.
> the errRefresh branch doesn't have a fallthrough so it returns ErrTransientFailure (as it should!).

Right, there's no implied fallthrough like in C (thank God... well, the Go authors anyway).

> if we were to have it return that in the branch, instead of by falling out of the switch, I think the behaviour would be clearer; but I can't immediately recall whether go's currently smart enough to analyse the branches and determine that we never leave the switch.

It is. If errRefresh were to return, then all branches would end in terminal instructions.