The following components exist:
AddressManagerPeerManagerPingManagerPeer
Every component is structured as follows:
- There is a
Configstruct that contains all configuration options for the manager. - There is a "handle" struct that has the components name.
- Generally handles will be Arc'ed by the caller right after constructing.
(The
P2Putility f.e. only exposes Arc'ed handles.) - Methods intended for internal use are exposed through a
XxxManagerControltrait.
- There is a
Processorstruct that will live inside the runtime, so that there is direct access to the internal fields without locks. - Communication from the handle to the processor happens over channels.
- Sometimes we want to expose some data through the handle, this data
will unfortunately have to be stored in a shared
Statebehind a lock. - Components can expose events through a
Dispatchobject stored in the processor, users can listen by calling theadd_listenermethods on the handles. - There is a private
SendCtrltrait that is used to actually sendCtrlmessages. Usually it is implemented by the Manager itself and by the pair of(chan::Sender<Ctrl>, erin::Waker). So that event listeners can be registered from within the processor without needing the manager's handle.