* Add the sections to the OP_MSG request's buffers and returns the length.
(buffers: Uint8Array[], document: Document)
| 586 | * Add the sections to the OP_MSG request's buffers and returns the length. |
| 587 | */ |
| 588 | makeSections(buffers: Uint8Array[], document: Document): number { |
| 589 | const sequencesBuffer = this.extractDocumentSequences(document); |
| 590 | const payloadTypeBuffer = ByteUtils.allocateUnsafe(1); |
| 591 | payloadTypeBuffer[0] = 0; |
| 592 | |
| 593 | const documentBuffer = this.serializeBson(document); |
| 594 | // First section, type 0 |
| 595 | buffers.push(payloadTypeBuffer); |
| 596 | buffers.push(documentBuffer); |
| 597 | // Subsequent sections, type 1 |
| 598 | buffers.push(sequencesBuffer); |
| 599 | |
| 600 | return payloadTypeBuffer.length + documentBuffer.length + sequencesBuffer.length; |
| 601 | } |
| 602 | |
| 603 | /** |
| 604 | * Extracts the document sequences from the command document and returns |
no test coverage detected