-
Notifications
You must be signed in to change notification settings - Fork 1
/
dummy.go
33 lines (28 loc) · 1.49 KB
/
dummy.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
package queue
import "time"
// DummyMetrics is a stub metrics writer handler that uses by default and does nothing.
// Need just to reduce checks in code.
type DummyMetrics struct{}
func (DummyMetrics) WorkerSetup(_, _, _ uint) {}
func (DummyMetrics) WorkerInit(_ uint32) {}
func (DummyMetrics) WorkerSleep(_ uint32) {}
func (DummyMetrics) WorkerWakeup(_ uint32) {}
func (DummyMetrics) WorkerWait(_ uint32, _ time.Duration) {}
func (DummyMetrics) WorkerStop(_ uint32, _ bool, _ string) {}
func (DummyMetrics) QueuePut() {}
func (DummyMetrics) QueuePull() {}
func (DummyMetrics) QueueRetry() {}
func (DummyMetrics) QueueLeak(_ string) {}
func (DummyMetrics) QueueDeadline() {}
func (DummyMetrics) QueueLost() {}
func (DummyMetrics) SubqPut(_ string) {}
func (DummyMetrics) SubqPull(_ string) {}
func (DummyMetrics) SubqLeak(_ string) {}
// DummyDLQ is a stub DLQ implementation. It does nothing and need for queues with leak tolerance.
// It just leaks data to the trash.
type DummyDLQ struct{}
func (DummyDLQ) Enqueue(_ any) error { return nil }
func (DummyDLQ) Size() int { return 0 }
func (DummyDLQ) Capacity() int { return 0 }
func (DummyDLQ) Rate() float32 { return 0 }
func (DummyDLQ) Close() error { return nil }