mirror of https://github.com/etcd-io/bbolt.git
gofmt
parent
da6d48abe9
commit
dcc5c661e2
4
lnode.go
4
lnode.go
|
@ -17,11 +17,11 @@ type lnode struct {
|
|||
// key returns a byte slice of the node key.
|
||||
func (n *lnode) key() []byte {
|
||||
buf := (*[maxAllocSize]byte)(unsafe.Pointer(n))
|
||||
return buf[n.pos:n.pos+n.ksize]
|
||||
return buf[n.pos : n.pos+n.ksize]
|
||||
}
|
||||
|
||||
// value returns a byte slice of the node value.
|
||||
func (n *lnode) value() []byte {
|
||||
buf := (*[maxAllocSize]byte)(unsafe.Pointer(n))
|
||||
return buf[n.pos+n.ksize:n.pos+n.ksize+n.vsize]
|
||||
return buf[n.pos+n.ksize : n.pos+n.ksize+n.vsize]
|
||||
}
|
||||
|
|
2
tpage.go
2
tpage.go
|
@ -6,7 +6,7 @@ import (
|
|||
"unsafe"
|
||||
)
|
||||
|
||||
// tpage represents a temporary, in-memory leaf page.
|
||||
// tpage represents a temporary in-memory leaf page.
|
||||
// It is deserialized from an memory-mapped page and is not restricted by page size.
|
||||
type tpage struct {
|
||||
nodes tnodes
|
||||
|
|
|
@ -29,7 +29,7 @@ func TestTpageRead(t *testing.T) {
|
|||
|
||||
// Insert 2 leaf nodes at the beginning. sizeof(lnode) == 16
|
||||
nodes := (*[3]lnode)(unsafe.Pointer(&page.ptr))
|
||||
nodes[0] = lnode{flags: 0, pos: 32, ksize: 3, vsize: 4} // pos = sizeof(lnode) * 2
|
||||
nodes[0] = lnode{flags: 0, pos: 32, ksize: 3, vsize: 4} // pos = sizeof(lnode) * 2
|
||||
nodes[1] = lnode{flags: 0, pos: 23, ksize: 10, vsize: 3} // pos = sizeof(lnode) + 3 + 4
|
||||
|
||||
// Write data for the nodes at the end.
|
||||
|
|
Loading…
Reference in New Issue