pond-ts 0.14.2 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +242 -14
- package/dist/LiveFusedRolling.d.ts +55 -0
- package/dist/LiveFusedRolling.d.ts.map +1 -0
- package/dist/LiveFusedRolling.js +393 -0
- package/dist/LiveFusedRolling.js.map +1 -0
- package/dist/LivePartitionedFusedRolling.d.ts +65 -0
- package/dist/LivePartitionedFusedRolling.d.ts.map +1 -0
- package/dist/LivePartitionedFusedRolling.js +380 -0
- package/dist/LivePartitionedFusedRolling.js.map +1 -0
- package/dist/LivePartitionedSeries.d.ts +54 -3
- package/dist/LivePartitionedSeries.d.ts.map +1 -1
- package/dist/LivePartitionedSeries.js +63 -2
- package/dist/LivePartitionedSeries.js.map +1 -1
- package/dist/LiveSeries.d.ts +21 -0
- package/dist/LiveSeries.d.ts.map +1 -1
- package/dist/LiveSeries.js +10 -2
- package/dist/LiveSeries.js.map +1 -1
- package/dist/LiveView.d.ts +9 -0
- package/dist/LiveView.d.ts.map +1 -1
- package/dist/LiveView.js +6 -2
- package/dist/LiveView.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/reducers/samples.d.ts.map +1 -1
- package/dist/reducers/samples.js +25 -3
- package/dist/reducers/samples.js.map +1 -1
- package/dist/types-fused-rolling.d.ts +143 -0
- package/dist/types-fused-rolling.d.ts.map +1 -0
- package/dist/types-fused-rolling.js +2 -0
- package/dist/types-fused-rolling.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
import { normalizeAggregateColumns, } from './aggregate-columns.js';
|
|
2
|
+
import { Event } from './Event.js';
|
|
3
|
+
import { Time } from './Time.js';
|
|
4
|
+
import { rollingStateFor } from './reducers/index.js';
|
|
5
|
+
import { bucketIndexFor, boundaryTimestampFor, } from './triggers.js';
|
|
6
|
+
import { parseDuration } from './utils/duration.js';
|
|
7
|
+
/**
|
|
8
|
+
* Multi-window rolling that maintains N windows in one ingest pass
|
|
9
|
+
* over a single shared deque. Replaces the workaround of multiple
|
|
10
|
+
* separate `LiveRollingAggregation`s sharing the same source — the
|
|
11
|
+
* gRPC experiment's V6→V7 profile-diff (PR #19) showed every per-
|
|
12
|
+
* event pond hop roughly doubled when running two rollings.
|
|
13
|
+
*
|
|
14
|
+
* Each declared window has:
|
|
15
|
+
* - Its own resolved duration (clipped to retention; see PLAN.md)
|
|
16
|
+
* - Its own column-spec list and reducer states
|
|
17
|
+
* - Its own head cursor into the shared deque
|
|
18
|
+
*
|
|
19
|
+
* Output is ONE merged stream: one event per trigger boundary, with
|
|
20
|
+
* all windows' columns concatenated into one record. Duplicate
|
|
21
|
+
* output column names across windows are rejected at construction
|
|
22
|
+
* with a clear error (compile-time detection is queued as a
|
|
23
|
+
* follow-up).
|
|
24
|
+
*
|
|
25
|
+
* **Single trigger.** All windows share the configured trigger.
|
|
26
|
+
* Per-window cadence is explicitly NOT supported — that's what
|
|
27
|
+
* fusion saves. Users who need per-window cadence fall back to two
|
|
28
|
+
* separate `rolling()` calls and pay the V7 cost.
|
|
29
|
+
*
|
|
30
|
+
* **Time-based windows only.** Object keys are duration strings.
|
|
31
|
+
* Count-based windows stay on the existing single-window
|
|
32
|
+
* `LiveRollingAggregation`. This constraint keeps the
|
|
33
|
+
* window-clip-to-retention rule and boundary-detection logic clean.
|
|
34
|
+
*
|
|
35
|
+
* Public API: constructed via the `live.rolling(fusedMapping, opts)`
|
|
36
|
+
* keyed-form overload on `LiveSeries` / `LiveView`. User code
|
|
37
|
+
* doesn't import this class directly.
|
|
38
|
+
*/
|
|
39
|
+
export class LiveFusedRolling {
|
|
40
|
+
name;
|
|
41
|
+
schema;
|
|
42
|
+
/** Shared deque sized by the longest declared window. */
|
|
43
|
+
#entries;
|
|
44
|
+
/** Per-window state, in declared order. */
|
|
45
|
+
#windows;
|
|
46
|
+
/**
|
|
47
|
+
* Longest declared window in ms — bounds the shared deque. Equal
|
|
48
|
+
* to `max(windows[i].windowMs)`.
|
|
49
|
+
*/
|
|
50
|
+
#longestWindowMs;
|
|
51
|
+
/**
|
|
52
|
+
* Output column specs in declared order — flat union across all
|
|
53
|
+
* windows. Used to assemble emit records and the output schema.
|
|
54
|
+
*/
|
|
55
|
+
#emitColumns;
|
|
56
|
+
#trigger;
|
|
57
|
+
/**
|
|
58
|
+
* For clock triggers: the bucket index of the most recently
|
|
59
|
+
* crossed boundary. Undefined until the first event is ingested.
|
|
60
|
+
*/
|
|
61
|
+
#lastClockBucketIdx;
|
|
62
|
+
/**
|
|
63
|
+
* For count triggers: the number of events ingested since the
|
|
64
|
+
* most recent emission.
|
|
65
|
+
*/
|
|
66
|
+
#countSinceLastEmit;
|
|
67
|
+
#nextIndex;
|
|
68
|
+
#outputEvents;
|
|
69
|
+
#onEvent;
|
|
70
|
+
#unsubscribe;
|
|
71
|
+
constructor(source, fusedMapping, options = {}) {
|
|
72
|
+
this.name = source.name;
|
|
73
|
+
const topMinSamples = options.minSamples ?? 0;
|
|
74
|
+
if (!Number.isInteger(topMinSamples) || topMinSamples < 0) {
|
|
75
|
+
throw new TypeError('rolling minSamples must be a non-negative integer (default 0)');
|
|
76
|
+
}
|
|
77
|
+
this.#trigger = options.trigger ?? { kind: 'event' };
|
|
78
|
+
this.#lastClockBucketIdx = undefined;
|
|
79
|
+
this.#countSinceLastEmit = 0;
|
|
80
|
+
this.#nextIndex = 0;
|
|
81
|
+
this.#entries = [];
|
|
82
|
+
this.#outputEvents = [];
|
|
83
|
+
this.#onEvent = new Set();
|
|
84
|
+
// Resolve each window: parse the duration key, normalize the
|
|
85
|
+
// mapping (handles bare AggregateMap, AggregateOutputMap, and the
|
|
86
|
+
// elaborated `{ mapping, minSamples }` wrapper), build per-column
|
|
87
|
+
// reducer state.
|
|
88
|
+
const windowKeys = Object.keys(fusedMapping);
|
|
89
|
+
if (windowKeys.length === 0) {
|
|
90
|
+
throw new TypeError('fused rolling: at least one window must be declared');
|
|
91
|
+
}
|
|
92
|
+
const windows = [];
|
|
93
|
+
let longestMs = 0;
|
|
94
|
+
for (const key of windowKeys) {
|
|
95
|
+
const value = fusedMapping[key];
|
|
96
|
+
const { innerMapping, perWindowMinSamples } = unwrapFusedMappingValue(value);
|
|
97
|
+
const windowMs = resolveWindowKey(key);
|
|
98
|
+
if (windowMs > longestMs)
|
|
99
|
+
longestMs = windowMs;
|
|
100
|
+
// Reuse the same column-normalisation helper used by the
|
|
101
|
+
// single-window rolling — keeps reducer-state behavior
|
|
102
|
+
// identical to today's-shape `LiveRollingAggregation`.
|
|
103
|
+
const columns = normalizeAggregateColumns(source.schema, innerMapping);
|
|
104
|
+
const states = columns.map((c) => rollingStateFor(c.reducer));
|
|
105
|
+
windows.push({
|
|
106
|
+
id: key,
|
|
107
|
+
windowMs,
|
|
108
|
+
columns,
|
|
109
|
+
states,
|
|
110
|
+
minSamples: perWindowMinSamples ?? topMinSamples,
|
|
111
|
+
head: 0,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
this.#windows = windows;
|
|
115
|
+
this.#longestWindowMs = longestMs;
|
|
116
|
+
// Build the merged output schema. Reject duplicate output column
|
|
117
|
+
// names across windows. (Compile-time detection is a follow-up;
|
|
118
|
+
// runtime check keeps shipping unblocked.)
|
|
119
|
+
const seenOutputs = new Set();
|
|
120
|
+
const emitColumns = [];
|
|
121
|
+
for (const win of this.#windows) {
|
|
122
|
+
for (const col of win.columns) {
|
|
123
|
+
if (seenOutputs.has(col.output)) {
|
|
124
|
+
throw new TypeError(`fused rolling: duplicate output column '${col.output}' across windows. ` +
|
|
125
|
+
`Each output column name must be unique across the merged schema. ` +
|
|
126
|
+
`Either rename the alias (use AggregateOutputMap with a distinct \`from\` ` +
|
|
127
|
+
`→ alias mapping) or drop one of the duplicating windows.`);
|
|
128
|
+
}
|
|
129
|
+
seenOutputs.add(col.output);
|
|
130
|
+
emitColumns.push(col);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
this.#emitColumns = emitColumns;
|
|
134
|
+
this.schema = Object.freeze([
|
|
135
|
+
source.schema[0],
|
|
136
|
+
...emitColumns.map((c) => ({
|
|
137
|
+
name: c.output,
|
|
138
|
+
kind: c.kind,
|
|
139
|
+
required: false,
|
|
140
|
+
})),
|
|
141
|
+
]);
|
|
142
|
+
// Replay the source's existing events through the same ingest
|
|
143
|
+
// path, so a fused rolling created on a non-empty source matches
|
|
144
|
+
// the streaming-from-construction shape.
|
|
145
|
+
for (let i = 0; i < source.length; i++) {
|
|
146
|
+
this.#ingest(source.at(i));
|
|
147
|
+
}
|
|
148
|
+
this.#unsubscribe = source.on('event', (event) => {
|
|
149
|
+
this.#ingest(event);
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
// ── LiveSource<Out> contract ────────────────────────────────
|
|
153
|
+
get length() {
|
|
154
|
+
return this.#outputEvents.length;
|
|
155
|
+
}
|
|
156
|
+
at(index) {
|
|
157
|
+
if (index < 0)
|
|
158
|
+
index = this.#outputEvents.length + index;
|
|
159
|
+
return this.#outputEvents[index];
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Read the current merged snapshot — every window's reducer
|
|
163
|
+
* outputs concatenated into one record. Useful for live-display
|
|
164
|
+
* patterns where the consumer wants the latest values without
|
|
165
|
+
* waiting for the next trigger fire.
|
|
166
|
+
*/
|
|
167
|
+
value() {
|
|
168
|
+
const result = {};
|
|
169
|
+
for (const win of this.#windows) {
|
|
170
|
+
const warmup = this.#windowSize(win) < win.minSamples;
|
|
171
|
+
for (let i = 0; i < win.columns.length; i++) {
|
|
172
|
+
result[win.columns[i].output] = warmup
|
|
173
|
+
? undefined
|
|
174
|
+
: win.states[i].snapshot();
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return result;
|
|
178
|
+
}
|
|
179
|
+
on(type, fn) {
|
|
180
|
+
if (type !== 'event') {
|
|
181
|
+
throw new TypeError(`LiveFusedRolling.on: unsupported event type '${String(type)}'`);
|
|
182
|
+
}
|
|
183
|
+
this.#onEvent.add(fn);
|
|
184
|
+
return () => {
|
|
185
|
+
this.#onEvent.delete(fn);
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
dispose() {
|
|
189
|
+
this.#unsubscribe();
|
|
190
|
+
}
|
|
191
|
+
// ── Private ─────────────────────────────────────────────────
|
|
192
|
+
/**
|
|
193
|
+
* Number of events currently in window `w`'s reducer state.
|
|
194
|
+
* Equals `entries.length - (w.head - frontAbsIdx)` where
|
|
195
|
+
* `frontAbsIdx = entries[0].absIdx`. Used for minSamples gating.
|
|
196
|
+
*/
|
|
197
|
+
#windowSize(w) {
|
|
198
|
+
if (this.#entries.length === 0)
|
|
199
|
+
return 0;
|
|
200
|
+
const frontAbsIdx = this.#entries[0].absIdx;
|
|
201
|
+
return this.#entries.length - (w.head - frontAbsIdx);
|
|
202
|
+
}
|
|
203
|
+
#ingest(event) {
|
|
204
|
+
const data = event.data();
|
|
205
|
+
const absIdx = this.#nextIndex++;
|
|
206
|
+
const ts = event.begin();
|
|
207
|
+
const entry = { absIdx, timestamp: ts, data };
|
|
208
|
+
this.#entries.push(entry);
|
|
209
|
+
// Per-window: advance head while leading entries are out-of-window,
|
|
210
|
+
// then add the new event to every column's reducer state.
|
|
211
|
+
for (const win of this.#windows) {
|
|
212
|
+
const cutoff = ts - win.windowMs;
|
|
213
|
+
while (win.head < absIdx &&
|
|
214
|
+
this.#getEntry(win.head).timestamp < cutoff) {
|
|
215
|
+
const old = this.#getEntry(win.head);
|
|
216
|
+
for (let i = 0; i < win.columns.length; i++) {
|
|
217
|
+
win.states[i].remove(old.absIdx, old.data[win.columns[i].source]);
|
|
218
|
+
}
|
|
219
|
+
win.head++;
|
|
220
|
+
}
|
|
221
|
+
for (let i = 0; i < win.columns.length; i++) {
|
|
222
|
+
win.states[i].add(absIdx, data[win.columns[i].source]);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
// Compact the shared deque: drop entries before the leftmost
|
|
226
|
+
// window head. The longest window's head IS this leftmost head
|
|
227
|
+
// in steady state.
|
|
228
|
+
this.#compactFront();
|
|
229
|
+
// Emission gated by the configured trigger.
|
|
230
|
+
switch (this.#trigger.kind) {
|
|
231
|
+
case 'event':
|
|
232
|
+
this.#emitEvent(event.key());
|
|
233
|
+
return;
|
|
234
|
+
case 'clock':
|
|
235
|
+
this.#emitClock(ts, this.#trigger);
|
|
236
|
+
return;
|
|
237
|
+
case 'count':
|
|
238
|
+
this.#emitCount(event.key(), this.#trigger.n);
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Translate an absolute event index to its current position in
|
|
244
|
+
* the shared deque. Returns `undefined` if the entry has been
|
|
245
|
+
* compacted out of the front.
|
|
246
|
+
*/
|
|
247
|
+
#getEntry(absIdx) {
|
|
248
|
+
if (this.#entries.length === 0)
|
|
249
|
+
return undefined;
|
|
250
|
+
const front = this.#entries[0].absIdx;
|
|
251
|
+
const offset = absIdx - front;
|
|
252
|
+
if (offset < 0 || offset >= this.#entries.length)
|
|
253
|
+
return undefined;
|
|
254
|
+
return this.#entries[offset];
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Drop entries from the front of the shared deque whose absIdx
|
|
258
|
+
* is less than every window's head. The longest window's head
|
|
259
|
+
* defines the leftmost-still-live cursor.
|
|
260
|
+
*
|
|
261
|
+
* Uses `Array.shift()` for now (matches today's
|
|
262
|
+
* `LiveRollingAggregation`); the head-index-pointer ring-buffer
|
|
263
|
+
* optimization is queued as a separate tactical fix in PLAN.md.
|
|
264
|
+
*/
|
|
265
|
+
#compactFront() {
|
|
266
|
+
if (this.#entries.length === 0)
|
|
267
|
+
return;
|
|
268
|
+
let minHead = this.#windows[0].head;
|
|
269
|
+
for (let i = 1; i < this.#windows.length; i++) {
|
|
270
|
+
const h = this.#windows[i].head;
|
|
271
|
+
if (h < minHead)
|
|
272
|
+
minHead = h;
|
|
273
|
+
}
|
|
274
|
+
while (this.#entries.length > 0 && this.#entries[0].absIdx < minHead) {
|
|
275
|
+
this.#entries.shift();
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
#emitCount(key, n) {
|
|
279
|
+
this.#countSinceLastEmit++;
|
|
280
|
+
if (this.#countSinceLastEmit < n)
|
|
281
|
+
return;
|
|
282
|
+
this.#countSinceLastEmit = 0;
|
|
283
|
+
this.#emitEvent(key);
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Build one merged event with every window's reducer snapshot
|
|
287
|
+
* concatenated into one record, then push to outputs and notify
|
|
288
|
+
* listeners.
|
|
289
|
+
*/
|
|
290
|
+
#emitEvent(key) {
|
|
291
|
+
const record = {};
|
|
292
|
+
for (const win of this.#windows) {
|
|
293
|
+
const warmup = this.#windowSize(win) < win.minSamples;
|
|
294
|
+
for (let i = 0; i < win.columns.length; i++) {
|
|
295
|
+
record[win.columns[i].output] = warmup
|
|
296
|
+
? undefined
|
|
297
|
+
: win.states[i].snapshot();
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
const outputEvent = new Event(key, record);
|
|
301
|
+
this.#outputEvents.push(outputEvent);
|
|
302
|
+
for (const fn of this.#onEvent)
|
|
303
|
+
fn(outputEvent);
|
|
304
|
+
}
|
|
305
|
+
#emitClock(eventTs, trigger) {
|
|
306
|
+
const bucketIdx = bucketIndexFor(trigger, eventTs);
|
|
307
|
+
if (this.#lastClockBucketIdx === undefined) {
|
|
308
|
+
this.#lastClockBucketIdx = bucketIdx;
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
if (bucketIdx > this.#lastClockBucketIdx) {
|
|
312
|
+
const boundaryMs = boundaryTimestampFor(trigger, bucketIdx);
|
|
313
|
+
this.#emitEvent(new Time(boundaryMs));
|
|
314
|
+
this.#lastClockBucketIdx = bucketIdx;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
// ── Helpers (module-private) ──────────────────────────────────
|
|
319
|
+
/**
|
|
320
|
+
* Resolve a fused-mapping window key (duration string or `'buffer'`
|
|
321
|
+
* sentinel) to a duration in ms. The `'buffer'` sentinel is reserved
|
|
322
|
+
* for future use by `live.reduce()` and not yet implemented; throws
|
|
323
|
+
* a clear error for now.
|
|
324
|
+
*/
|
|
325
|
+
function resolveWindowKey(key) {
|
|
326
|
+
if (key === 'buffer') {
|
|
327
|
+
throw new TypeError(`fused rolling: 'buffer' sentinel key is reserved for live.reduce(); ` +
|
|
328
|
+
`not yet implemented. Use an explicit duration string ` +
|
|
329
|
+
`(e.g. '1m', '200ms') for now.`);
|
|
330
|
+
}
|
|
331
|
+
// parseDuration's input type is `number | DurationString` — at runtime it
|
|
332
|
+
// throws on bad input. Cast to satisfy the type and let parseDuration
|
|
333
|
+
// surface a clear error if the key isn't a valid duration string. Wrap
|
|
334
|
+
// the throw to point at the fused-rolling context.
|
|
335
|
+
try {
|
|
336
|
+
return parseDuration(key);
|
|
337
|
+
}
|
|
338
|
+
catch {
|
|
339
|
+
throw new TypeError(`fused rolling: invalid window key '${key}'. Keys must be duration ` +
|
|
340
|
+
`strings (e.g. '1m', '200ms', '5s'). Count-based windows stay on ` +
|
|
341
|
+
`the existing single-window overload.`);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Peel off the elaborated wrapper if present, returning the inner
|
|
346
|
+
* mapping and the per-window minSamples (if specified).
|
|
347
|
+
*/
|
|
348
|
+
/**
|
|
349
|
+
* True when `v` looks like an `AggregateOutputSpec` — i.e., a bare
|
|
350
|
+
* `{ from: string, using: ... }` shape. Used to disambiguate the
|
|
351
|
+
* elaborated-wrapper detection: a user with an `AggregateOutputMap`
|
|
352
|
+
* entry literally named `'mapping'` (e.g. `{ '1m': { mapping: { from:
|
|
353
|
+
* 'cpu', using: 'avg' } } }`) must NOT be unwrapped as the wrapper.
|
|
354
|
+
*
|
|
355
|
+
* The wrapper's `mapping` field carries a whole record of column
|
|
356
|
+
* specs; the colliding-name AggregateOutputMap entry's `mapping` key
|
|
357
|
+
* carries one spec. This check distinguishes the two by looking for
|
|
358
|
+
* the `from` + `using` discriminators that only exist on a spec.
|
|
359
|
+
*/
|
|
360
|
+
function isAggregateOutputSpec(v) {
|
|
361
|
+
return (v !== null &&
|
|
362
|
+
typeof v === 'object' &&
|
|
363
|
+
typeof v.from === 'string' &&
|
|
364
|
+
'using' in v);
|
|
365
|
+
}
|
|
366
|
+
function unwrapFusedMappingValue(value) {
|
|
367
|
+
if (value !== null &&
|
|
368
|
+
typeof value === 'object' &&
|
|
369
|
+
'mapping' in value &&
|
|
370
|
+
typeof value.mapping === 'object' &&
|
|
371
|
+
// Disambiguation: if `.mapping` is itself an AggregateOutputSpec,
|
|
372
|
+
// the user named an alias `mapping` in an AggregateOutputMap —
|
|
373
|
+
// this is NOT the elaborated wrapper. Fall through to the bare
|
|
374
|
+
// mapping branch.
|
|
375
|
+
!isAggregateOutputSpec(value.mapping)) {
|
|
376
|
+
const elaborated = value;
|
|
377
|
+
if (elaborated.minSamples !== undefined) {
|
|
378
|
+
if (!Number.isInteger(elaborated.minSamples) ||
|
|
379
|
+
elaborated.minSamples < 0) {
|
|
380
|
+
throw new TypeError('fused rolling: per-window minSamples must be a non-negative integer');
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
return {
|
|
384
|
+
innerMapping: elaborated.mapping,
|
|
385
|
+
perWindowMinSamples: elaborated.minSamples,
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
return {
|
|
389
|
+
innerMapping: value,
|
|
390
|
+
perWindowMinSamples: undefined,
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
//# sourceMappingURL=LiveFusedRolling.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LiveFusedRolling.js","sourceRoot":"","sources":["../src/LiveFusedRolling.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,y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UAAU,GAAG,CAAC,EACzB,CAAC;gBACD,MAAM,IAAI,SAAS,CACjB,qEAAqE,CACtE,CAAC;YACJ,CAAC;QACH,CAAC;QACD,OAAO;YACL,YAAY,EAAE,UAAU,CAAC,OAAO;YAChC,mBAAmB,EAAE,UAAU,CAAC,UAAU;SAC3C,CAAC;IACJ,CAAC;IACD,OAAO;QACL,YAAY,EAAE,KAAgD;QAC9D,mBAAmB,EAAE,SAAS;KAC/B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type ClockTrigger } from './triggers.js';
|
|
2
|
+
import type { EventForSchema, LiveSource, SeriesSchema } from './types.js';
|
|
3
|
+
import type { FusedMapping } from './types-fused-rolling.js';
|
|
4
|
+
type EventListener = (event: any) => void;
|
|
5
|
+
/**
|
|
6
|
+
* Synchronised partitioned fused multi-window rolling. Maintains N
|
|
7
|
+
* windows per partition in one ingest pass over a single shared
|
|
8
|
+
* deque per partition. Driven by a clock trigger; emits a
|
|
9
|
+
* synchronised burst of one merged event per partition per boundary
|
|
10
|
+
* crossing.
|
|
11
|
+
*
|
|
12
|
+
* **Why fused matters here.** The gRPC experiment's V6→V7 profile-
|
|
13
|
+
* diff (PR #19) showed that running two separate
|
|
14
|
+
* `LivePartitionedSyncRolling` instances doubled every per-event
|
|
15
|
+
* pond hop in inclusive time (`#routeEvent` 15→29%, `ingest`
|
|
16
|
+
* 12→25%). A single fused rolling does the per-event work once.
|
|
17
|
+
*
|
|
18
|
+
* Output schema is `[time, <byColumn>, ...mergedColumns]` — same
|
|
19
|
+
* partition-column auto-injection as the existing single-window
|
|
20
|
+
* partitioned sync rolling. Duplicate output column names across
|
|
21
|
+
* windows are rejected at construction.
|
|
22
|
+
*
|
|
23
|
+
* **Single trigger, clock only.** Per-window cadence is not
|
|
24
|
+
* supported; cross-partition boundary detection requires a single
|
|
25
|
+
* trigger anyway. Event/count triggers don't make sense for synced
|
|
26
|
+
* cross-partition emission and are not accepted.
|
|
27
|
+
*
|
|
28
|
+
* Public API: constructed via the `partitionBy('host').rolling(
|
|
29
|
+
* fusedMapping, { trigger })` keyed-form overload on
|
|
30
|
+
* `LivePartitionedSeries`. User code doesn't import this class
|
|
31
|
+
* directly.
|
|
32
|
+
*/
|
|
33
|
+
export declare class LivePartitionedFusedRolling<S extends SeriesSchema, K extends string, Out extends SeriesSchema> implements LiveSource<Out> {
|
|
34
|
+
#private;
|
|
35
|
+
readonly name: string;
|
|
36
|
+
readonly schema: Out;
|
|
37
|
+
/**
|
|
38
|
+
* @internal — constructed by `LivePartitionedSeries.rolling`'s
|
|
39
|
+
* keyed-form clock-trigger overload.
|
|
40
|
+
*/
|
|
41
|
+
constructor(upstreamName: string, byColumn: string, byColumnKind: string, reducerInputSchema: SeriesSchema, fusedMapping: FusedMapping<SeriesSchema>, trigger: ClockTrigger, options?: {
|
|
42
|
+
minSamples?: number;
|
|
43
|
+
declaredGroups?: ReadonlyArray<K>;
|
|
44
|
+
});
|
|
45
|
+
get length(): number;
|
|
46
|
+
at(index: number): EventForSchema<Out> | undefined;
|
|
47
|
+
on(type: 'event', fn: EventListener): () => void;
|
|
48
|
+
dispose(): void;
|
|
49
|
+
/**
|
|
50
|
+
* @internal — used by `LivePartitionedSeries.rolling` to register
|
|
51
|
+
* each per-partition `'event'` listener disposer so this fused
|
|
52
|
+
* rolling can detach them on `dispose()`.
|
|
53
|
+
*/
|
|
54
|
+
_registerUnsubscribe(unsub: () => void): void;
|
|
55
|
+
/**
|
|
56
|
+
* Called by `LivePartitionedSeries` for each event arriving on a
|
|
57
|
+
* partition's `LiveSource`. Updates that partition's per-window
|
|
58
|
+
* state in one pass, then if the bucket index advances, emits a
|
|
59
|
+
* synchronised burst of one merged event per known partition at
|
|
60
|
+
* the new boundary timestamp.
|
|
61
|
+
*/
|
|
62
|
+
ingest(partitionKey: K, event: EventForSchema<S>): void;
|
|
63
|
+
}
|
|
64
|
+
export {};
|
|
65
|
+
//# sourceMappingURL=LivePartitionedFusedRolling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