-
Notifications
You must be signed in to change notification settings - Fork 31
/
dedupe.go
28 lines (23 loc) · 877 Bytes
/
dedupe.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
package v1alpha1
import (
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
)
// https://segment.com/blog/exactly-once-delivery/
type Dedupe struct {
AbstractStep `json:",inline" protobuf:"bytes,1,opt,name=abstractStep"`
// +kubebuilder:default="sha1(msg)"
UID string `json:"uid,omitempty" protobuf:"bytes,2,opt,name=uid"`
// MaxSize is the maximum number of entries to keep in the in-memory database used to store recent UIDs.
// Larger number mean bigger windows of time for dedupe, but greater memory usage.
// +kubebuilder:default="1M"
MaxSize resource.Quantity `json:"maxSize,omitempty" protobuf:"bytes,3,opt,name=maxSize"`
}
func (d Dedupe) getContainer(req getContainerReq) corev1.Container {
return containerBuilder{}.
init(req).
args("dedupe", d.UID, d.MaxSize.String()).
enablePrometheus().
resources(d.Resources).
build()
}