Example #1
0
        internal static IIngressStreamable <Empty, TPayload> ToCheckpointableStreamable <TPayload>(
            this IObservable <TPayload> streamEvents,
            FlushPolicy flushPolicy,
            PeriodicPunctuationPolicy periodicPunctuationPolicy,
            OnCompletedPolicy completedPolicy,
            TimelinePolicy timelinePolicy,
            QueryContainer container,
            string identifier)
        {
            Contract.EnsuresOnThrow <IngressException>(true);

            if (periodicPunctuationPolicy == null)
            {
                periodicPunctuationPolicy = PeriodicPunctuationPolicy.None();
            }

            return(new MonotonicIngressStreamable <TPayload>(
                       streamEvents,
                       flushPolicy,
                       periodicPunctuationPolicy,
                       completedPolicy,
                       timelinePolicy ?? TimelinePolicy.WallClock(),
                       container,
                       identifier));
        }
Example #2
0
 public MonotonicSubscriptionWallClock(
     IObservable <TPayload> observable,
     string identifier,
     Streamable <Empty, TPayload> streamable,
     IStreamObserver <Empty, TPayload> observer,
     FlushPolicy flushPolicy,
     PeriodicPunctuationPolicy punctuationPolicy,
     OnCompletedPolicy onCompletedPolicy,
     TimelinePolicy timelinePolicy)
     : base(
         observable,
         identifier,
         streamable,
         observer,
         DisorderPolicy.Adjust(),
         flushPolicy,
         punctuationPolicy,
         onCompletedPolicy,
         null)
 {
     if (timelinePolicy.punctuationInterval > default(TimeSpan))
     {
         this.timer = new Timer(EmitPunctuation, null, new TimeSpan(0), timelinePolicy.punctuationInterval);
     }
 }
Example #3
0
        public MonotonicIngressStreamable(
            IObservable <TPayload> observable,
            FlushPolicy flushPolicy,
            PeriodicPunctuationPolicy punctuationPolicy,
            OnCompletedPolicy completedPolicy,
            TimelinePolicy timelinePolicy,
            QueryContainer container,
            string identifier)
            : base((Config.ForceRowBasedExecution || !typeof(TPayload).CanRepresentAsColumnar()
                ? StreamProperties <Empty, TPayload> .Default.ToRowBased()
                : StreamProperties <Empty, TPayload> .Default).ToConstantDuration(true, StreamEvent.InfinitySyncTime).SetQueryContainer(container))
        {
            Contract.Requires(observable != null);
            Contract.Requires(identifier != null);

            this.IngressSiteIdentifier = identifier;
            this.observable            = observable;
            this.flushPolicy           = flushPolicy;
            this.punctuationPolicy     = punctuationPolicy;
            this.onCompletedPolicy     = completedPolicy;
            this.timelinePolicy        = timelinePolicy;
            this.container             = container;
            this.delayed = container != null;

            if (this.delayed)
            {
                container.RegisterIngressSite(identifier);
            }
        }
Example #4
0
 /// <summary>
 /// Registers a data source to be used as input with the query container.
 /// </summary>
 /// <typeparam name="TPayload">The type of the payload of the data source.</typeparam>
 /// <param name="data">A sequence of data elements created by the client.</param>
 /// <param name="timelinePolicy">Describes how to simulate a progression of time with the data.</param>
 /// <param name="onCompletedPolicy">How to handle the completion of a stream.</param>
 /// <returns>An IStreamable that can be used in queries.</returns>
 public static IIngressStreamable <Empty, TPayload> ToAtemporalArrayStreamable <TPayload>(
     this IObservable <ArraySegment <TPayload> > data,
     TimelinePolicy timelinePolicy       = null,
     OnCompletedPolicy onCompletedPolicy = OnCompletedPolicy.None)
 {
     return(data.ToCheckpointableStreamable(
                onCompletedPolicy,
                timelinePolicy,
                null,
                Guid.NewGuid().ToString()));
 }
Example #5
0
 /// <summary>
 /// Registers a data source to be used as input with the query container.
 /// </summary>
 /// <typeparam name="TPayload">The type of the payload of the data source.</typeparam>
 /// <param name="data">A sequence of data elements created by the client.</param>
 /// <param name="timelinePolicy">Describes how to simulate a progression of time with the data.</param>
 /// <param name="onCompletedPolicy">How to handle the completion of a stream.</param>
 /// <param name="container">A query containter to which this ingress point can be attached.</param>
 /// <param name="identifier">If provided, a unique name to identify to point of ingress in the query.</param>
 /// <returns>An IStreamable that can be used in queries.</returns>
 public static IIngressStreamable <Empty, TPayload> RegisterAtemporalArrayInput <TPayload>(
     this QueryContainer container,
     IObservable <ArraySegment <TPayload> > data,
     TimelinePolicy timelinePolicy       = null,
     OnCompletedPolicy onCompletedPolicy = OnCompletedPolicy.None,
     string identifier = null)
 {
     return(data.ToCheckpointableStreamable(
                onCompletedPolicy,
                timelinePolicy,
                container,
                identifier ?? Guid.NewGuid().ToString()));
 }
