git ssb

4+

Dominic / scuttlebot



Commit fdf50b3439004f02974d5adf4ae65b7fdc738dac

sbot.since - output state of log+views

Dominic Tarr committed on 12/10/2016, 5:21:52 PM
Parent: fcfa6a739b421d60ee5310a64fb38b979113f4cf

Files changed

api.mdchanged
index.jschanged
api.mdView
@@ -351,4 +351,8 @@
351351 ```
352352
353353
354354
355 +## since: sync
356 +
357 +get the current state of the internal flumelog
358 +
index.jsView
@@ -10,9 +10,10 @@
1010 var valid = require('./lib/validators')
1111 var apidocs = require('./lib/apidocs.js')
1212
1313 function isString(s) { return 'string' === typeof s }
14-
14 +function isObject(o) { return 'object' === typeof o }
15 +function isFunction (f) { return 'function' === typeof f }
1516 // create SecretStack definition
1617 var manifest = mdm.manifest(apidocs._)
1718 manifest.usage = 'sync'
1819 var SSB = {
@@ -54,8 +55,21 @@
5455 _close()
5556 cb && cb() //multiserver doesn't take a callback on close.
5657 })
5758 }
59 +
60 + function since () {
61 + var plugs = {}
62 + for(var k in ssb) {
63 + if(ssb[k] && isObject(ssb[k]) && isFunction(ssb[k].since))
64 + plugs[k] = ssb[k].since.value
65 + }
66 + return {
67 + since: ssb.since.value,
68 + plugins: plugs
69 + }
70 + }
71 +
5872 return {
5973 id : feed.id,
6074 keys : opts.keys,
6175
@@ -75,8 +89,10 @@
7589
7690 pre : ssb.pre,
7791 post : ssb.post,
7892
93 + since : since,
94 +
7995 getPublicKey : ssb.getPublicKey,
8096 latest : ssb.latest,
8197 getLatest : valid.async(ssb.getLatest, 'feedId'),
8298 latestSequence : valid.async(ssb.latestSequence, 'feedId'),

Built with git-ssb-web