timers

package
v2.55.1 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: Apache-2.0, BSD-3-Clause, MIT Imports: 3 Imported by: 0

Documentation

Overview

Package timers contains structs for setting pipeline timers.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ProviderType represents the type of timer provider.
	ProviderType = reflect.TypeOf((*Provider)(nil)).Elem()
)

Functions

func WithOutputTimestamp

func WithOutputTimestamp(outputTimestamp time.Time) timerOptions

WithOutputTimestamp sets the output timestamp for the timer.

func WithTag

func WithTag(tag string) timerOptions

WithTag sets the tag for the timer.

Types

type Context added in v2.49.0

type Context struct {
	Family string
	Tag    string
}

Context is a parameter for OnTimer methods to receive the fired Timer.

type EventTime

type EventTime struct {
	Family string
}

EventTime represents the event time timer.

func InEventTime

func InEventTime(family string) EventTime

InEventTime creates and returns a new EventTime timer object.

func (EventTime) Clear

func (et EventTime) Clear(p Provider)

Clear clears this timer.

func (EventTime) ClearTag added in v2.49.0

func (et EventTime) ClearTag(p Provider, tag string)

ClearTag clears this timer for the given tag.

func (EventTime) Set

func (et EventTime) Set(p Provider, FiringTimestamp time.Time, opts ...timerOptions)

Set sets the timer for a event-time timestamp. Calling this method repeatedly for the same key will cause it overwrite previously set timer.

func (EventTime) Timers

func (et EventTime) Timers() map[string]TimeDomain

Timers returns mapping of timer family ID and its time domain.

type PipelineTimer

type PipelineTimer interface {
	Timers() map[string]TimeDomain
}

PipelineTimer interface represents valid timer type.

type ProcessingTime

type ProcessingTime struct {
	Family string
}

ProcessingTime represents the processing time timer.

func InProcessingTime

func InProcessingTime(family string) ProcessingTime

InProcessingTime creates and returns a new ProcessingTime timer object.

func (ProcessingTime) Clear

func (pt ProcessingTime) Clear(p Provider)

Clear clears this timer.

func (ProcessingTime) ClearTag added in v2.49.0

func (pt ProcessingTime) ClearTag(p Provider, tag string)

ClearTag clears this timer for the given tag.

func (ProcessingTime) Set

func (pt ProcessingTime) Set(p Provider, FiringTimestamp time.Time, opts ...timerOptions)

Set sets the timer for processing time domain. Calling this method repeatedly for the same key will cause it overwrite previously set timer.

func (ProcessingTime) Timers

func (pt ProcessingTime) Timers() map[string]TimeDomain

Timers returns mapping of timer family ID and its time domain.

type Provider

type Provider interface {
	Set(t TimerMap)
}

Provider represents a timer provider interface.

The methods are not intended for end user use, and is subject to change.

type TimeDomain

type TimeDomain int32

TimeDomain represents different time domains to set timer.

const (
	// UnspecifiedTimeDomain represents unspecified time domain.
	UnspecifiedTimeDomain TimeDomain = 0
	// EventTimeDomain is time from the perspective of the data
	EventTimeDomain TimeDomain = 1
	// ProcessingTimeDomain is time from the perspective of the
	// execution of your pipeline
	ProcessingTimeDomain TimeDomain = 2
)

type TimerMap

type TimerMap struct {
	Family                       string
	Tag                          string
	Clear                        bool
	FireTimestamp, HoldTimestamp mtime.Time
}

TimerMap holds timer information obtained from the pipeline.

For SDK internal use, and subject to change.

Jump to

Keyboard shortcuts

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