1package pubsub
2
3import "context"
4
5const (
6 CreatedEvent EventType = "created"
7 UpdatedEvent EventType = "updated"
8 DeletedEvent EventType = "deleted"
9)
10
11type Suscriber[T any] interface {
12 Subscribe(context.Context) <-chan Event[T]
13}
14
15type (
16 // EventType identifies the type of event
17 EventType string
18
19 // Event represents an event in the lifecycle of a resource
20 Event[T any] struct {
21 Type EventType
22 Payload T
23 }
24
25 Publisher[T any] interface {
26 Publish(EventType, T)
27 }
28)
29
30// UpdateAvailableMsg is sent when a new version is available.
31type UpdateAvailableMsg struct {
32 CurrentVersion string
33 LatestVersion string
34}