Handles all IMAP related tasks. Unlike the previous iteration, this new
service automatically adds and removes users from Gluon by interfacing
with server manager.
Add `OrderedCancelGroup` type to enforce the cancellation of go routines
in a reverse order. Additionally this type waits for the go-routine to
finish before proceeding to the next one.
We need this to guarantee that all the user services shut down properly
without deadlocking.
Copy data rather than hold onto the locks while sync is ongoing. The
data in question does not change while the sync is ongoing and holding
on to the locks during a very long sync can create a deadlock with
due to some IMAP operation that needs to acquire one of those locks with
write access.
Enable the User Event, User Identity and User SMTP service. The services
don't persist any data at the moment to avoid conflict with the existing
event loop.
This patch moves the `user.User.CheckAuth` function into the `State`
type as it contains all the necessary information to perform this check.
A couple of more interfaces are added to abstract the retrieval of the
Bridge and the User's key passwords, as well as telemetry reports.
Finally, adds `State.OnAddressEvents` which other services should use to
update the state.
Identity Service contains all the information related to user state,
addresses and keys.
This patch also introduces the `State` type which can be used by other
services to maintain their own copy of this state to avoid lock
contention.
Finally, there are currently no external facing methods via a CPC
interface. Those will added as needed once the refactoring of the
architecture is complete.
This patch adds the User Event Service which is meant to replace the
current event polling flow.
Each user interested in receiving events should register a new
subscriber using the `Service.Subscribe` function and then react on
the incoming events.
The current patch does not hook this up Bridge user as there are no
existing consumers, but it does provide extensive testing for the
expected behavior.
Rather than accessing the Bridge user list, each user register their
individual SMTP service with the server manager.
Note that some dependencies on the user data are hidden behind the
`UserInterface`. These will be removed in a future patch.
Refactor code to isolate the SMTP functionality in a dedicated SMTP
service for each user as discussed in the Bridge Service Architecture
RFC.
Some shared types have been moved from `user` to `usertypes` so that
they can be shared with Service and User Code.
Finally due to lack of recursive imports, the user data SMTP needs
access to is hidden behind an interface until the User Identity service
is implemented.