git ssb

0+

Dominic / ssb-validate



Commit df94322b7fbb68520643eed377fd4bbc72294bfa

validate your local log

Dominic Tarr committed on 4/11/2017, 5:36:08 AM
Parent: 9cfdc7fee9e0cb2d8ab16496dbf8c093c8051379

Files changed

example.jschanged
example.jsView
@@ -1,33 +1,32 @@
11 var pull = require('pull-stream')
2 +
23 var v = require('./')
34 var state = {
45 queue: [],
56 feeds: {},
67 error: null
78 }
9 +
810 var c = 0, e = 0, start = Date.now(), l = 0
911 require('ssb-client')(function (err, sbot) {
1012 if(err) throw err
1113 pull(
12- sbot.createLogStream({keys: false}),
14 + sbot.createLogStream(),
1315 pull.drain(function (msg) {
14- state = v.append(state, msg)
15- l += JSON.stringify(msg, null, 2).length
16 + state = v.append(state, msg.value)
1617 if(state.error) {
17- // console.log(msg)
18- // console.log(state.feeds[msg.author])
19- console.log(state.error.message)
2018 e++
19 + var err = state.error
20 + state.error = null
21 + console.log(err.message)
22 + return false
2123 }
2224 state.queue.shift()
2325 var s = ((Date.now() - start)/1000)
2426 if(!(c++%100)) {
25- console.log(s, e, c, c / s, l, l / s)
27 + console.log(s, e, c, c / s)
2628 }
29 + return true
2730 }, sbot.close)
2831 )
2932 })
30-
31-
32-
33-

Built with git-ssb-web