diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2014-01-27 10:11:54 -0500 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2014-01-27 10:11:54 -0500 |
commit | 192649f453af1f1fa79f41f1cfeed296ec51b545 (patch) | |
tree | 1195cb6ca23a6c8a576a8c24d10295ddc1515df6 /lnodes.go | |
parent | Initialize transaction/rwtransaction. (diff) | |
download | dedo-192649f453af1f1fa79f41f1cfeed296ec51b545.tar.gz dedo-192649f453af1f1fa79f41f1cfeed296ec51b545.tar.xz |
Intermediate.
Diffstat (limited to 'lnodes.go')
-rw-r--r-- | lnodes.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lnodes.go b/lnodes.go new file mode 100644 index 0000000..8db6a85 --- /dev/null +++ b/lnodes.go @@ -0,0 +1,17 @@ +package bolt + +type lnodes []lnode + +// replace replaces the node at the given index with a new key/value size. +func (s lnodes) replace(key, value []byte, index int) lnodes { + n := &s[index] + n.pos = 0 + n.ksize = len(key) + n.vsize = len(value) + return s +} + +// insert places a new node at the given index with a key/value size. +func (s lnodes) insert(key, value []byte, index int) lnodes { + return append(s[0:index], lnode{ksize: len(key), vsize: len(value)}, s[index:len(s)]) +} |