aboutsummaryrefslogtreecommitdiff
path: root/lnodes.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-01-27 10:11:54 -0500
committerBen Johnson <benbjohnson@yahoo.com>2014-01-27 10:11:54 -0500
commit192649f453af1f1fa79f41f1cfeed296ec51b545 (patch)
tree1195cb6ca23a6c8a576a8c24d10295ddc1515df6 /lnodes.go
parentInitialize transaction/rwtransaction. (diff)
downloaddedo-192649f453af1f1fa79f41f1cfeed296ec51b545.tar.gz
dedo-192649f453af1f1fa79f41f1cfeed296ec51b545.tar.xz
Intermediate.
Diffstat (limited to 'lnodes.go')
-rw-r--r--lnodes.go17
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)])
+}