forked from microsoft/FluidFramework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pendingMessageReader.ts
33 lines (30 loc) · 1.01 KB
/
pendingMessageReader.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*!
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
* Licensed under the MIT License.
*/
import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
import { IDeltaService } from "@fluidframework/server-services-core";
import { getLumberBaseProperties, Lumberjack } from "@fluidframework/server-services-telemetry";
import { IPendingMessageReader } from "./interfaces";
export class PendingMessageReader implements IPendingMessageReader {
constructor(
private readonly tenantId: string,
private readonly documentId: string,
protected readonly deltaService: IDeltaService,
) {}
public async readMessages(from: number, to: number): Promise<ISequencedDocumentMessage[]> {
Lumberjack.info(
`Fetching pending messages from ${from} to ${to}`,
getLumberBaseProperties(this.documentId, this.tenantId),
);
const deltasP = this.deltaService.getDeltas(
"",
this.tenantId,
this.documentId,
from - 1,
to + 1,
"scribe",
);
return deltasP;
}
}