consider easier ways to let users use a CAR index directly #243
Labels
kind/enhancement
A net-new feature or improvement to an existing feature
P3
Low: Not priority right now
Right now, an easy way to transparently use the index is to go through the blockstore package. Ideally we don't want that to be the main option, though - many use cases don't need a blockstore and its extra abstraction layer.
It should be possible to efficiently use an index from a CAR file on disk via OpenReader. The best option right now is to go through Reader.IndexReader and index.ReadFrom. Unfortunately, it has some shortcomings:
Always loads the entire index into memory. This is rather wasteful if one just wants to loop over all index entries once, for example. Plus, OpenReader already uses an mmap, which allows for fast sequential or random access.
No ability to inspect information about the index. For example, how do I tell if a CAR file has a multihash sorted index? Right now the API just allows this by loading the entire index into memory.
Has some footguns; for example, it's a bit too easy to call index.ReadFrom straight on Reader.IndexReader, forgetting that it may be nil.
I'm working around these in the indexer provider, but I'll probably backport some of it in the form of reusable APIs.
This issue would enable #222, I think.
It's unclear to me if/how #95 is related.
cc @masih @willscott
The text was updated successfully, but these errors were encountered: