greglook / blocks

Clojure content-addressable data storage.
The Unlicense
113 stars 6 forks source link

Support block subranges #3

Closed greglook closed 9 years ago

greglook commented 9 years ago

Figure out the right way to support reading a subrange of block content. For literal blocks, this is easy - just need to open a stream, skip some portion of the content, and wrap a bounded stream around that. Both file and s3-backed blocks support subrange reading.

Maybe the stat metadata can include a marker for whether the reader function supports being invoked with range arguments. If so, call it like (reader start end).

greglook commented 9 years ago

Merged in 4a0df2953037cdb7811663d6b2b4816d3d525e33. Rather than explicit metadata, the open function just tries to call reader with two args, and if it throws an ArityException it falls back to the naive skip + bounded input stream approach.