MCPcopy
hub / github.com/deepflowio/deepflow / Use

Method Use

server/libs/utils/byte_buffer.go:32–41  ·  view source on GitHub ↗

返回下一个可用的[]byte,自动增长空间

(n int)

Source from the content-addressed store, hash-verified

30
31// 返回下一个可用的[]byte,自动增长空间
32func (b *ByteBuffer) Use(n int) []byte {
33 b.offset += n
34 if b.offset > b.quota {
35 panic("Quota limit exceeded!") // 对忘记调用Reset的保护
36 }
37 if b.offset > len(b.buf) {
38 b.buf = append(b.buf, make([]byte, (b.offset-len(b.buf))*2)...)
39 }
40 return b.buf[b.offset-n : b.offset]
41}
42
43// 返回所有Use调用过的[]byte
44func (b *ByteBuffer) Bytes() []byte {

Callers 9

TestByteBufferUseFunction · 0.95
TestByteBufferUseTwiceFunction · 0.95
TestByteBufferResetFunction · 0.95
NewServerFunction · 0.80
RegisterToMethod · 0.80
RegisterToMethod · 0.80
PrometheusRouterFunction · 0.80
StartFunction · 0.80
CloneByteBufferFunction · 0.80

Calls

no outgoing calls

Tested by 3

TestByteBufferUseFunction · 0.76
TestByteBufferUseTwiceFunction · 0.76
TestByteBufferResetFunction · 0.76