Spaces:
Sleeping

teamta / src /interfaces /core /IAggregationCounterAPI.ts
lamsaoganh's picture
Upload 62 files
1305386 verified
Raw History Blame Contribute Delete
1.06 kB
import { IAggregationCounter } from './IAggregationCounter';
import { AggregationCounterRef } from './IMessage';
export interface IAggregationCounterAPI {
// Tạo counter mới
createCounter(params: {
requestId: string;
stepId: string;
targetMessageType: string;
expectedCount: number;
timeoutMs?: number;
parentResults?: any;
delayMs?: number;
targetMessageAggregationCounters?: AggregationCounterRef[];
}): Promise<IAggregationCounter>;
// Increment counter
incrementCounter(params: {
aggregationKey: string;
taskType: string;
result: any;
workerId?: string;
messageId?: string; // ID của message đã hoàn thành
}): Promise<{
counter: IAggregationCounter | null;
isComplete: boolean;
messageCreated?: boolean;
}>;
// Lấy counter theo key
getCounterByKey(aggregationKey: string): Promise<IAggregationCounter | null>;
// Lấy counters theo requestId
getCountersByRequestId(requestId: string): Promise<IAggregationCounter[]>;
}