utils

package
v0.0.29 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 3, 2024 License: Apache-2.0 Imports: 27 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// Default size for the cooldown queue
	DefaultQueueSize = 512
	// Default TTL for events put in the queue
	DefaultTTL = 5 * time.Second
)

Variables

This section is empty.

Functions

func CanonicalHash

func CanonicalHash(in []byte) (string, error)

func ClientIdentifierFromContext added in v0.0.17

func ClientIdentifierFromContext(ctx context.Context) domain.ClientIdentifier

func CompareJson

func CompareJson(a, b []byte) bool

func ContextFromGeneric

func ContextFromGeneric(parent context.Context, generic domain.Generic) context.Context

func ContextFromIdentifiers added in v0.0.5

func ContextFromIdentifiers(parent context.Context, id domain.ClientIdentifier) context.Context

func FilterAndMarshal added in v0.0.29

func FilterAndMarshal(d *unstructured.Unstructured) ([]byte, error)

func NewClient

func NewClient() (dynamic.Interface, error)

func PulsarMessageIDtoString

func PulsarMessageIDtoString(msgID pulsar.MessageID) string

PulsarMessageIDtoString is taken from github.com/kubescape/event-ingester-service/utils/common.go:func PulsarMessageIDtoString

func StartLivenessProbe added in v0.0.17

func StartLivenessProbe()

func StringValueBigger added in v0.0.17

func StringValueBigger(s1, s2 string) bool

Types

type CooldownQueue added in v0.0.8

type CooldownQueue struct {

	// public channel for reading events
	ResultChan <-chan watch.Event
	// contains filtered or unexported fields
}

CooldownQueue is a queue that lets clients put events into it with a cooldown

When a client puts an event into a queue, it forwards the event to its output channel and starts a cooldown for this event. If a client attempts to put the same event into the queue while the cooldown is running, the queue will silently drop the event. When the cooldown resets and a client puts the same event into the queue, it will be forwarded to the output channel

func NewCooldownQueue added in v0.0.8

func NewCooldownQueue(size int, cooldown time.Duration) *CooldownQueue

NewCooldownQueue returns a new Cooldown Queue

func (*CooldownQueue) Closed added in v0.0.25

func (q *CooldownQueue) Closed() bool

func (*CooldownQueue) Enqueue added in v0.0.8

func (q *CooldownQueue) Enqueue(e watch.Event)

Enqueue enqueues an event in the Cooldown Queue

func (*CooldownQueue) Stop added in v0.0.8

func (q *CooldownQueue) Stop()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL