From 60d897a8e4bea9bad37a5be2fc1c80a9747a7f63 Mon Sep 17 00:00:00 2001 From: Alan Gutierrez Date: Sat, 5 Dec 2015 05:24:26 -0500 Subject: [PATCH] Evaluate IMDone. --- .imdone/config.json | 37 +++++++++++++++++++++++++++++++++++++ balancer.js | 5 +++-- cursor.js | 5 +++-- locker.js | 6 +++--- logger.js | 2 +- player.js | 6 +++--- strata.js | 12 ++++++------ t/proof.js | 4 ++-- 8 files changed, 58 insertions(+), 19 deletions(-) create mode 100644 .imdone/config.json diff --git a/.imdone/config.json b/.imdone/config.json new file mode 100644 index 00000000..b5c3b905 --- /dev/null +++ b/.imdone/config.json @@ -0,0 +1,37 @@ +{ + "exclude": [ + "^(node_modules|bower_components|\\.imdone|target|build|dist|logs)[\\/\\\\]?|\\.(git|svn|hg|npmignore)|\\~$|\\.(jpg|png|gif|swp|ttf|otf)$" + ], + "watcher": true, + "code": { + "include_lists": [ + "todo", + "TODO", + "DOING", + "DONE", + "PLANNING", + "FIXME", + "ARCHIVE", + "HACK", + "CHANGED", + "XXX", + "IDEA", + "NOTE", + "REVIEW" + ] + }, + "lists": [ + { + "name": "TODO", + "hidden": false + } + ], + "marked": { + "gfm": true, + "tables": true, + "breaks": false, + "pedantic": false, + "smartLists": true, + "langPrefix": "language-" + } +} diff --git a/balancer.js b/balancer.js index b407e8f3..cd9ecb1e 100644 --- a/balancer.js +++ b/balancer.js @@ -114,6 +114,7 @@ Balancer.prototype.balance = cadence(function balance (async, sheaf) { _gather.call(this, +address, lengths[address], async()) })(addresses) }, function () { + // TODO permeate('bigeasy.strata.plan', {}, async()) this.sheaf.tracer('plan', {}, async()) }, function () { var address, node, difference, addresses @@ -460,7 +461,7 @@ Balancer.prototype.exorcise = function (pivot, page, corporal) { ok(page.ghosts, 'no ghosts') ok(corporal.items.length - corporal.ghosts > 0, 'no replacement') - // todo: how is this not a race condition? I'm writing to the log, but I've + // TODO how is this not a race condition? I'm writing to the log, but I've // not updated the pivot page, not rewritten during `deleteGhosts`. page.splice(0, 1, corporal.splice(corporal.ghosts, 1)) page.ghosts = 0 @@ -556,7 +557,7 @@ Balancer.prototype.mergePagesAndUnlock = cadence(function ( var merge = async([function () { descents.forEach(function (descent) { locker.unlock(descent.page) }) ! [ 'left', 'right' ].forEach(function (direction) { - // todo: use `pages` array, these conditions are tricky, + // TODO use `pages` array, these conditions are tricky, // `parents[direction]` may not yet exist. if (singles[direction].length) { singles[direction].forEach(function (page) { locker.unlock(page) }) diff --git a/cursor.js b/cursor.js index 6f610212..c97795bd 100644 --- a/cursor.js +++ b/cursor.js @@ -16,6 +16,7 @@ function Cursor (sheaf, logger, descents, exclusive, searchKey) { descents.shift() } +// TODO get rid of comments like this one // to user land Cursor.prototype.next = cadence(function (async) { var next @@ -45,7 +46,7 @@ Cursor.prototype.indexOf = function (key, index) { var page = this.page var index = this.sheaf.find(page, key, index) var unambiguous - unambiguous = -1 < index // <- todo: ? + unambiguous = -1 < index // <- TODO ? || ~ index < this.page.items.length || page.right.address === null if (!unambiguous && this.sheaf.comparator(key, page.right.key) >= 0) { @@ -63,7 +64,7 @@ Cursor.prototype._unlock = cadence(function (async) { }) }) -// todo: pass an integer as the first argument to force the arity of the +// TODO pass an integer as the first argument to force the arity of the // return. Cursor.prototype.unlock = function (callback) { if (this._appender) { diff --git a/locker.js b/locker.js index a75ba580..af8f315e 100644 --- a/locker.js +++ b/locker.js @@ -10,7 +10,7 @@ function Locker (sheaf, magazine) { } Locker.prototype.lock = cadence(function (async, address, exclusive) { - // todo: locks does not appear to need to be an array. + // TODO locks does not appear to need to be an array. var cartridge = this._magazine.hold(address, {}), page = cartridge.value.page, locks = [] @@ -28,7 +28,7 @@ Locker.prototype.lock = cadence(function (async, address, exclusive) { // by the final external catch block. async([function () { async(function () { - // todo: does there need to be differnt types anymore? + // TODO does there need to be differnt types anymore? page = this._sheaf.createPage(address % 2, address) cartridge.value.page = page page.cartridge = cartridge @@ -54,7 +54,7 @@ Locker.prototype.lock = cadence(function (async, address, exclusive) { }, function () { return [ page ] }) - }) // todo: unecessary cadence + }) // TODO unecessary cadence }, function (error) { cartridge.release() delete this._locks[page.address] diff --git a/logger.js b/logger.js index 95770dd2..705533fd 100644 --- a/logger.js +++ b/logger.js @@ -11,7 +11,7 @@ var Scribe = require('./scribe') function Logger (options) { this._directory = options.directory - // todo: remove when page can slice + // TODO remove when page can slice this._sheaf = options.sheaf this.framer = options.framer this.serializers = options.serializers diff --git a/player.js b/player.js index b41732ea..7d0117f0 100644 --- a/player.js +++ b/player.js @@ -10,7 +10,7 @@ function Player (options) { this.userRecordHandler = options.userRecordHandler } -// todo: outgoing +// TODO outgoing Player.prototype.io = cadence(function (async, direction, filename) { async(function () { fs.open(filename, direction[0], async()) @@ -84,7 +84,7 @@ Player.prototype._play = function (sheaf, slice, start, page) { } else { var index = header[1] if (leaf) { - // todo: see if it is faster to perform the slices here directly. + // TODO see if it is faster to perform the slices here directly. if (index > 0) { page.splice(index - 1, 0, { key: sheaf.extractor(entry.body), @@ -115,7 +115,7 @@ Player.prototype._play = function (sheaf, slice, start, page) { Player.prototype.play = cadence(function (async, sheaf, fd, stat, read, page) { var buffer = new Buffer(sheaf.options.readLeafStartLength || 1024 * 1024) - // todo: really want to register a cleanup without an indent. + // TODO really want to register a cleanup without an indent. async([function () { fs.close(fd, async()) }], function () { diff --git a/strata.js b/strata.js index 33a36510..88485b31 100644 --- a/strata.js +++ b/strata.js @@ -13,7 +13,7 @@ var Cache = require('magazine'), ok = require('assert').ok, path = require('path') -// todo: temporary +// TODO temporary var scram = require('./scram') function extend(to, from) { @@ -77,13 +77,13 @@ Strata.prototype.create = cadence(function (async) { Strata.prototype.open = cadence(function (async) { this.sheaf.createMagazine() - // todo: instead of rescue, you might try/catch the parts that you know + // TODO instead of rescue, you might try/catch the parts that you know // are likely to cause errors and raise an error of a Strata type. - // todo: or you might need some way to catch a callback error. Maybe an + // TODO or you might need some way to catch a callback error. Maybe an // outer most catch block? - // todo: or if you're using Cadence, doesn't the callback get wrapped + // TODO or if you're using Cadence, doesn't the callback get wrapped // anyway? async(function () { fs.stat(this.sheaf.directory, async()) @@ -100,11 +100,11 @@ Strata.prototype.open = cadence(function (async) { // to user land Strata.prototype.close = cadence(function (async) { - // todo: that's a lot of indirection. + // TODO that's a lot of indirection. var cartridge = this.sheaf.metaRoot.cartridge, lock = cartridge.value.page.lock lock.unlock() - // todo + // TODO lock.dispose() cartridge.release() diff --git a/t/proof.js b/t/proof.js index 0827d90c..aa9ba628 100644 --- a/t/proof.js +++ b/t/proof.js @@ -55,7 +55,7 @@ function vivify (directory, callback) { } } -// todo: pretty print should be in here, so I can use it from stratify and the +// TODO pretty print should be in here, so I can use it from stratify and the // stringify utility. function stringify (directory, callback) { vivify(directory, check(callback, segments)) @@ -73,7 +73,7 @@ function load (segments, callback) { } } -// todo: do not accept async, make a real function. +// TODO do not accept async, make a real function. function insert (async, strata, values) { async(function () { values.sort()