예제 #1
0
        /// <summary>
        /// Adjusts the lifetime of incoming events to implement, when used in combination with aggregates, repetitive hopping windows. In this implementation each
        /// incoming event results in an arbitrary number of outgoing events. For instance, if a single point event is received and the windowSize, period, and
        /// offset are 100, 2, and 0 respectively, 50 identical aggregate outputs are produced, each with a lifetime of 2 ticks.
        /// </summary>
        /// <typeparam name="TKey">Type of (mapping) key in the stream</typeparam>
        /// <typeparam name="TPayload">Type of payload in the stream</typeparam>
        /// <param name="source">Input stream</param>
        /// <param name="windowSize">Window size</param>
        /// <param name="period">Period (or hop size)</param>
        /// <param name="offset">Offset from the start of time</param>
        /// <returns>The result (output) stream</returns>
        public static IStreamable <TKey, TPayload> RepetitiveHoppingWindowLifetime <TKey, TPayload>(
            this IStreamable <TKey, TPayload> source, long windowSize, long period, long offset = 0)
        {
            Invariant.IsNotNull(source, nameof(source));

            return(source.HoppingWindowLifetime(windowSize, period, offset).Chop(offset, period));
        }
예제 #2
0
 /// <summary>
 /// Adjusts the lifetime of incoming events to implement, when used in combination with aggregates, tumbling windows. In this implementation each incoming
 /// event results in a single outgoing event, which means that subsequent aggregates only produce output when the input changes. For instance, if a single
 /// point event is received and the tumbleDuration and offset are 100 and 0 respectively, a single aggregate output is produced with a lifetime of
 /// 100 ticks.
 /// </summary>
 /// <typeparam name="TKey">Type of (mapping) key in the stream</typeparam>
 /// <typeparam name="TPayload">Type of payload in the stream</typeparam>
 /// <param name="source">Input stream</param>
 /// <param name="tumbleDuration">Duration of the tumble</param>
 /// <param name="offset">Offset from the start of time</param>
 /// <returns>Result (output) stream</returns>
 public static IStreamable <TKey, TPayload> TumblingWindowLifetime <TKey, TPayload>(
     this IStreamable <TKey, TPayload> source,
     long tumbleDuration,
     long offset = 0)
 {
     Invariant.IsNotNull(source, nameof(source));
     return(source.HoppingWindowLifetime(tumbleDuration, tumbleDuration, offset));
 }