Commit 90ce5321ef13ea1e8baf2789adf6cc2e3beccf13
need a rawAppend for migrations
Dominic Tarr committed on 9/24/2017, 5:47:22 AMParent: 6231288fed240ee9625c45f9071ac3c2db5e759d
Files changed
db.js | changed |
legacy.js | changed |
minimal.js | changed |
db.js | ||
---|---|---|
@@ -6,18 +6,14 @@ | ||
6 | 6 … | var ViewHashTable = require('flumeview-hashtable') |
7 | 7 … | |
8 | 8 … | module.exports = function (dir, keys) { |
9 | 9 … | var db = require('./minimal')(dir) |
10 | -// var log = OffsetLog(path.join(dir, 'log.offset'), 1024*16, codex.json) | |
11 | -// | |
12 | -// var db = Flume(log, false) //false says the database is not ready yet! | |
13 | -// .use('last', require('./indexes/last')()) | |
10 … | + | |
14 | 11 … | .use('keys', ViewHashTable(1, function (key) { |
15 | 12 … | var b = new Buffer(key.substring(1,7), 'base64').readUInt32BE(0) |
16 | 13 … | return b |
17 | 14 … | }) |
18 | 15 … | ) |
19 | - | |
20 | 16 … | .use('clock', require('./indexes/clock')()) |
21 | 17 … | .use('feed', require('./indexes/feed')()) |
22 | 18 … | .use('links', require('./indexes/links')(keys)) |
23 | 19 … | .use('time', ViewLevel(1, function (data) { |
@@ -43,8 +39,9 @@ | ||
43 | 39 … | if(db[k] && 'function' === typeof db[k].since) { |
44 | 40 … | n++ |
45 | 41 … | var c = db[k].since.value |
46 | 42 … | current += (Number.isInteger(c) ? c : -1) |
43 … | +// current += c || 0 | |
47 | 44 … | } |
48 | 45 … | prog.current = ~~(current / n) |
49 | 46 … | //if the progress bar is complete, move the starting point |
50 | 47 … | //up to the current position! |
@@ -61,5 +58,4 @@ | ||
61 | 58 … | |
62 | 59 … | return db |
63 | 60 … | } |
64 | 61 … | |
65 | - |
legacy.js | ||
---|---|---|
@@ -113,16 +113,18 @@ | ||
113 | 113 … | pull( |
114 | 114 … | db.createLogStream({gt: since}), |
115 | 115 … | paramap(function (data, cb) { |
116 | 116 … | prog.current += 1 |
117 | - flumedb.append(data, cb) | |
117 … | + flumedb.rawAppend(data, cb) | |
118 | 118 … | }, 32), |
119 | 119 … | pull.drain(null, ready) |
120 | 120 … | ) |
121 | 121 … | } |
122 | 122 … | } |
123 | - function ready () { | |
123 … | + function ready (err) { | |
124 … | + if(err) throw err | |
124 | 125 … | flumedb.ready.set(true) |
125 | 126 … | } |
126 | 127 … | }) |
127 | 128 … | } |
128 | 129 … | } |
130 … | + |
minimal.js | ||
---|---|---|
@@ -36,9 +36,9 @@ | ||
36 | 36 … | |
37 | 37 … | var state = V.initial(), ready = false |
38 | 38 … | var waiting = [], flush = [] |
39 | 39 … | |
40 | - var append = db.append | |
40 … | + var append = db.rawAppend = db.append | |
41 | 41 … | var queue = AsyncWrite(function (_, cb) { |
42 | 42 … | var batch = state.queue//.map(toKeyValueTimestamp) |
43 | 43 … | state.queue = [] |
44 | 44 … | append(batch, function (err, v) { |
Built with git-ssb-web