window

package
v2.32.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2021 License: Apache-2.0, BSD-3-Clause, MIT Imports: 5 Imported by: 0

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 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

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

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
}

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

Jump to

Keyboard shortcuts

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