events

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Module

func Module(c *di.Container)

Types

type CallbackFunc

type CallbackFunc func(eventType EventType, reference string) error

type CancelFunc

type CancelFunc func()

type EventReadWriter

type EventReadWriter interface {
	EventReader
	// contains filtered or unexported methods
}

func NewInMemory

func NewInMemory() EventReadWriter

type EventReader

type EventReader interface {
	// Introduce event type filtering in the call to SubscribeUser(uesrID string, cb CallbackFunc, eventTypes ...EventType) CancelFunc
	// Introduce reference filtering in the call to SubscribeUser(uesrID string, cb CallbackFunc, map[EventType][]string) CancelFunc
	SubscribeUser(userID string, cb CallbackFunc) CancelFunc
	SubscribeWorkspace(workspaceID string, cb CallbackFunc) CancelFunc
}

type EventSender

type EventSender interface {
	// User sends this event to this user only
	User(id string, eventType EventType, reference string)

	// Codebase sends this event to all members of this codebase
	Codebase(id string, eventType EventType, reference string) error

	// Workspace sends this event to all members of the codebase of this workspace
	Workspace(id string, eventType EventType, reference string) error
}

TODO: support sending multiple events. Some users of this interface call methods in a loop.

func NewSender

func NewSender(
	codebaseUserRepo db_codebase.CodebaseUserRepository,
	workspaceRepo db_workspace.WorkspaceReader,
	events EventReadWriter,
) EventSender

type EventType

type EventType int
const (
	CodebaseEvent EventType = iota
	CodebaseUpdated
	ViewUpdated
	ViewStatusUpdated
	WorkspaceUpdated
	WorkspaceUpdatedComments
	WorkspaceUpdatedReviews
	ReviewUpdated
	WorkspaceUpdatedActivity
	WorkspaceUpdatedSnapshot
	WorkspaceUpdatedPresence
	WorkspaceUpdatedSuggestion
	GitHubPRUpdated
	NotificationEvent
	StatusUpdated
	CompletedOnboardingStep
	WorkspaceWatchingStatusUpdated
)

func (EventType) String

func (e EventType) String() string

type Topic

type Topic string

type TopicSubscriber

type TopicSubscriber struct {
	Topic         Topic
	SubscriberKey string
}

Jump to

Keyboard shortcuts

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