Comparing version 1.0.1 to 1.1.0
10
index.js
@@ -87,3 +87,3 @@ const codecs = require('codecs') | ||
async insertKey (key, child = null) { | ||
async insertKey (key, child = null, overwrite = true) { | ||
let s = 0 | ||
@@ -98,2 +98,3 @@ let e = this.keys.length | ||
if (c === 0) { | ||
if (!overwrite) return true | ||
this.changed = true | ||
@@ -471,2 +472,3 @@ this.keys[mid] = key | ||
this.options = options | ||
this.overwrite = options.overwrite !== false | ||
this.locked = null | ||
@@ -578,2 +580,3 @@ this.onseq = this.options.onseq || noop | ||
if (c === 0) { | ||
if (!this.overwrite) return this._unlockMaybe() | ||
node.setKey(mid, target) | ||
@@ -591,3 +594,4 @@ return this._append(root, seq, key, value) | ||
let needsSplit = !(await node.insertKey(target, null)) | ||
let needsSplit = !(await node.insertKey(target, null, this.overwrite)) | ||
if (!node.changed) return this._unlockMaybe() | ||
@@ -599,3 +603,3 @@ while (needsSplit) { | ||
if (parent) { | ||
needsSplit = !(await parent.insertKey(median, right)) | ||
needsSplit = !(await parent.insertKey(median, right, false)) | ||
node = parent | ||
@@ -602,0 +606,0 @@ } else { |
{ | ||
"name": "hyperbee", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "An append-only Btree running on a Hypercore.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
93292
2774