MCPcopy
hub / github.com/etcd-io/bbolt / write

Method write

bucket.go:836–850  ·  view source on GitHub ↗

write allocates and writes a bucket to a byte slice.

()

Source from the content-addressed store, hash-verified

834
835// write allocates and writes a bucket to a byte slice.
836func (b *Bucket) write() []byte {
837 // Allocate the appropriate size.
838 var n = b.rootNode
839 var value = make([]byte, common.BucketHeaderSize+n.size())
840
841 // Write a bucket header.
842 var bucket = (*common.InBucket)(unsafe.Pointer(&value[0]))
843 *bucket = *b.InBucket
844
845 // Convert byte slice to a fake page and write the root node.
846 var p = (*common.Page)(unsafe.Pointer(&value[common.BucketHeaderSize]))
847 n.write(p)
848
849 return value
850}
851
852// rebalance attempts to balance all nodes.
853func (b *Bucket) rebalance() {

Callers 3

CreateBucketMethod · 0.45
spillMethod · 0.45

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected