git ssb

1+

Dominic / secure-scuttlebutt



Commit 90ce5321ef13ea1e8baf2789adf6cc2e3beccf13

need a rawAppend for migrations

Dominic Tarr committed on 9/24/2017, 5:47:22 AM
Parent: 6231288fed240ee9625c45f9071ac3c2db5e759d

Files changed

db.jschanged
legacy.jschanged
minimal.jschanged
db.jsView
@@ -6,18 +6,14 @@
66 var ViewHashTable = require('flumeview-hashtable')
77
88 module.exports = function (dir, keys) {
99 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 +
1411 .use('keys', ViewHashTable(1, function (key) {
1512 var b = new Buffer(key.substring(1,7), 'base64').readUInt32BE(0)
1613 return b
1714 })
1815 )
19-
2016 .use('clock', require('./indexes/clock')())
2117 .use('feed', require('./indexes/feed')())
2218 .use('links', require('./indexes/links')(keys))
2319 .use('time', ViewLevel(1, function (data) {
@@ -43,8 +39,9 @@
4339 if(db[k] && 'function' === typeof db[k].since) {
4440 n++
4541 var c = db[k].since.value
4642 current += (Number.isInteger(c) ? c : -1)
43 +// current += c || 0
4744 }
4845 prog.current = ~~(current / n)
4946 //if the progress bar is complete, move the starting point
5047 //up to the current position!
@@ -61,5 +58,4 @@
6158
6259 return db
6360 }
6461
65-
legacy.jsView
@@ -113,16 +113,18 @@
113113 pull(
114114 db.createLogStream({gt: since}),
115115 paramap(function (data, cb) {
116116 prog.current += 1
117- flumedb.append(data, cb)
117 + flumedb.rawAppend(data, cb)
118118 }, 32),
119119 pull.drain(null, ready)
120120 )
121121 }
122122 }
123- function ready () {
123 + function ready (err) {
124 + if(err) throw err
124125 flumedb.ready.set(true)
125126 }
126127 })
127128 }
128129 }
130 +
minimal.jsView
@@ -36,9 +36,9 @@
3636
3737 var state = V.initial(), ready = false
3838 var waiting = [], flush = []
3939
40- var append = db.append
40 + var append = db.rawAppend = db.append
4141 var queue = AsyncWrite(function (_, cb) {
4242 var batch = state.queue//.map(toKeyValueTimestamp)
4343 state.queue = []
4444 append(batch, function (err, v) {

Built with git-ssb-web