sliding

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package sliding implements Sliding windows. Sliding windows are defined by a static window size e.g. minutely windows or hourly windows and a fixed "slide". This is the duration by which the boundaries of the windows move once every <slide> duration. Package sliding also maintains the state of active windows. Watermark is used to trigger the expiration of windows.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Sliding

type Sliding struct {
	// Length is the duration of the window
	Length time.Duration
	// offset between successive windows.
	// successive windows are phased out by this duration.
	Slide time.Duration
	// contains filtered or unexported fields
}

Sliding implements sliding windows

func NewSliding

func NewSliding(length time.Duration, slide time.Duration) *Sliding

NewSliding returns a Sliding windower

func (*Sliding) AssignWindow

func (s *Sliding) AssignWindow(eventTime time.Time) []window.AlignedKeyedWindower

AssignWindow returns a set of windows that contain the element based on event time

func (*Sliding) InsertIfNotPresent

func (s *Sliding) InsertIfNotPresent(kw window.AlignedKeyedWindower) (aw window.AlignedKeyedWindower, isPresent bool)

InsertIfNotPresent inserts a window to the list of active windows if not present and returns the window

func (*Sliding) RemoveWindows

func (s *Sliding) RemoveWindows(wm time.Time) []window.AlignedKeyedWindower

Jump to

Keyboard shortcuts

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