git ssb

1+

Dominic / secure-scuttlebutt



Commit b4df1e66bea6275126d6d9c508356dc44e62b504

implement post(fn)

Dominic Tarr committed on 10/1/2017, 7:54:58 AM
Parent: 24199ac28da08697028d10aecc22fed647854ce7

Files changed

minimal.jschanged
minimal.jsView
@@ -4,8 +4,9 @@
44 var codec = require('flumecodec/json')
55 var AsyncWrite = require('async-write')
66 var V = require('ssb-validate')
77 var timestamp = require('monotonic-timestamp')
8 +var Obv = require('obv')
89
910
1011 /*
1112 ## queue (msg, cb)
@@ -37,12 +38,16 @@
3738 var state = V.initial(), ready = false
3839 var waiting = [], flush = []
3940
4041 var append = db.rawAppend = db.append
42 + db.post = Obv()
4143 var queue = AsyncWrite(function (_, cb) {
4244 var batch = state.queue//.map(toKeyValueTimestamp)
4345 state.queue = []
4446 append(batch, function (err, v) {
47 + batch.forEach(function (data) {
48 + db.post.set(data)
49 + })
4550 cb(err, v)
4651 })
4752 }, function reduce(_, msg) {
4853 state = V.append(state, msg)

Built with git-ssb-web