Example #6
0
 /// <summary>
 /// Registers a data source to be used as input with the query container.
 /// </summary>
 /// <typeparam name="TPayload">The type of the payload of the data source.</typeparam>
 /// <param name="data">A sequence of data elements created by the client.</param>
 /// <param name="timelinePolicy">Describes how to simulate a progression of time with the data.</param>
 /// <param name="flushPolicy">When to flush batched output events.</param>
 /// <param name="periodicPunctuationPolicy">Whether to add periodic punctuations to the resulting stream.</param>
 /// <param name="onCompletedPolicy">How to handle the completion of a stream.</param>
 /// <returns>An IStreamable that can be used in queries.</returns>
 public static IIngressStreamable <Empty, TPayload> ToAtemporalStreamable <TPayload>(
     this IObservable <TPayload> data,
     TimelinePolicy timelinePolicy = null,
     FlushPolicy flushPolicy       = FlushPolicy.FlushOnPunctuation,
     PeriodicPunctuationPolicy periodicPunctuationPolicy = null,
     OnCompletedPolicy onCompletedPolicy = OnCompletedPolicy.EndOfStream)
 {
     return(data.ToCheckpointableStreamable(
                flushPolicy,
                periodicPunctuationPolicy,
                onCompletedPolicy,
                timelinePolicy,
                null,
                Guid.NewGuid().ToString()));
 }
Example #7
0
 /// <summary>
 /// Registers a data source to be used as input with the query container.
 /// </summary>
 /// <typeparam name="TPayload">The type of the payload of the data source.</typeparam>
 /// <param name="data">A sequence of data elements created by the client.</param>
 /// <param name="timelinePolicy">Describes how to simulate a progression of time with the data.</param>
 /// <param name="flushPolicy">When to flush batched output events.</param>
 /// <param name="periodicPunctuationPolicy">Whether to add periodic punctuations to the resulting stream.</param>
 /// <param name="onCompletedPolicy">How to handle the completion of a stream.</param>
 /// <param name="container">A query containter to which this ingress point can be attached.</param>
 /// <param name="identifier">If provided, a unique name to identify to point of ingress in the query.</param>
 /// <returns>An IStreamable that can be used in queries.</returns>
 public static IIngressStreamable <Empty, TPayload> RegisterAtemporalInput <TPayload>(
     this QueryContainer container,
     IObservable <TPayload> data,
     TimelinePolicy timelinePolicy = null,
     FlushPolicy flushPolicy       = FlushPolicy.FlushOnPunctuation,
     PeriodicPunctuationPolicy periodicPunctuationPolicy = null,
     OnCompletedPolicy onCompletedPolicy = OnCompletedPolicy.EndOfStream,
     string identifier = null)
 {
     return(data.ToCheckpointableStreamable(
                flushPolicy,
                periodicPunctuationPolicy,
                onCompletedPolicy,
                timelinePolicy,
                container,
                identifier ?? Guid.NewGuid().ToString()));
 }
 public MonotonicArraySubscriptionSequence(
     IObservable <ArraySegment <TPayload> > observable,
     string identifier,
     Streamable <Empty, TPayload> streamable,
     IStreamObserver <Empty, TPayload> observer,
     OnCompletedPolicy onCompletedPolicy,
     TimelinePolicy timelinePolicy)
     : base(
         observable,
         identifier,
         streamable,
         observer,
         DisorderPolicy.Throw(),
         FlushPolicy.FlushOnPunctuation,
         PeriodicPunctuationPolicy.None(),
         onCompletedPolicy,
         null)
     => this.eventsPerSample = timelinePolicy.sampleSize;
Example #9
0
        internal static IIngressStreamable <Empty, TPayload> ToCheckpointableStreamable <TPayload>(
            this IObservable <ArraySegment <TPayload> > streamEvents,
            OnCompletedPolicy completedPolicy,
            TimelinePolicy timelinePolicy,
            QueryContainer container,
            string identifier)
        {
            Contract.EnsuresOnThrow <IngressException>(true);

            // For the moment, there is no way to support array-based ingress with a timeline policy and a punctuation policy
            if (timelinePolicy.timelineEnum == TimelineEnum.WallClock && timelinePolicy.punctuationInterval == default(TimeSpan))
            {
                throw new NotSupportedException("There is currently no support for array-based ingress based on clock time with punctuations.  For the moment, either switch to a sequence-based policy or remove the punctuation period parameter.");
            }
            return(new MonotonicArrayIngressStreamable <TPayload>(
                       streamEvents,
                       completedPolicy,
                       timelinePolicy ?? TimelinePolicy.WallClock(),
                       container,
                       identifier));
        }
Example #10
0
 public MonotonicSubscriptionSequence(
     IObservable <TPayload> observable,
     string identifier,
     Streamable <Empty, TPayload> streamable,
     IStreamObserver <Empty, TPayload> observer,
     FlushPolicy flushPolicy,
     PeriodicPunctuationPolicy punctuationPolicy,
     OnCompletedPolicy onCompletedPolicy,
     TimelinePolicy timelinePolicy)
     : base(
         observable,
         identifier,
         streamable,
         observer,
         DisorderPolicy.Adjust(),
         flushPolicy,
         punctuationPolicy,
         onCompletedPolicy,
         null)
 {
     this.eventsPerSample = timelinePolicy.sampleSize;
     this.currentTime     = 0;
 }