Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 0 additions & 35 deletions api.md

This file was deleted.

56 changes: 56 additions & 0 deletions help.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

module.exports = {
description: 'legacy replication & stub api for replication',
commands: {
request: {
type: 'sync',
description: 'request a specific feed to be replicated or not',
args: {
id: {
type: 'FeedId',
description: 'FeedId to enable or disable replication'
},
replicate: {
type: 'boolean',
description: 'wether to replicate this feed, defaults to true'
}
}

},
block: {
type: 'sync',
description: 'block or unblock replication of a feed',
args: {
from: {
type: 'FeedId',
description: 'feed id which created the block'
},
to: {
type: 'FeedId',
description: 'feed id which was blocked'
},
blocking: {
type: 'boolean',
description: 'wether this is a block or unblock, defaults to unblock (false)'
}
}
},
upto: {
type: 'source',
description: 'stream {id, sequence} tuples of the sequence you are up to for every feed',
args: {
live: {
type: 'boolean',
description: 'include real time changes to replication state, such as new feeds followed'
}
}
},
changes: {
type: 'source',
description: 'stream of replication change events, recommend polling sbot.progress instead',
args: {}
}
}
}


9 changes: 7 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ var pull = require('pull-stream')
module.exports = {
name: 'replicate',
version: '2.0.0',
manifest: mdm.manifest(fs.readFileSync(path.join(__dirname, 'api.md'), 'utf8')),
manifest: require('./manifest.json'),
//mdm.manifest(fs.readFileSync(path.join(__dirname, 'api.md'), 'utf8')),
//replicate: replicate,
init: function (ssbServer, config) {
var notify = Notify(), upto
Expand All @@ -28,8 +29,12 @@ module.exports = {
return {
request: function () {},
block: function (from, to, blocking) {},
changes: function () { return function (abort, cb) { cb(true) } }
changes: function () { return function (abort, cb) { cb(true) } },
help: function () {
return require('./help')
}
}
}
}


8 changes: 8 additions & 0 deletions legacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,13 +389,21 @@ module.exports = function (ssbServer, notify, config) {
upto: upto,
changes: notify.listen,
block: function (from, to, blocking) {
if(isObject(from)) {
to = from.to
blocking = from.blocking
from = from.from
}
if(blocking) {
blocks[from] = blocks[from] || {}
blocks[from][to] = blocking
}
else if (blocks[from]) {
delete blocks[from][to]
}
},
help: function () {
return require('./help')
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

{
"changes": "source",
"upto": "source",
"request": "sync",
"block": "sync"
}

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
},
"dependencies": {
"deep-equal": "^1.0.1",
"mdmanifest": "^1.0.8",
"observ-debounce": "^1.1.1",
"obv": "0.0.1",
"pull-cat": "^1.1.11",
Expand All @@ -36,3 +35,4 @@
"author": "Dominic Tarr <dominic.tarr@gmail.com> (http://dominictarr.com)",
"license": "MIT"
}