summaryrefslogtreecommitdiff
path: root/events/types.go
blob: 65a76d15da915dfde087702d86382b39078d3cfd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package events

type EventBus interface {
	SubscribeAll(subID string, ch chan<- Event) error
	SubscribeP(subID string, pattern string, ch chan<- Event) error
	Unsubscribe(subID string)
	UnsubscribeP(subID, pattern string)
	Len() uint
	Send(ev Event)
}

type Event interface {
	Plugin() string
	Type() EventType
	Message() string
}

type RREvent struct {
	// event typ
	typ EventType
	// plugin
	plugin string
	// message
	message string
}

// NewEvent initializes new event
func NewEvent(t EventType, plugin string, msg string) *RREvent {
	return &RREvent{
		typ:     t,
		plugin:  plugin,
		message: msg,
	}
}

func (r *RREvent) Type() EventType {
	return r.typ
}

func (r *RREvent) Message() string {
	return r.message
}

func (r *RREvent) Plugin() string {
	return r.plugin
}