-
Notifications
You must be signed in to change notification settings - Fork 60
[WIP] feat: add option to select record #48
base: master
Are you sure you want to change the base?
Conversation
I added an option to select the first one. However, I am not sure if this is the best option for us. Maybe I should provide a function instead. What do you think? |
I've thought before that it would be nice to be able to return the actual record you want to re-propagate instead of an index. Use case is where you might want to merge records that different nodes have into a new entry. |
@blakebyrnes as this is in the get, I think I did not understand your suggestion. What is the actual record that you want to |
@vasco-santos lets say you have every node in a system storing top 10 lists. When all N records come back, the "get" will compare each record to say "what is the best record" to send out as a corrected record. In cases like this type of data storage, you might actually want to merge the lists to create a new, aggregated top 10 list. It's a bit of a different use case than the bittorrent use case, but it seems like the Kad is still a valid data structure for those cases. It's just using "keys" as a convention for the content instead of as the hash of the content. |
Correct
So, |
Yep, that's exactly what I was thinking. |
I understand its advantages, but I don't know if I agree with that approach, as we will provide an easy way of rewriting DHT entries. Anyway, you can create a PR with your proposal, so that we can have a more clear discussion of it. |
When we intend to use arbitrary keys with no namespaces, we end up not being able to get them js-libp2p-recordselection.js#L20. However, there are use cases where we want to be able to select a specific record or provide a function to select it.
In this PR, I added an option to select the first record obtained.