Show / Hide Table of Contents

Class SessionWindowCollection<T>

Transforms a collection into an enumerable collection of session windows and manages eviction of old items from the source collection. This wrapper can be used to manage the retention policy of the underlying collection. Objects added through this wrapper are inserted in chronologial order and evicted according to the policy provided to the constructor.

Inheritance
System.Object
SessionWindowCollection<T>
Implements
System.Collections.Generic.IEnumerable<ITimeWindow<T>>
System.Collections.IEnumerable
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Scaleout.Streaming.TimeWindowing
Assembly: Scaleout.Streaming.TimeWindowing.dll
Syntax
public class SessionWindowCollection<T> : IEnumerable<ITimeWindow<T>>, IEnumerable
Type Parameters
Name Description
T

The type of objects in the source collection.

Constructors

| Improve this Doc View Source

SessionWindowCollection(IList<T>, Func<T, DateTime>, TimeSpan, Int32)

Constructor

Declaration
public SessionWindowCollection(IList<T> source, Func<T, DateTime> timestampSelector, TimeSpan idleThreshold, int boundedSessionCapacity)
Parameters
Type Name Description
System.Collections.Generic.IList<T> source

The list of elements to wrap with the transformation.

System.Func<T, System.DateTime> timestampSelector

A function to extract a timestamp from an element.

System.TimeSpan idleThreshold

Maximum allowed time gap between elements before a new session window is started.

System.Int32 boundedSessionCapacity

Maximum number of sessions to retain. If a new element is added via the Add(T) method that creates a new session, elements in the oldest session will be evicted from the underlying collection.

| Improve this Doc View Source

SessionWindowCollection(LinkedList<T>, Func<T, DateTime>, TimeSpan, Int32)

Constructor

Declaration
public SessionWindowCollection(LinkedList<T> source, Func<T, DateTime> timestampSelector, TimeSpan idleThreshold, int boundedSessionCapacity)
Parameters
Type Name Description
System.Collections.Generic.LinkedList<T> source

The linked list of elements to wrap with the transformation.

System.Func<T, System.DateTime> timestampSelector

A function to extract a timestamp from an element.

System.TimeSpan idleThreshold

Maximum allowed time gap between elements before a new session window is started.

System.Int32 boundedSessionCapacity

Maximum number of sessions to retain. If a new element is added via the Add(T) method that creates a new session, elements in the oldest session will be evicted from the underlying collection.

Properties

| Improve this Doc View Source

Source

Gets a reference to the transformation's underlying collection.

Declaration
public IEnumerable<T> Source { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<T>

Methods

| Improve this Doc View Source

Add(T)

Adds an element to the underlying collection, inserting it in chronological order and evicting old sessions if needed.

Declaration
public void Add(T item)
Parameters
Type Name Description
T item

The element to add to the collection.

| Improve this Doc View Source

GetEnumerator()

Returns an enumerator that iterates through the collection of time windows.

Declaration
public IEnumerator<ITimeWindow<T>> GetEnumerator()
Returns
Type Description
System.Collections.Generic.IEnumerator<ITimeWindow<T>>

An enumerator that can be used to iterate through the collection of ITimeWindow<TElement> elements.

| Improve this Doc View Source

Refresh(Boolean)

Refreshes the transformation. For use when the underlying collection is modified directly instead of through this SessionWindowCollection<T> wrapper.

Declaration
public void Refresh(bool performEviction)
Parameters
Type Name Description
System.Boolean performEviction

Indicates that eviction should be re-run to remove elements from older session windows.

Explicit Interface Implementations

| Improve this Doc View Source

IEnumerable.GetEnumerator()

Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type Description
System.Collections.IEnumerator

Implements

System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable

Extension Methods

SessionWindowExtensions.ToSessionWindows<TSource>(IEnumerable<TSource>, Func<TSource, DateTime>, TimeSpan)
SlidingWindowExtensions.ToSlidingWindows<TSource>(IEnumerable<TSource>, Func<TSource, DateTime>, DateTime, DateTime, TimeSpan, TimeSpan)
TumblingWindowExtensions.ToTumblingWindows<TSource>(IEnumerable<TSource>, Func<TSource, DateTime>, DateTime, DateTime, TimeSpan)
  • Improve this Doc
  • View Source
Back to top Copyright © 2017-2018 ScaleOut Software, Inc.