event

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bus

type Bus[Key, Event any] struct {
	// contains filtered or unexported fields
}

func NewBus

func NewBus[Key, Event any](keyFor func(Key) []byte) *Bus[Key, Event]

func (*Bus[Key, Event]) AddHandler

func (b *Bus[Key, Event]) AddHandler(h Handler[Key, Event])

func (*Bus[Key, Event]) OnEvent

func (b *Bus[Key, Event]) OnEvent(key Key, e Event) error

type ChatEvent

type ChatEvent struct {
	ChatID    *commonpb.ChatId
	Timestamp time.Time

	MetadataUpdates []*chatpb.MetadataUpdate
	MemberUpdates   []*chatpb.MemberUpdate
	MessageUpdate   *messagingpb.Message
	FlushedMessages []*messagingpb.Message
	PointerUpdate   *messagingpb.PointerUpdate
	IsTyping        *messagingpb.IsTyping
}

func (*ChatEvent) Clone

func (e *ChatEvent) Clone() *ChatEvent

type Handler

type Handler[Key, Event any] interface {
	OnEvent(key Key, e Event)
}

type HandlerFunc

type HandlerFunc[Key, Event any] func(Key, Event)

HandlerFunc is an adapter to allow the use of ordinary functions as Handlers.

func (HandlerFunc[Key, Event]) OnEvent

func (f HandlerFunc[Key, Event]) OnEvent(key Key, e Event)

OnEvent calls f(key, e).

type ProfileGenerator

type ProfileGenerator interface {
	OnProfileUpdated(ctx context.Context, userID *commonpb.UserId)
}

type ProtoEventStream

type ProtoEventStream[E any, P proto.Message] struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewProtoEventStream

func NewProtoEventStream[E any, P proto.Message](
	id string,
	bufferSize int,
	selector func(event E) (P, bool),
) *ProtoEventStream[E, P]

func (*ProtoEventStream[E, P]) Channel

func (s *ProtoEventStream[E, P]) Channel() <-chan P

func (*ProtoEventStream[E, P]) Close

func (s *ProtoEventStream[E, P]) Close()

func (*ProtoEventStream[E, P]) ID

func (s *ProtoEventStream[E, P]) ID() string

func (*ProtoEventStream[E, P]) Notify

func (s *ProtoEventStream[E, P]) Notify(event E, timeout time.Duration) error

type Stream

type Stream[E any] interface {
	ID() string
	Notify(event E, timeout time.Duration) error
	Close()
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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