Add EventDispatcher interface and use it.

Define an interface to dispatch stream-events (Events) from.  Currently
Events are being posted on the ChangeHooks interface, but Events are not
necessarily hook related.

This interface makes it possible to be post Events without having a copy
of the ChangeHooks interface.  This is particularly useful for plugins
to able to post Events.  The replication plugin can use this to post
Events instead of getting a copy of the ChangeHooks implementation,
since it does not actually do anything hook related.

This interface defines the line where Events go from being created to
being posted (passed to an object ready to presumably fire them).  This
also paves the way to make it possible for a dispatcher to modify,
filter, or route the Events elsewhere instead of firing them.  This
interface is intended to eventually allow plugins to modify the Event
path possibly to store Events persistently, and/or to dispatch them to
multiple masters.

Change-Id: Ib9f7547b5790ff787852ef00cf9b0e0258afe8dc
4 files changed