deduper

package
v2.0.0-...-dac0b9e Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deduper

type Deduper struct {
	// contains filtered or unexported fields
}

Deduper is a job handler that wraps another job handler (typically Limiter) and only creates a new job if an existing job does not already exist.

func New

func New(logger *zap.Logger, handler model.JobHandler) *Deduper

New creates a Deduper.

func (*Deduper) Handle

func (d *Deduper) Handle(ctx context.Context, job model.Job) error

Handle passes the job to the next handler if the job is not already scheduled. Otherwise, it returns model.ErrDuplicateJob.

func (*Deduper) OnAdd

func (d *Deduper) OnAdd(obj any, inInitialList bool)

OnAdd is called by k8s to inform us a resource is added.

func (*Deduper) OnDelete

func (d *Deduper) OnDelete(prev any)

OnDelete is called by k8s to inform us a resource is deleted.

func (*Deduper) OnUpdate

func (d *Deduper) OnUpdate(any, any)

OnUpdate is called by k8s to inform us a resource is updated.

func (*Deduper) RegisterInformer

func (d *Deduper) RegisterInformer(ctx context.Context, factory informers.SharedInformerFactory) error

RegisterInformer registers the limiter to listen for Kubernetes job events, and waits for cache sync.

Jump to

Keyboard shortcuts

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