Class TumblingWindowCollection<T>
Transforms a collection into an enumerable collection of fixed-time 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 startTime
policy provided to the constructor.
Inheritance
Inherited Members
Namespace: Scaleout.Streaming.TimeWindowing
Assembly: Scaleout.Streaming.TimeWindowing.dll
Syntax
public class TumblingWindowCollection<T> : IEnumerable<ITimeWindow<T>>, IEnumerable
Type Parameters
Name | Description |
---|---|
T | The type of objects in the source collection. |
Constructors
| Improve this Doc View SourceTumblingWindowCollection(IList<T>, Func<T, DateTime>, TimeSpan, DateTime)
Constructor.
Declaration
public TumblingWindowCollection(IList<T> source, Func<T, DateTime> timestampSelector, TimeSpan windowDuration, DateTime startTime)
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 | windowDuration | Duration of each time window. This is a maximum value that may be shortened for the last window in the returned sequence. |
System.DateTime | startTime | Start time (inclusive) of the first window. Items in the underlying collection that fall before this start time will be evicted. |
TumblingWindowCollection(LinkedList<T>, Func<T, DateTime>, TimeSpan, DateTime)
Constructor.
Declaration
public TumblingWindowCollection(LinkedList<T> source, Func<T, DateTime> timestampSelector, TimeSpan windowDuration, DateTime startTime)
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 | windowDuration | Duration of each time window. This is a maximum value that will be shortened for the last window in the returned sequence. |
System.DateTime | startTime | Start time (inclusive) of the first window. Items in the underlying collection that fall before this start time will be evicted. |
Methods
| Improve this Doc View SourceAdd(T)
Adds an element to the underlying collection, inserting it into the underlying source collection
in chronological order. If the timestamp associated with the new element falls before the
startTime
provided to this transformation's constructor then the new element will be
evicted immediately.
Declaration
public void Add(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The element to add to the collection. |
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. |
Explicit Interface Implementations
| Improve this Doc View SourceIEnumerable.GetEnumerator()
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator |