ipld / specs

Content-addressed, authenticated, immutable data structures
Other
592 stars 108 forks source link

Selectors embedded inside graphs #237

Open mikeal opened 4 years ago

mikeal commented 4 years ago

There’s a few different threads converging that embed or otherwise store an IPLD Selector. Given that selectors are defined in IPLD Schema this is quite easy and was probably designed that way given how far ahead @warpfork tends to be in his thinking 🤓

Something I think we should talk about is how to define a selector that, within its own selection criteria, executes another selector stored within that graph.

The most basic version of this would be “Select ${CID} and execute it as a selector.”

This is something we need to talk about now because it has a direct impact on how we might design the next iteration of the CAR file format. Something under discussion right now is making the CAR header a fully referenced dag-cbor block, meaning that you could easily read the CID of the header out of the CAR file and refer to a “complete/deterministic” car file by its header. The header would then need to contain the root CID’s and selectors for all the data that CAR file contains. If we can drive alignment with selector improvements, we could end up with a CAR file header that is “executable” as a selector, so if you had the CID of a CAR file you could recreate it deterministically by simply “executing” that CID in the selector engine.

Stebalien commented 4 years ago

This could be useful for automatic prefetching: select a file and recursively execute the prefetch selector embedded in the file's metadata.