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 ¶
- type Sliding
- func (s *Sliding) AssignWindow(eventTime time.Time) []window.AlignedKeyedWindower
- func (s *Sliding) InsertIfNotPresent(kw window.AlignedKeyedWindower) (window.AlignedKeyedWindower, bool)
- func (s *Sliding) NextWindowToBeClosed() window.AlignedKeyedWindower
- func (s *Sliding) RemoveWindows(wm time.Time) []window.AlignedKeyedWindower
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 ¶
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