MCPcopy
hub / github.com/dgraph-io/dgraph / CopyTo

Method CopyTo

x/x.go:854–866  ·  view source on GitHub ↗

CopyTo copies the contents of the buffer to the given byte slice. Caller should ensure that o is of appropriate length.

(o []byte)

Source from the content-addressed store, hash-verified

852// CopyTo copies the contents of the buffer to the given byte slice.
853// Caller should ensure that o is of appropriate length.
854func (b *BytesBuffer) CopyTo(o []byte) int {
855 offset := 0
856 for i, d := range b.data {
857 if i == len(b.data)-1 {
858 copy(o[offset:], d[:b.off])
859 offset += b.off
860 } else {
861 copy(o[offset:], d)
862 offset += len(d)
863 }
864 }
865 return offset
866}
867
868// TruncateBy reduces the size of the bugger by the given amount.
869// Always give back <= touched bytes.

Callers

nothing calls this directly

Calls 1

copyFunction · 0.85

Tested by

no test coverage detected