notifier

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 10, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Notifier

type Notifier[K any] struct {
	// contains filtered or unexported fields
}

func NewNotifier

func NewNotifier[K any]() *Notifier[K]

func (*Notifier[K]) Attach

func (n *Notifier[K]) Attach(observer Observer[K]) error

func (*Notifier[K]) Detach

func (n *Notifier[K]) Detach(observer Observer[K]) error

func (*Notifier[K]) Notify

func (n *Notifier[K]) Notify(ctx context.Context, event K) error

type Observer

type Observer[K any] interface {
	Handle(context.Context, K) error
}

type ObserverCallback

type ObserverCallback[K any] func(context.Context, K) error

type TopicCallbackNotifier

type TopicCallbackNotifier[K any] struct {
	// contains filtered or unexported fields
}

func NewTopicCallbackNotifier

func NewTopicCallbackNotifier[K any](topics []string) *TopicCallbackNotifier[K]

func (*TopicCallbackNotifier[K]) Attach

func (t *TopicCallbackNotifier[K]) Attach(topic string, observer ObserverCallback[K]) error

func (*TopicCallbackNotifier[K]) Notify

func (t *TopicCallbackNotifier[K]) Notify(ctx context.Context, topic string, event K) error

type TopicNotifier

type TopicNotifier[K any] struct {
	// contains filtered or unexported fields
}

func NewTopicNotifier

func NewTopicNotifier[K any](topics []string) *TopicNotifier[K]

func (*TopicNotifier[K]) Attach

func (n *TopicNotifier[K]) Attach(topic string, observer Observer[K]) error

func (*TopicNotifier[K]) Detach

func (n *TopicNotifier[K]) Detach(observer Observer[K]) error

func (*TopicNotifier[K]) Notify

func (n *TopicNotifier[K]) Notify(ctx context.Context, topic string, event K) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL