forked from Silverfish/proton-bridge
chore(GODT-2848): Simplify User Event Service
Rather than having the services subscribe to each individual event type, have only one subscriber for the whole event object. This spreads the logic to the service through the `EventHandler` type. This is important for the next stage where the IMAP service will be required to apply events from the past.
This commit is contained in:
@ -19,16 +19,16 @@ package userevents
|
||||
|
||||
// Subscribable represents a type that allows the registration of event subscribers.
|
||||
type Subscribable interface {
|
||||
Subscribe(subscription Subscription)
|
||||
Unsubscribe(subscription Subscription)
|
||||
Subscribe(subscription EventSubscriber)
|
||||
Unsubscribe(subscription EventSubscriber)
|
||||
}
|
||||
|
||||
type NoOpSubscribable struct{}
|
||||
|
||||
func (n NoOpSubscribable) Subscribe(_ Subscription) {
|
||||
func (n NoOpSubscribable) Subscribe(_ EventSubscriber) {
|
||||
// Does nothing
|
||||
}
|
||||
|
||||
func (n NoOpSubscribable) Unsubscribe(_ Subscription) {
|
||||
func (n NoOpSubscribable) Unsubscribe(_ EventSubscriber) {
|
||||
// Does nothing
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user