forked from VolantMQ/volantmq
/
interfaces.go
58 lines (49 loc) · 1.13 KB
/
interfaces.go
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
47
48
49
50
51
52
53
54
55
56
57
58
package systree
import (
"github.com/VolantMQ/vlapi/mqttp"
"github.com/VolantMQ/volantmq/types"
)
// Provider systree provider
type Provider interface {
SetCallbacks(types.TopicMessenger)
Metric() Metric
Topics() TopicsStat
Subscriptions() SubscriptionsStat
Clients() Clients
Sessions() Sessions
}
// Metric is wrap around all of metrics
type Metric interface {
Bytes() BytesMetric
Packets() PacketsMetric
}
// PacketsMetric packets metric
type PacketsMetric interface {
Sent(t mqttp.Type)
Received(t mqttp.Type)
}
// BytesMetric bytes metric
type BytesMetric interface {
Sent(bytes uint64)
Received(bytes uint64)
}
// Sessions Statistic of sessions
type Sessions interface {
Created(id string, status *SessionCreatedStatus)
Removed(id string, status *SessionDeletedStatus)
}
// Clients Statistic of sessions
type Clients interface {
Connected(id string, status *ClientConnectStatus)
Disconnected(id string, reason mqttp.ReasonCode)
}
// TopicsStat statistic of topics
type TopicsStat interface {
Added()
Removed()
}
// SubscriptionsStat statistic of subscriptions
type SubscriptionsStat interface {
Subscribed()
UnSubscribed()
}