Skip to main content

LivePartitionedView

classpond-tssource

Chained typed view over a LivePartitionedSeries. Returned by every sugar method on the root partitioned series and on this view, composing the operator factory at each step.

The view is lazy: factories aren't run until a terminal (collect(), apply(), toMap()) is called. Each terminal delegates back to the root's per-partition state, applying the composed factory chain to each partition's LiveSeries.

Lifecycle. All real state lives on the root LivePartitionedSeries — chained views are just deferred factories that point back at the root. They don't register their own subscriptions on the source. Disposing the root disposes everything: terminals subscribed to factory outputs are tracked on the root's internal disposers, including outputs created by view.toMap().

Properties

schemaRreadonly

Schema of the chained output. Captured by running the factory once on a stub LiveSeries<SBase> at construction.

Methods

apply

apply(factory: (sub: LiveSource<R>) => LiveSource<R2>, options?: Partial<LiveSeriesOptions<R2>>): LiveSeries<R2>

Apply a further per-partition transform on top of the existing factory chain. Equivalent to chaining one more sugar method via a custom function. Returns a unified LiveSeries<R2>.

collect

collect(options?: Partial<LiveSeriesOptions<R>>): LiveSeries<R>

Same as LivePartitionedSeries.collect, applied through the factory chain.

cumulative

cumulative(spec: { [P in string]: 'sum' | 'min' | 'max' | 'count' | (acc: number, value: number) => number }): LivePartitionedView<SBase, readonly [R[0], ReplaceSmoothedColumn<ValueColumnsForSchema<R>, Targets>], K, ByCol>

diff

diff(columns: Target | readonly Target[], options?: { drop?: boolean }): LivePartitionedView<SBase, readonly [R[0], ReplaceSmoothedColumn<ValueColumnsForSchema<R>, Target>], K, ByCol>

fill

fill(strategy: LiveFillStrategy | LiveFillMapping<R>, options?: { limit?: number }): LivePartitionedView<SBase, R, K, ByCol>

pctChange

pctChange(columns: Target | readonly Target[], options?: { drop?: boolean }): LivePartitionedView<SBase, readonly [R[0], ReplaceSmoothedColumn<ValueColumnsForSchema<R>, Target>], K, ByCol>

rate

rate(columns: Target | readonly Target[], options?: { drop?: boolean }): LivePartitionedView<SBase, readonly [R[0], ReplaceSmoothedColumn<ValueColumnsForSchema<R>, Target>], K, ByCol>

rolling

rolling(window: RollingWindow, mapping: M, options?: LiveRollingOptions & { trigger?: { kind: 'event' | 'count' } }): LivePartitionedView<SBase, readonly [R[0], AggregateColumns<ValueColumnsForSchema<R>, M>], K, ByCol>

Partition column drops by default. rolling's output schema only retains columns named in mapping. Include the partition column with a passthrough reducer (e.g. host: 'last') to keep it visible in the unified output.

rolling(window: RollingWindow, mapping: M, options: LiveRollingOptions & { trigger: { kind: 'clock' } & Trigger }): LivePartitionedSyncRolling<R, K, SeriesSchema>

Partition column drops by default. rolling's output schema only retains columns named in mapping. Include the partition column with a passthrough reducer (e.g. host: 'last') to keep it visible in the unified output.

rolling(window: RollingWindow, mapping: M, options: LiveRollingOptions): LivePartitionedSyncRolling<R, K, SeriesSchema> | LivePartitionedView<SBase, readonly [R[0], AggregateColumns<ValueColumnsForSchema<R>, M>], K, ByCol>

Partition column drops by default. rolling's output schema only retains columns named in mapping. Include the partition column with a passthrough reducer (e.g. host: 'last') to keep it visible in the unified output.

rolling(fusedMapping: FM & FusedMappingValid<FM>, options: LiveRollingOptions & { trigger: { kind: 'clock' } & Trigger }): LivePartitionedFusedRolling<R, K, readonly [ColumnDef<'time', 'time'>, ColumnDef<ByCol, FromColumnKind<R, ByCol> & string> & { required: false }, FusedRollingColumns<R, FM>]>

Keyed-form fused multi-window rolling on a chained LivePartitionedView. Same shape as the root variant — each partition's chain output flows into one fused rolling that maintains N windows in one ingest pass and emits one merged event per partition per boundary.

Clock trigger required (same constraint as the root partitioned fused — synced cross-partition emission).

sample

sample(strategy: SampleStrategy): LivePartitionedView<SBase, R, K, ByCol>

Per-partition stream sampling on a chained view. Same semantics as LivePartitionedSeries.sample — stride only, safe by construction (no multi-entity bias); each partition's chain output is thinned independently with its own counter.

toMap

toMap(): Map<K, LiveSource<R>>

Materialize the chained view per-partition as a Map<K, LiveSource<R>>. Runs the composed factory once per existing partition; auto-spawn from the root partitioned series is not propagated into this map (the snapshot reflects partitions at the time of the call).

Each factory output (a LiveView / LiveRollingAggregation / etc.) holds an internal subscription to its source. To avoid accumulating listeners across repeated calls, every factory output's dispose() is registered on the root's disposer set — calling partitioned.dispose() on the root cleans up every toMap-created subscription chain.

For a live-updating per-partition view, subscribe to the root partitionBy directly with toMap() and call the factory yourself, or use collect() for a unified buffer.