Pubsub refactoring: better API, more consistent with the transaction API.