session_manager

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventCallback

type EventCallback func(key string, eventsChannel <-chan interface{})

type Func

type Func func(string) (interface{}, error)

type Operation

type Operation string
const (
	Sub   Operation = "sub"
	Pub   Operation = "pub"
	Unsub Operation = "unsub"
)

type SessionManager

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

SessionManager is a manager for session channels It allows to subscribe, publish and unsubscribe to/from channels

func New

func New(
	logger *zap.Logger,
	eventsCallback EventCallback,
) *SessionManager

New creates a new SessionManager

func (*SessionManager) Pub

func (manager *SessionManager) Pub(key string, value interface{})

Pub publishes a value to a channel key

func (*SessionManager) Sub

func (manager *SessionManager) Sub(key string)

Sub subscribes to a channel key It's fine to call this function multiple times with the same key - only one channel will be created

func (*SessionManager) Unsub

func (manager *SessionManager) Unsub(key string)

Unsub unsubscribes from a channel key It's fine to call this function multiple times with the same key - only if the key still exists, it will be closed.

Jump to

Keyboard shortcuts

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