MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / Write

Method Write

cmd/test-streammanager/verifier.go:25–45  ·  view source on GitHub ↗
(p []byte)

Source from the content-addressed store, hash-verified

23}
24
25func (v *Verifier) Write(p []byte) (n int, err error) {
26 v.lock.Lock()
27 defer v.lock.Unlock()
28
29 expected := make([]byte, len(p))
30 // expectedGen.Read() error ignored: TestDataGenerator is deterministic and won't fail,
31 // and any data length mismatch will be caught by byte comparison below
32 v.expectedGen.Read(expected)
33
34 for i := 0; i < len(p); i++ {
35 if p[i] != expected[i] {
36 v.mismatches++
37 if v.firstMismatch == -1 {
38 v.firstMismatch = v.totalReceived + int64(i)
39 }
40 }
41 }
42
43 v.totalReceived += int64(len(p))
44 return len(p), nil
45}
46
47func (v *Verifier) TotalReceived() int64 {
48 v.lock.Lock()

Callers

nothing calls this directly

Calls 1

ReadMethod · 0.45

Tested by

no test coverage detected