on 94de6bc help sign in
crush/internal/pubsub/events.go
35 lines 648 B history raw
1package pubsub
3import "context"
5const (
6 CreatedEvent EventType = "created"
7 UpdatedEvent EventType = "updated"
8 DeletedEvent EventType = "deleted"
9)
11type Suscriber[T any] interface {
12 Subscribe(context.Context) <-chan Event[T]
15type (
16 // EventType identifies the type of event
17 EventType string
19 // Event represents an event in the lifecycle of a resource
20 Event[T any] struct {
21 Type EventType
22 Payload T
23 }
25 Publisher[T any] interface {
26 Publish(EventType, T)
27 }
30// UpdateAvailableMsg is sent when a new version is available.
31type UpdateAvailableMsg struct {
32 CurrentVersion string
33 LatestVersion string
34 IsDevelopment bool