MCPcopy Create free account
hub / github.com/cloudwego/netpoll / isSingleNode

Method isSingleNode

nocopy_linkbuffer.go:814–824  ·  view source on GitHub ↗

isSingleNode determines whether reading needs to cross nodes. isSingleNode will move b.read to latest non-empty node if there is a zero-size node Must require b.Len() > 0

(readN int)

Source from the content-addressed store, hash-verified

812// isSingleNode will move b.read to latest non-empty node if there is a zero-size node
813// Must require b.Len() > 0
814func (b *UnsafeLinkBuffer) isSingleNode(readN int) (single bool) {
815 if readN <= 0 {
816 return true
817 }
818 l := b.read.Len()
819 for l == 0 && b.read != b.flush {
820 b.read = b.read.next
821 l = b.read.Len()
822 }
823 return l >= readN
824}
825
826// memorySize return the real memory size in bytes the LinkBuffer occupied
827func (b *LinkBuffer) memorySize() (bytes int) {

Callers 5

NextMethod · 0.95
PeekMethod · 0.95
readBinaryMethod · 0.95
SliceMethod · 0.95

Calls 1

LenMethod · 0.65

Tested by 1