server: persist all side-effects before executing them

The per-connection loop is now:
  1. execute any pending side-effects (must be idempotent)
  2. read a new request
  3. persist the new response and side effects

Note we still need to modify the server startup so it executes
all pending side-effects (in order to update the in-memory copy
of the database which is authoritive wrt transactions) *before*
processing any new requests, otherwise conflicting transactions
may get committed.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>