MCPcopy Create free account
hub / github.com/couchbase/moss / Write

Method Write

file.go:238–252  ·  view source on GitHub ↗
(p []byte)

Source from the content-addressed store, hash-verified

236func (b *bufferedSectionWriter) Written() int64 { return b.Offset() - b.beg }
237
238func (b *bufferedSectionWriter) Write(p []byte) (nn int, err error) {
239 if b.max > 0 && b.Written()+int64(len(p)) > b.max {
240 return 0, io.ErrShortBuffer // Would go over b.max.
241 }
242 for len(p) > 0 && b.err == nil {
243 n := copy(b.buf[b.n:], p)
244 b.n += n
245 nn += n
246 if n < len(p) {
247 b.err = b.Flush()
248 }
249 p = p[n:]
250 }
251 return nn, b.err
252}
253
254func (b *bufferedSectionWriter) Flush() error {
255 if b.err != nil {

Callers 4

MutateMethod · 0.80
Uint64SliceToByteSliceFunction · 0.80
TestMMapFunction · 0.80
persistFooterUnsyncedMethod · 0.80

Calls 2

WrittenMethod · 0.95
FlushMethod · 0.95

Tested by 1

TestMMapFunction · 0.64