Skip to content

Commit

Permalink
Implement fill root using script object.
Browse files Browse the repository at this point in the history
See #453.
  • Loading branch information
flatheadmill committed Feb 5, 2015
1 parent 5721e40 commit 14484e6
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions strata.js
Original file line number Diff line number Diff line change
Expand Up @@ -1453,7 +1453,7 @@ prototype(Sheaf, 'mergeBranches', function (key, heft, address, callback) {
})

prototype(Sheaf, 'fillRoot', cadence(function (async) {
var locker = this.createLocker(), descents = [], root, child
var locker = this.createLocker(), script = new Script(this), descents = [], root, child

async([function () {
descents.forEach(function (descent) { locker.unlock(descent.page) })
Expand All @@ -1475,15 +1475,9 @@ prototype(Sheaf, 'fillRoot', cadence(function (async) {

this.splice(root.page, root.page.items.length, 0, cut)

this.writeBranch(root.page, this.filename2(root.page, '.pending'), async())
}, function () {
this._rename(child.page, 0, '', '.unlink', async())
}, function () {
this._rename(root.page, 0, '.pending', '.commit', async())
}, function () {
this._unlink(child.page, 0, '.unlink', async())
}, function () {
this.replace(root.page, '.commit', async())
script.writeBranch(root.page)
script.unlink(child.page)
script.commit(async())
})
}))

Expand Down

0 comments on commit 14484e6

Please sign in to comment.