MCPcopy
hub / github.com/daptin/daptin / yjsWriteUvarint

Function yjsWriteUvarint

yjs_test.go:49–53  ·  view source on GitHub ↗

--- YJS/ydb binary protocol helpers --- ydb is a relay: it forwards binary messages between clients in the same room. It does NOT respond to SyncStep1 itself — only other connected clients do. Message format: [messageType(uvarint), sub-type-specific data...] For messageSync(0): [0, syncSubType(uvari

(buf *bytes.Buffer, n uint64)

Source from the content-addressed store, hash-verified

47// For messageSync(0): [0, syncSubType(uvarint), payload(uvarint-length-prefixed)]
48
49func yjsWriteUvarint(buf *bytes.Buffer, n uint64) {
50 bs := make([]byte, binary.MaxVarintLen64)
51 l := binary.PutUvarint(bs, n)
52 buf.Write(bs[:l])
53}
54
55func yjsWritePayload(buf *bytes.Buffer, data []byte) {
56 yjsWriteUvarint(buf, uint64(len(data)))

Callers 4

yjsWritePayloadFunction · 0.85
buildYjsSyncStep1Function · 0.85
buildYjsUpdateFunction · 0.85
buildYjsAwarenessFunction · 0.85

Calls 2

makeFunction · 0.85
WriteMethod · 0.45

Tested by

no test coverage detected