You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 12, 2019. It is now read-only.
Repository navigation
This repository was archived by the owner on Nov 12, 2019. It is now read-only.
Is there as way to create a read-only stream between two documents? So if you have document A and B, A stream updates to B but B doesn't send updates to A. Instead B is thought to be read-only.
I've tried to not pipe the B stream back to A but this resulted in B not getting all of the existing state from A:
oh, hmm. that feature was intended for persistance - using it that way will work,
but will just resend old data, instead of only sending new data.
You really want to still send the vector clock hand shake,
okay, I just added a sendClock option.
now, you can create a scuttlebutt stream that will emit updates, but not send them,
like this:
What does setting the slave stream to readable: false do? Does it prevent that stream from propagating changes down stream? So if you just set the master as writable: false and didn't set the slave as readable: false, the slave stream would still send changes over the wire to the master but the master would just ignore them? Is that the intention?
readable: false tells it not to emit any updates after the vector clock.
So you probably don't need that, but it will stop it spamming if you are also setting properties on it locally.
note that this is a setting on the stream - you can have a pair that is master(a) -> slave(b), but have still have master(a) <-> master(c) or even master(a) -> slave(b); master(c) -> slave(b). setting readable: false on b's streams prevent it from sending update received from another master(c) back to master(a), etc.
Activity
juliangruber commentedon Jul 9, 2013
you could write a scuttlebutt subclass that only accepts changes from the scuttlebutt that has been piped to it, then you can do:
Raynos commentedon Jul 9, 2013
x.createStream({ writable: false })mbrevoort commentedon Jul 9, 2013
@Raynos oh man, that just made my day :)
juliangruber commentedon Jul 9, 2013
every scuttlebutt would get that, right? then I think that's the better solution. oh, is that already in scuttlebutt?
Raynos commentedon Jul 9, 2013
every scuttlebutt has
createStream({ writable: Boolean, readable: Boolean })Raynos commentedon Jul 9, 2013
Both default to
truedominictarr commentedon Jul 9, 2013
oh, hmm. that feature was intended for persistance - using it that way will work,
but will just resend old data, instead of only sending new data.
You really want to still send the vector clock hand shake,
okay, I just added a
sendClockoption.now, you can create a scuttlebutt stream that will emit updates, but not send them,
like this:
just added this in scuttlebutt 5.6, update any subclass and you should get that.
mbrevoort commentedon Jul 10, 2013
@dominictarr that's excellent, thanks!
What does setting the slave stream to
readable: falsedo? Does it prevent that stream from propagating changes down stream? So if you just set the master aswritable: falseand didn't set the slave asreadable: false, the slave stream would still send changes over the wire to the master but the master would just ignore them? Is that the intention?dominictarr commentedon Jul 10, 2013
readable: false tells it not to emit any updates after the vector clock.
So you probably don't need that, but it will stop it spamming if you are also setting properties on it locally.