window

package
v2.40.0-RC1 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2022 License: Apache-2.0, BSD-3-Clause, MIT Imports: 6 Imported by: 53

Documentation

Overview

Package window contains window representation, windowing strategies and utilities.

Index

Constants

This section is empty.

Variables

View Source
var (
	// SingleGlobalWindow is a slice of a single global window. Convenience value.
	SingleGlobalWindow = []typex.Window{GlobalWindow{}}
)

Functions

func IsEqualList

func IsEqualList(from, to []typex.Window) bool

IsEqualList returns true iff the lists of windows are equal. Note that ordering matters and that this is not set equality.

Types

type AccumulationMode

type AccumulationMode string
const (
	Unspecified  AccumulationMode = "AccumulationMode_UNSPECIFIED"
	Discarding   AccumulationMode = "AccumulationMode_DISCARDING"
	Accumulating AccumulationMode = "AccumulationMode_ACCUMULATING"
	Retracting   AccumulationMode = "AccumulationMode_RETRACTING"
)

type Fn

type Fn struct {
	Kind Kind

	Size   time.Duration // FixedWindows, SlidingWindows
	Period time.Duration // SlidingWindows
	Gap    time.Duration // Sessions
}

Fn defines the window fn.

func NewFixedWindows

func NewFixedWindows(interval time.Duration) *Fn

NewFixedWindows returns the fixed WindowFn with the given interval.

func NewGlobalWindows

func NewGlobalWindows() *Fn

NewGlobalWindows returns the default WindowFn, which places all elements into a single window.

func NewSessions

func NewSessions(gap time.Duration) *Fn

NewSessions returns the session WindowFn with the given gap.

func NewSlidingWindows

func NewSlidingWindows(period, duration time.Duration) *Fn

NewSlidingWindows returns the sliding WindowFn with the given period and duration.

func (*Fn) Coder

func (w *Fn) Coder() *coder.WindowCoder

Coder returns the WindowCoder for the WindowFn.

func (*Fn) Equals

func (w *Fn) Equals(o *Fn) bool

Equals returns true iff the windows have the same kind and underlying behavior. Built-in window types (such as global window) are only equal to the same instances of the window. A user-defined window that happens to match a built-in will not match on Equals().

func (*Fn) String

func (w *Fn) String() string

type GlobalWindow

type GlobalWindow struct{}

GlobalWindow represents the singleton, global window.

func (GlobalWindow) Equals

func (GlobalWindow) Equals(o typex.Window) bool

Equals returns a boolean indicating if the window is equal to a given window. This is true for global windows if the provided window is also a global window.

func (GlobalWindow) MaxTimestamp

func (GlobalWindow) MaxTimestamp() typex.EventTime

MaxTimestamp returns the maximum timestamp in the window.

func (GlobalWindow) String

func (GlobalWindow) String() string

type IntervalWindow

type IntervalWindow struct {
	Start, End typex.EventTime
}

IntervalWindow represents a half-open bounded window [start,end).

func (IntervalWindow) Equals

func (w IntervalWindow) Equals(o typex.Window) bool

Equals returns a boolean indicating if the window is equal to a given window. This is true for interval windows if the provided window is an interval window and they share the start and end timestamps.

func (IntervalWindow) MaxTimestamp

func (w IntervalWindow) MaxTimestamp() typex.EventTime

MaxTimestamp returns the maximum timestamp in the window.

func (IntervalWindow) String

func (w IntervalWindow) String() string

type Kind

type Kind string

Kind is the semantic type of a window fn.

const (
	GlobalWindows  Kind = "GLO"
	FixedWindows   Kind = "FIX"
	SlidingWindows Kind = "SLI"
	Sessions       Kind = "SES"
)

type WindowingStrategy

type WindowingStrategy struct {
	Fn               *Fn
	Trigger          trigger.Trigger
	AccumulationMode AccumulationMode
	AllowedLateness  int // in milliseconds
}

WindowingStrategy defines the types of windowing used in a pipeline and contains the data to support executing a windowing strategy.

func DefaultWindowingStrategy

func DefaultWindowingStrategy() *WindowingStrategy

DefaultWindowingStrategy returns the default windowing strategy.

func (*WindowingStrategy) Equals

func (ws *WindowingStrategy) Equals(o *WindowingStrategy) bool

func (*WindowingStrategy) String

func (ws *WindowingStrategy) String() string

Directories

Path Synopsis
Package trigger helps construct aggregation triggers.
Package trigger helps construct aggregation triggers.

Jump to

Keyboard shortcuts

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