sliding

package
v1.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: Apache-2.0 Imports: 3 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) (window.AlignedKeyedWindower, bool)

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

func (*Sliding) NextWindowToBeClosed added in v0.9.0

func (s *Sliding) NextWindowToBeClosed() window.AlignedKeyedWindower

NextWindowToBeClosed returns the next window which is yet to be closed.

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