add observer

This commit is contained in:
ginuerzh
2024-01-03 20:53:00 +08:00
parent 6b5c04b5e4
commit 5a427b4eaf
3 changed files with 38 additions and 0 deletions

22
observer/observer.go Normal file
View File

@ -0,0 +1,22 @@
package observer
import "context"
type Options struct{}
type Option func(opts *Options)
type Observer interface {
Observe(ctx context.Context, events []Event, opts ...Option) error
}
type EventType string
const (
EventStatus EventType = "status"
EventStats EventType = "stats"
)
type Event interface {
Type() EventType
}