@@ -11,8 +11,8 @@ type Processor interface {
11
11
ProcessImpression (event UserEvent )
12
12
}
13
13
14
- // DefaultEventProcessor is used out of the box by the SDK
15
- type DefaultEventProcessor struct {
14
+ // InMemQueueEventProcessor is used out of the box by the SDK
15
+ type InMemQueueEventProcessor struct {
16
16
MaxQueueSize int // max size of the queue before flush
17
17
FlushInterval time.Duration // in milliseconds
18
18
BatchSize int
@@ -23,13 +23,13 @@ type DefaultEventProcessor struct {
23
23
}
24
24
25
25
func NewEventProcessor (queueSize int , flushInterval time.Duration ) Processor {
26
- p := & DefaultEventProcessor {MaxQueueSize : queueSize , FlushInterval :flushInterval , Q :NewInMemoryQueue (queueSize ), EventDispatcher :& HttpEventDispatcher {}}
26
+ p := & InMemQueueEventProcessor {MaxQueueSize : queueSize , FlushInterval :flushInterval , Q :NewInMemoryQueue (queueSize ), EventDispatcher :& HttpEventDispatcher {}}
27
27
p .StartTicker ()
28
28
return p
29
29
}
30
30
31
31
// ProcessImpression processes the given impression event
32
- func (p * DefaultEventProcessor ) ProcessImpression (event UserEvent ) {
32
+ func (p * InMemQueueEventProcessor ) ProcessImpression (event UserEvent ) {
33
33
p .Q .Add (event )
34
34
35
35
if p .Q .Size () >= p .MaxQueueSize {
@@ -39,19 +39,19 @@ func (p *DefaultEventProcessor) ProcessImpression(event UserEvent) {
39
39
}
40
40
}
41
41
42
- func (p * DefaultEventProcessor ) EventsCount () int {
42
+ func (p * InMemQueueEventProcessor ) EventsCount () int {
43
43
return p .Q .Size ()
44
44
}
45
45
46
- func (p * DefaultEventProcessor ) GetEvents (count int ) []interface {} {
46
+ func (p * InMemQueueEventProcessor ) GetEvents (count int ) []interface {} {
47
47
return p .Q .Get (count )
48
48
}
49
49
50
- func (p * DefaultEventProcessor ) Remove (count int ) []interface {} {
50
+ func (p * InMemQueueEventProcessor ) Remove (count int ) []interface {} {
51
51
return p .Q .Remove (count )
52
52
}
53
53
54
- func (p * DefaultEventProcessor ) StartTicker () {
54
+ func (p * InMemQueueEventProcessor ) StartTicker () {
55
55
if p .Ticker != nil {
56
56
return
57
57
}
@@ -64,7 +64,7 @@ func (p *DefaultEventProcessor) StartTicker() {
64
64
}
65
65
66
66
// ProcessImpression processes the given impression event
67
- func (p * DefaultEventProcessor ) FlushEvents () {
67
+ func (p * InMemQueueEventProcessor ) FlushEvents () {
68
68
// we flush when queue size is reached.
69
69
// however, if there is a ticker cycle already processing, we should wait
70
70
p .Mux .Lock ()
0 commit comments