switcher

package
v1.24.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAlertUsers added in v1.22.0

func GetAlertUsers(pos database.AlertPosition, database *database.Database) *set.Set[uint]

map 效率更高

Types

type MessageSwitcher

type MessageSwitcher struct {
	DataBase *database.Database
	Users    []*NotifyUser
}

func NewMessageSwitch

func NewMessageSwitch(_ context.Context, db *database.Database) *MessageSwitcher

func (*MessageSwitcher) DeRegistUser

func (ms *MessageSwitcher) DeRegistUser(user *NotifyUser)

func (*MessageSwitcher) DispatchMessage

func (ms *MessageSwitcher) DispatchMessage(msg *msgbus.NotifyMessage)

func (*MessageSwitcher) RegistUser

func (ms *MessageSwitcher) RegistUser(user *NotifyUser)

func (*MessageSwitcher) Send

func (ms *MessageSwitcher) Send(user *NotifyUser, msg *msgbus.NotifyMessage) error

func (*MessageSwitcher) SendMessageToUser

func (ms *MessageSwitcher) SendMessageToUser(msg *msgbus.NotifyMessage, userid uint)

type NotifyUser

type NotifyUser struct {
	Username     string
	UserID       uint
	RWLock       sync.RWMutex
	CurrentWatch map[string]map[string][]string
	Conn         *websocket.Conn

	SessionID string
	// contains filtered or unexported fields
}

func NewNotifyUser

func NewNotifyUser(conn *websocket.Conn, username string, userid uint) *NotifyUser

func (*NotifyUser) CloseConn

func (nu *NotifyUser) CloseConn()

func (*NotifyUser) IsWatchObject

func (nu *NotifyUser) IsWatchObject(msg *msgbus.NotifyMessage) bool

func (*NotifyUser) Read

func (nu *NotifyUser) Read(into interface{}) error

func (*NotifyUser) SetCurrentWatch

func (nu *NotifyUser) SetCurrentWatch(w map[string]map[string][]string)

func (*NotifyUser) Write

func (nu *NotifyUser) Write(data interface{}) error

type ResID

type ResID struct {
	ClusterID       uint
	EnvironmentID   uint
	EnvironmentName string
	ProjectID       uint
	ProjectName     string
	TenantID        uint
	TenantName      string
}

Jump to

Keyboard shortcuts

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