-
Notifications
You must be signed in to change notification settings - Fork 51
/
collector.go
36 lines (32 loc) · 1.2 KB
/
collector.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
package statscollector
import (
"sync"
"go.aporeto.io/trireme-lib/collector"
)
// NewCollector provides a new collector interface
func NewCollector() Collector {
return &collectorImpl{
Flows: map[string]*collector.FlowRecord{},
Users: map[string]*collector.UserRecord{},
ProcessedUsers: map[string]bool{},
DatapathPacketReports: []*collector.PacketReport{},
CounterReports: []*collector.CounterReport{},
DNSReport: make(chan *collector.DNSRequestReport),
}
}
// collectorImpl : This object is a stash implements two interfaces.
//
// collector.EventCollector - so datapath can report flow events
// CollectorReader - so components can extract information out of this stash
//
// It has a flow entries cache which contains unique flows that are reported
// back to the controller/launcher process
type collectorImpl struct {
Flows map[string]*collector.FlowRecord
ProcessedUsers map[string]bool
Users map[string]*collector.UserRecord
DatapathPacketReports []*collector.PacketReport
CounterReports []*collector.CounterReport
DNSReport chan *collector.DNSRequestReport
sync.Mutex
}