-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hard deprecate find() and filter() #52
Conversation
Hmm, now I'm not sure. To implement So I have a few options:
Thoughts? |
I like |
Thanks for the thoughts, I think I'd build |
Can't we make it work like:
And then it would find anything where visit returns true? |
We could, but depending on the use case, it wouldn't be enough. Like if you want to I'd rather build APIs with a real-world use case in mind, and I haven't found a case where we strictly need |
@arj03 Okay, this PR now also adds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great. Much simpler api and a lot of minor things fixed I can see.
So, I began by thinking how to make
find(metafeed, visit, cb)
be usable for foreign peers. It wasn't so obvious, becausefind
could be used in so many ways:find(null, null, cb)
to get your own root mffind(myRoot, visit, cb)
to get my own subfeedsfind(somethingConfusing, visit, cb)
to get foreign subfeedsIn the third case, what if you just wanted to pass a
visit
function and you don't care about the 1st arg? That seems ambiguous because if the 1st arg is null, it means you want to find something that you own. And actuallyfind(null, null, cb)
is also ambiguous because it looks like you want to get any subfeed.So I side stepped this whole headache when I realized that
branchStream
can already be used as an API to find any subfeeds. You just need to use standard pull-streamfilter
andtake
.So this PR makes this change to the API:
I intend to update
branchStream
so that it getsopts.tombstoned
as a boolean, and this should cover our needs forfilterTombstoned
andfindTombstoned
. But I'll do that in another PR (anyway, we need a new API to create a tombstone).The reason why I added
getRoot
is that there is one use case in ssb-replication-scheduler where we just want to check if we have a root meta feed, but not create it.