trigger

package
v2.39.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 License: Apache-2.0, BSD-3-Clause, MIT Imports: 2 Imported by: 28

Documentation

Overview

Package trigger helps construct aggregation triggers. It defines the trigger API for Go SDK. It is experimental and subject to change.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AfterAllTrigger

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

AfterAllTrigger fires after all subtriggers are fired. NYI(BEAM-3304). Intended for framework use only.

func (*AfterAllTrigger) SubTriggers

func (t *AfterAllTrigger) SubTriggers() []Trigger

SubTriggers returns the component triggers.

type AfterAnyTrigger

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

AfterAnyTrigger fires after any of sub-trigger fires. NYI(BEAM-3304). Intended for framework use only.

func (*AfterAnyTrigger) SubTriggers

func (t *AfterAnyTrigger) SubTriggers() []Trigger

SubTriggers returns the component triggers.

type AfterCountTrigger

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

AfterCountTrigger fires after receiving elementCount elements.

func AfterCount

func AfterCount(count int32) *AfterCountTrigger

AfterCount constructs a trigger that fires after at least `count` number of elements are processed.

func (*AfterCountTrigger) ElementCount

func (t *AfterCountTrigger) ElementCount() int32

ElementCount returns the elementCount.

type AfterEndOfWindowTrigger

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

AfterEndOfWindowTrigger provides option to set triggers for early and late firing.

func AfterEndOfWindow

func AfterEndOfWindow() *AfterEndOfWindowTrigger

AfterEndOfWindow constructs a trigger that is configurable for early firing (before the end of window) and late firing (after the end of window).

Must call EarlyFiring or LateFiring method on this trigger at the time of setting.

func (*AfterEndOfWindowTrigger) Early

func (t *AfterEndOfWindowTrigger) Early() Trigger

Early returns the Early Firing trigger for AfterEndOfWindowTrigger.

func (*AfterEndOfWindowTrigger) EarlyFiring

EarlyFiring configures an AfterEndOfWindow trigger with an implicitly repeated trigger that applies before the end of the window.

func (*AfterEndOfWindowTrigger) Late

func (t *AfterEndOfWindowTrigger) Late() Trigger

Late returns the Late Firing trigger for AfterEndOfWindowTrigger.

func (*AfterEndOfWindowTrigger) LateFiring

LateFiring configures an AfterEndOfWindow trigger with an implicitly repeated trigger that applies after the end of the window.

Not setting a late firing trigger means elements are discarded.

type AfterProcessingTimeTrigger

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

AfterProcessingTimeTrigger fires after passage of times defined in timestampTransforms.

func AfterProcessingTime

func AfterProcessingTime() *AfterProcessingTimeTrigger

AfterProcessingTime constructs a trigger that fires relative to when input first arrives.

Must be configured with calls to PlusDelay, or AlignedTo. May be configured with additional delay.

func (*AfterProcessingTimeTrigger) AlignedTo

AlignedTo configures an AfterProcessingTime trigger to fire at the smallest multiple of period since the offset greater than the first element timestamp.

* Period may not be smaller than a millisecond. * Offset may be a zero time (time.Time{}).

func (*AfterProcessingTimeTrigger) PlusDelay

PlusDelay configures an AfterProcessingTime trigger to fire after a specified delay, no smaller than a millisecond.

func (*AfterProcessingTimeTrigger) TimestampTransforms

func (t *AfterProcessingTimeTrigger) TimestampTransforms() []TimestampTransform

TimestampTransforms returns the timestampTransforms.

type AfterSynchronizedProcessingTimeTrigger

type AfterSynchronizedProcessingTimeTrigger struct{}

AfterSynchronizedProcessingTimeTrigger fires when processing time synchronises with arrival time. NYI(BEAM-3304). Intended for framework use only.

type AlignToTransform

type AlignToTransform struct {
	Period, Offset int64 // in milliseconds
}

AlignToTransform takes the timestamp and transforms it to the lowest multiple of the period starting from the offset.

Eg. A period of 20 with an offset of 45 would have alignments at 5,25,45,65 etc. Timestamps would be transformed as follows: 0 to 5 would be transformed to 5, 6 to 25 would be transformed to 25, 26 to 45 would be transformed to 45, and so on.

type AlwaysTrigger

type AlwaysTrigger struct{}

AlwaysTrigger fires immediately after receiving an element.

func Always

func Always() *AlwaysTrigger

Always constructs a trigger that fires immediately whenever an element is received.

Equivalent to trigger.Repeat(trigger.AfterCount(1))

type DefaultTrigger

type DefaultTrigger struct{}

DefaultTrigger fires once after the end of window. Late Data is discarded.

func Default

func Default() *DefaultTrigger

Default constructs a default trigger that fires once after the end of window. Late Data is discarded.

type DelayTransform

type DelayTransform struct {
	Delay int64 // in milliseconds
}

DelayTransform takes the timestamp and adds the given delay to it.

type NeverTrigger

type NeverTrigger struct{}

NeverTrigger is never ready to fire. NYI(BEAM-3304). Intended for framework use only.

type OrFinallyTrigger

type OrFinallyTrigger struct{}

OrFinallyTrigger serves as final condition to cause any trigger to fire. NYI(BEAM-3304). Intended for framework use only.

type RepeatTrigger

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

RepeatTrigger fires a sub-trigger repeatedly.

func Repeat

func Repeat(t Trigger) *RepeatTrigger

Repeat constructs a trigger that fires a trigger repeatedly once the condition has been met.

Ex: trigger.Repeat(trigger.AfterCount(1)) is same as trigger.Always().

func (*RepeatTrigger) SubTrigger

func (t *RepeatTrigger) SubTrigger() Trigger

SubTrigger returns the trigger to be repeated.

type TimestampTransform

type TimestampTransform interface {
	// contains filtered or unexported methods
}

TimestampTransform describes how an after processing time trigger time is transformed to determine when to fire an aggregation.const The base timestamp is always the when the first element of the pane is received.

A series of these transforms will be applied in order emit at regular intervals.

type Trigger

type Trigger interface {
	// contains filtered or unexported methods
}

Trigger describes when to emit new aggregations.

Jump to

Keyboard shortcuts

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