* @description reads the data of opBuffer and clears the opBuffer, * Considering the delay of the network layer, the front end cannot receive the ack in time, * here will save a copy of the opsBuffer data in the storage * @param {number} revision * @returns * @memberof Engine
(revision: number)
| 181 | * @memberof Engine |
| 182 | */ |
| 183 | deOpBuffer(revision: number) { |
| 184 | const ops = this.opBuffer; |
| 185 | // reset opBuffer |
| 186 | this.opBuffer = []; |
| 187 | |
| 188 | // set localChangeset |
| 189 | if (!ops.length) { |
| 190 | this.localPendingChangeset = undefined; |
| 191 | return; |
| 192 | } |
| 193 | this.localPendingChangeset = BufferStorage.ops2Changeset(ops, revision, this.resourceId, this.resourceType); |
| 194 | } |
| 195 | |
| 196 | static ops2Changeset(ops: IOperation[], revision: number, resourceId: string, resourceType: ResourceType): ILocalChangeset { |
| 197 | const messageId = generateRandomString(); |
no test coverage detected