graphsubscriptions

package
v1.34.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const NotificationChannelBufferSize = 10

NotificationChannelBufferSize is the buffer size for task subscription channels

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager manages all active subscriptions for real-time updates

func GetGlobalManager added in v0.51.0

func GetGlobalManager() *Manager

GetGlobalManager returns the global subscription manager instance

func NewManager

func NewManager() *Manager

NewManager creates a new subscription manager

func (*Manager) HasRedis added in v1.27.2

func (sm *Manager) HasRedis() bool

HasRedis reports whether this manager is configured to distribute notifications across processes via redis

func (*Manager) Publish

func (sm *Manager) Publish(userID, orgID string, notification Notification) error

Publish sends a notification to the subscribers it is addressed to in this process, and, when Redis is configured, to subscribers of other processes as well

func (*Manager) Subscribe

func (sm *Manager) Subscribe(userID, orgID string, ch chan Notification)

Subscribe adds a new subscriber for notifications addressed to the user directly as well as those addressed to the whole org the user is currently in

func (*Manager) Unsubscribe

func (sm *Manager) Unsubscribe(userID, orgID string, ch chan Notification)

Unsubscribe removes a subscriber

func (*Manager) WithRedis added in v1.27.2

func (sm *Manager) WithRedis(client *redis.Client) *Manager

WithRedis enables cross-process notification delivery

type Notification added in v0.51.0

type Notification interface{}

Notification is an interface that represents a notification that can be published This avoids import cycles with ent/generated The ent/generated.Notification type has ID and UserID fields that satisfy this interface

type RawNotification added in v1.27.2

type RawNotification struct {
	Payload []byte
}

RawNotification wraps a notification received over Redis that hasn't been unmarshaled into its concrete type yet

Jump to

Keyboard shortcuts

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