refactor(handlers): send notification events explicitly in the handlers
Context
As part of Refactor registry notifications system (&8628 - closed) we want to simplify the way event notifications are being sent. The current notifications system relies on the existing filesystem wrappers and that abstraction masks how and when the notifications are sent.
Proposal
The idea here is to make it explicit on how we add an event so that it can be sent.
In the first iteration, we will simply define and attach a "bridge" between the existing notification system and the handlers, so that we can make an explicit call to the notification system.
The bridge will hold a notifications.Sink
and will be responsible for calling the Write
method so that the event is sent properly.
Following this approach will ensure we use the existing sinks, so the retrying mechanism will stay in place. However, we will also need to start breaking the relationship that exists with the current type bridge struct
so that notifications are not sent more than once.
Implementation
- Define a
QueueBridge
type that can write events using aSink
- Attach the
QueueBridge
to the handlers. - Remove the need for
type bridge struct
slowly - that is - 1 MR per expected event would probably be best, depends on the amount of changes needed.
We already added tests in test(notifications): add conformance tests for ... (#763 - closed), so going this way should ensure we don't break the current functionality.