MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / ByteSliceGet

Function ByteSliceGet

IceFireDB-SQLProxy/utils/byte_slice_pool.go:14–28  ·  view source on GitHub ↗
(length int)

Source from the content-addressed store, hash-verified

12)
13
14func ByteSliceGet(length int) (data []byte) {
15 select {
16 case data = <-byteSliceChan:
17 default:
18 data = byteSlicePool.Get().([]byte)[:0]
19 }
20
21 if cap(data) < length {
22 data = make([]byte, length)
23 } else {
24 data = data[:length]
25 }
26
27 return data
28}
29
30func ByteSlicePut(data []byte) {
31 select {

Callers 3

writeCommandBufMethod · 0.92
readResultMethod · 0.92
readResultStreamingMethod · 0.92

Calls 1

GetMethod · 0.45

Tested by

no test coverage detected