MCPcopy Create free account
hub / github.com/editablejs/editable / writeStateVector

Function writeStateVector

packages/yjs-websocket/src/server/mongodb/utils.ts:106–118  ·  view source on GitHub ↗
(
  adapter: MongoAdapter,
  docName: string,
  sv: Uint8Array,
  clock: number,
)

Source from the content-addressed store, hash-verified

104 })
105
106export const writeStateVector = async (
107 adapter: MongoAdapter,
108 docName: string,
109 sv: Uint8Array,
110 clock: number,
111) => {
112 const encoder = encoding.createEncoder()
113 encoding.writeVarUint(encoder, clock)
114 encoding.writeVarUint8Array(encoder, sv)
115 await adapter.put(createDocumentStateVectorKey(docName), {
116 value: Buffer.from(encoding.toUint8Array(encoder)),
117 })
118}
119
120export const storeUpdate = async (
121 adapter: MongoAdapter,

Callers 2

storeUpdateFunction · 0.85
flushDocumentFunction · 0.85

Calls 2

putMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…