MCPcopy
hub / github.com/yjs/yjs / writeStateVector

Function writeStateVector

src/utils/encoding.js:580–587  ·  view source on GitHub ↗
(encoder, sv)

Source from the content-addressed store, hash-verified

578 * @function
579 */
580export const writeStateVector = (encoder, sv) => {
581 encoding.writeVarUint(encoder.restEncoder, sv.size)
582 array.from(sv.entries()).sort((a, b) => b[0] - a[0]).forEach(([client, clock]) => {
583 encoding.writeVarUint(encoder.restEncoder, client) // @todo use a special client decoder that is based on mapping
584 encoding.writeVarUint(encoder.restEncoder, clock)
585 })
586 return encoder
587}
588
589/**
590 * @param {IdSetEncoderV1 | IdSetEncoderV2} encoder

Callers 3

encodeSnapshotV2Function · 0.90
writeDocumentStateVectorFunction · 0.85
encodeStateVectorV2Function · 0.85

Calls 2

fromMethod · 0.80
forEachMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…