Documentation
¶
Index ¶
- type Alert
- type MessageSwitcher
- func (ms *MessageSwitcher) DeRegistUser(user *NotifyUser)
- func (ms *MessageSwitcher) DispatchMessage(msg *msgbus.NotifyMessage)
- func (ms *MessageSwitcher) RegistUser(user *NotifyUser)
- func (ms *MessageSwitcher) Send(user *NotifyUser, msg *msgbus.NotifyMessage) error
- func (ms *MessageSwitcher) SendMessageToUser(msg *msgbus.NotifyMessage, userid uint)
- type NotifyUser
- type ResID
- type WebhookAlert
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alert ¶
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 WebhookAlert ¶
type WebhookAlert struct { Receiver string `json:"receiver"` Status string `json:"status"` Alerts []Alert `json:"alerts"` GroupLabels map[string]string `json:"groupLabels"` CommonLabels map[string]string `json:"commonLabels"` CommonAnnotations map[string]string `json:"commonAnnotations"` ExternalURL string `json:"externalURL"` Version string `json:"version"` GroupKey string `json:"groupKey"` TruncatedAlerts int64 `json:"truncatedAlerts"` DataBase *database.Database }
func (*WebhookAlert) GetAlertUsers ¶
func (w *WebhookAlert) GetAlertUsers(pos database.AlertPosition) map[uint]struct{}
map 效率更高
Click to show internal directories.
Click to hide internal directories.