MCPcopy Create free account
hub / github.com/DNAProject/DNA / NextBytes

Method NextBytes

common/zero_copy_source.go:57–68  ·  view source on GitHub ↗

Read implements the io.ZeroCopySource interface.

(n uint64)

Source from the content-addressed store, hash-verified

55
56// Read implements the io.ZeroCopySource interface.
57func (self *ZeroCopySource) NextBytes(n uint64) (data []byte, eof bool) {
58 m := uint64(len(self.s))
59 end, overflow := SafeAdd(self.off, n)
60 if overflow || end > m {
61 end = m
62 eof = true
63 }
64 data = self.s[self.off:end]
65 self.off = end
66
67 return
68}
69
70func (self *ZeroCopySource) Skip(n uint64) (eof bool) {
71 m := uint64(len(self.s))

Callers 9

readMessageHeaderFunction · 0.95
BenchmarkZeroCopySourceFunction · 0.95
NextUint16Method · 0.95
NextUint32Method · 0.95
NextUint64Method · 0.95
NextVarBytesMethod · 0.95
NextAddressMethod · 0.95
NextI128Method · 0.95
NextHashMethod · 0.95

Calls 1

SafeAddFunction · 0.85

Tested by 1

BenchmarkZeroCopySourceFunction · 0.76