Skip to content
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

introduce findById() #41

Merged
merged 1 commit into from
Sep 10, 2021
Merged

introduce findById() #41

merged 1 commit into from
Sep 10, 2021

Conversation

staltz
Copy link
Member

@staltz staltz commented Sep 10, 2021

Context

In the new multi-format ssb-ebt we need to be able to get any feedID and infer what is it: is it a classic main feed? Is it a classic index feed? Is it a bendy butt? (The first 2 questions are the most important) It's not enough to just look at the feedId and infer the feedformat, we also need to know the feedpurpose. In ssb-replication-scheduler we will also need something like this.

Solution

New API findById(). Turns out it was already implemented as getMetadata, I just did further tweaking in its internals, to:

  • If the feedId given to findById() has been tombstoned, return null
  • Infer the feedformat from the feedId
  • Remove msg.value.content stuff such as type and nonce etc
  • Bundle unknown fields in msg.value.content under metadata object, like it is during subfeed creation

@staltz staltz requested a review from arj03 September 10, 2021 13:10
Copy link
Member

@arj03 arj03 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great we can reuse the existing function and just extend it a bit. I have some comments on the usage in ebt, but I'll take them in another channel. This PR in itself is really good in that it makes this module quite a bit more general.

@staltz staltz merged commit 3a69b6d into master Sep 10, 2021
@staltz staltz deleted the otherfeeds branch September 10, 2021 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants