示例#1
0
        /// <summary>
        /// Exports a streamable as an observable of events. Produces events that are sync time ordered.
        /// Expects only start-edge and interval events in the stream, and constructs user-defined payloads as a result.
        /// </summary>
        /// <typeparam name="TKey"></typeparam>
        /// <typeparam name="TPayload"></typeparam>
        /// <typeparam name="TResult"></typeparam>
        /// <param name="stream"></param>
        /// <param name="constructor">Method description that constructs result data from the start time, end time, and the payload of each event.</param>
        /// <returns></returns>
        public static IObservable <ArraySegment <TResult> > ToTemporalArrayObservable <TKey, TPayload, TResult>(
            this IStreamable <PartitionKey <TKey>, TPayload> stream,
            Expression <Func <TKey, long, long, TPayload, TResult> > constructor)
        {
            Invariant.IsNotNull(stream, nameof(stream));

            return(stream.ToTemporalArrayObservable(
                       () => new TResult[Config.DataBatchSize],
                       constructor, null,
                       Guid.NewGuid().ToString()));
        }
示例#2
0
        /// <summary>
        /// Exports a streamable as an observable of events. Produces events that are sync time ordered.
        /// Expects only start-edge and interval events in the stream, and constructs user-defined payloads as a result.
        /// </summary>
        /// <typeparam name="TPayload"></typeparam>
        /// <typeparam name="TResult"></typeparam>
        /// <param name="stream"></param>
        /// <param name="generator">A function that returns an array that will be populated with stream results.</param>
        /// <param name="constructor">Method description that constructs result data from the start time, end time, and the payload of each event.</param>
        /// <returns></returns>
        public static IObservable <ArraySegment <TResult> > ToTemporalArrayObservable <TPayload, TResult>(
            this IStreamable <Empty, TPayload> stream,
            Func <TResult[]> generator,
            Expression <Func <long, long, TPayload, TResult> > constructor)
        {
            Invariant.IsNotNull(stream, nameof(stream));

            return(stream.ToTemporalArrayObservable(
                       generator,
                       constructor, null,
                       Guid.NewGuid().ToString()));
        }
示例#3
0
        /// <summary>
        /// Exports a streamable as an observable of events. Produces events that are sync time ordered.
        /// Expects only start-edge and interval events in the stream, and constructs user-defined payloads as a result.
        /// </summary>
        /// <typeparam name="TKey"></typeparam>
        /// <typeparam name="TPayload"></typeparam>
        /// <typeparam name="TResult"></typeparam>
        /// <param name="container">The query container to which an egress point is being added.</param>
        /// <param name="identifier">A string that can uniquely identify the point of egress in the query.</param>
        /// <param name="stream"></param>
        /// <param name="constructor">Method description that constructs result data from the start time, end time, and the payload of each event.</param>
        /// <returns></returns>
        public static IObservable <ArraySegment <TResult> > RegisterTemporalArrayOutput <TKey, TPayload, TResult>(
            this QueryContainer container,
            IStreamable <PartitionKey <TKey>, TPayload> stream,
            Expression <Func <TKey, long, long, TPayload, TResult> > constructor,
            string identifier = null)
        {
            Invariant.IsNotNull(stream, nameof(stream));

            return(stream.ToTemporalArrayObservable(
                       () => new TResult[Config.DataBatchSize],
                       constructor, container,
                       identifier ?? Guid.NewGuid().ToString()));
        }
示例#4
0
        /// <summary>
        /// Exports a streamable as an observable of events. Produces events that are sync time ordered.
        /// Expects only start-edge and interval events in the stream, and constructs user-defined payloads as a result.
        /// </summary>
        /// <typeparam name="TPayload"></typeparam>
        /// <typeparam name="TResult"></typeparam>
        /// <param name="container">The query container to which an egress point is being added.</param>
        /// <param name="identifier">A string that can uniquely identify the point of egress in the query.</param>
        /// <param name="stream"></param>
        /// <param name="generator">A function that returns an array that will be populated with stream results.</param>
        /// <param name="constructor">Method description that constructs result data from the start time, end time, and the payload of each event.</param>
        /// <returns></returns>
        public static IObservable <ArraySegment <TResult> > RegisterTemporalArrayOutput <TPayload, TResult>(
            this QueryContainer container,
            IStreamable <Empty, TPayload> stream,
            Func <TResult[]> generator,
            Expression <Func <long, long, TPayload, TResult> > constructor,
            string identifier = null)
        {
            Invariant.IsNotNull(stream, nameof(stream));

            return(stream.ToTemporalArrayObservable(
                       generator,
                       constructor, container,
                       identifier ?? Guid.NewGuid().ToString()));
        }