2023-08-11 00:32:41 +08:00
|
|
|
import { SysCallMapping } from "../system.ts";
|
2023-08-28 23:12:15 +08:00
|
|
|
import { MessageQueue } from "../lib/mq.ts";
|
2023-08-11 00:32:41 +08:00
|
|
|
|
|
|
|
export function mqSyscalls(
|
2023-08-28 23:12:15 +08:00
|
|
|
mq: MessageQueue,
|
2023-08-11 00:32:41 +08:00
|
|
|
): SysCallMapping {
|
|
|
|
return {
|
2024-01-15 23:43:12 +08:00
|
|
|
"mq.send": (_ctx, queue: string, body: any) => {
|
|
|
|
return mq.send(queue, body);
|
2023-08-11 00:32:41 +08:00
|
|
|
},
|
2024-01-15 23:43:12 +08:00
|
|
|
"mq.batchSend": (_ctx, queue: string, bodies: any[]) => {
|
|
|
|
return mq.batchSend(queue, bodies);
|
2023-08-11 00:32:41 +08:00
|
|
|
},
|
2024-01-15 23:43:12 +08:00
|
|
|
"mq.ack": (_ctx, queue: string, id: string) => {
|
|
|
|
return mq.ack(queue, id);
|
2023-08-11 00:32:41 +08:00
|
|
|
},
|
2024-01-15 23:43:12 +08:00
|
|
|
"mq.batchAck": (_ctx, queue: string, ids: string[]) => {
|
|
|
|
return mq.batchAck(queue, ids);
|
2023-08-11 00:32:41 +08:00
|
|
|
},
|
2024-01-15 23:43:12 +08:00
|
|
|
"mq.getQueueStats": (_ctx, queue: string) => {
|
|
|
|
return mq.getQueueStats(queue);
|
2023-08-12 02:37:13 +08:00
|
|
|
},
|
2023-08-11 00:32:41 +08:00
|
|
|
};
|
|
|
|
}
|