Bidirectional Navigation of Objects #238
Description
Is it possible to navigate objects bidirectionally? Say I want to build the most simple social network possible: Everyone can write posts, each post consists of some plaintext content and a link to the parent post:
{
"content": "My first post, I'm so excited!11",
"parent": {
"/": "QmAAA...AAA"
}
}
The user interface should allow a user to select a post and show all its children. Is there a way to efficiently query my node's local storage for all links to the post, filtering for only parent links? Or do I need to iterate through all objects in the local storage?
The scuttlebot p2p system automaticlly puts indexes into the local storage to allow bidirectional of links. The API for interacting with the database includes methods for querying all objects ('messages' in the scuttlebot vocabulary) that link to a given object. An analogous IPFS command would look like this:
ipfs object in-links <key> - Output the links pointing to the specified object.
With such an API, building interactive applications becomes far easier. Some more examples of use-cases are 'likes' in a social networking application, issue management in a github-clone, or dependency statistics in a package manager. I feel like this would probably help with #224.