|
|
|
@ -48,7 +48,8 @@ class AggDataMap { |
|
|
|
|
|
|
|
constructor( |
|
|
|
private subsTw: SubscriptionTimewindow, |
|
|
|
private endTs: number |
|
|
|
private endTs: number, |
|
|
|
private aggType: AggregationType |
|
|
|
){}; |
|
|
|
|
|
|
|
set(ts: number, data: AggData) { |
|
|
|
@ -78,7 +79,7 @@ class AggDataMap { |
|
|
|
} |
|
|
|
|
|
|
|
calculateAggInterval(timestamp: number): [number, number] { |
|
|
|
return calculateAggIntervalWithSubscriptionTimeWindow(this.subsTw, this.endTs, timestamp); |
|
|
|
return calculateAggIntervalWithSubscriptionTimeWindow(this.subsTw, this.endTs, timestamp, this.aggType); |
|
|
|
} |
|
|
|
|
|
|
|
updateLastInterval(endTs: number) { |
|
|
|
@ -87,7 +88,7 @@ class AggDataMap { |
|
|
|
const lastTs = this.map.maxKey(); |
|
|
|
if (lastTs) { |
|
|
|
const data = this.map.get(lastTs); |
|
|
|
const interval = calculateAggIntervalWithSubscriptionTimeWindow(this.subsTw, endTs, data.ts); |
|
|
|
const interval = calculateAggIntervalWithSubscriptionTimeWindow(this.subsTw, endTs, data.ts, this.aggType); |
|
|
|
data.interval = interval; |
|
|
|
data.ts = interval[0] + Math.floor((interval[1] - interval[0]) / 2); |
|
|
|
} |
|
|
|
@ -415,7 +416,7 @@ export class DataAggregator { |
|
|
|
const noAggregation = aggType === AggregationType.NONE; |
|
|
|
let aggKeyData = aggregationMap.aggMap[id]; |
|
|
|
if (!aggKeyData) { |
|
|
|
aggKeyData = new AggDataMap(this.subsTw, this.endTs); |
|
|
|
aggKeyData = new AggDataMap(this.subsTw, this.endTs, aggType); |
|
|
|
aggregationMap.aggMap[id] = aggKeyData; |
|
|
|
} |
|
|
|
const keyData = data[id]; |
|
|
|
@ -449,7 +450,7 @@ export class DataAggregator { |
|
|
|
const noAggregation = aggType === AggregationType.NONE; |
|
|
|
let aggKeyData = this.aggregationMap.aggMap[id]; |
|
|
|
if (!aggKeyData) { |
|
|
|
aggKeyData = new AggDataMap(this.subsTw, this.endTs); |
|
|
|
aggKeyData = new AggDataMap(this.subsTw, this.endTs, aggType); |
|
|
|
this.aggregationMap.aggMap[id] = aggKeyData; |
|
|
|
} |
|
|
|
const keyData = data[id]; |
|
|
|
|