Spaces:
Sleeping
Sleeping
Download src/interfaces/core/IMessage.ts from lamsaoganh/teamta: direct link, hf CLI and curl.
- Browser
- Download file 1.63 kB
-
https://huggingface.co/spaces/lamsaoganh/teamta/resolve/main/src/interfaces/core/IMessage.ts
- Command line
-
hf download hf://spaces/lamsaoganh/teamta/src/interfaces/core/IMessage.ts
-
curl -L -o IMessage.ts https://huggingface.co/spaces/lamsaoganh/teamta/resolve/main/src/interfaces/core/IMessage.ts
1.63 kB
| import { IPayloadReference } from './IPayloadReference'; | |
| // Định nghĩa khi nào counter sẽ được update | |
| export type MessageUpdateTrigger = 'done' | 'failed' | 'processing' | 'cancel'; | |
| // Định nghĩa của một message trong queue | |
| export interface IMessage { | |
| messageId?: string | null; // ID của message record trong MongoDB | |
| messageType: string; | |
| payloadReference: IPayloadReference; | |
| status: 'pending' | 'reserved' | 'processing' | 'done' | 'failed' | 'cancel'; | |
| parentId?: string | null; // Changed from ObjectId to string | |
| requestId: string; // Trường để truy vết messages | |
| retry: number; | |
| maxRetry: number; | |
| retryPolicy: 'none' | 'linear' | 'exponential'; // Chiến lược retry | |
| timeoutMs: number; // Timeout tính bằng milliseconds | |
| createdAt: Date; | |
| updatedAt: Date; | |
| errorMessage?: string | null; | |
| availableAt: Date; | |
| expiredAt: Date | null; | |
| reservedBy?: string | null; | |
| reservedAt?: Date | null; | |
| // 🆕 AGGREGATION COUNTER TRACKING | |
| aggregationCounters?: AggregationCounterRef[]; // Danh sách counters cần cập nhật khi message complete | |
| } | |
| /** | |
| * Reference tới aggregation counter cần cập nhật khi message hoàn thành | |
| */ | |
| export interface AggregationCounterRef { | |
| aggregationKey: string; // Key của counter (requestId:stepId) | |
| taskType: string; // Loại task này đại diện (để ghi vào results) | |
| updateOnStatus?: MessageUpdateTrigger[]; // Khi nào thì update counter (default: ['done']) | |
| resultMapping?: string; // JSONPath để extract result từ message result | |
| } |