byte-storage icon indicating copy to clipboard operation
byte-storage copied to clipboard

streams are too high level

Open dominictarr opened this issue 8 years ago • 1 comments

I would like to suggest making the base level operation a simple read of a byte range that returns that exact byte range, and then build the stream api on top of that.

basically, just something analgous to POSIX read and write https://www.gnu.org/software/libc/manual/html_node/I_002fO-Primitives.html

if you are building an interesting on disk data structure like say, an append only b-tree, there are a lot of small things to read (branches in the tree) these are likely to be a single block or smaller, so creating a whole stream for that is a significant overkill.

streams can be useful too, but if you have a simple read/write you can make efficient streams, but not the other way around.

dominictarr avatar Jul 18 '17 22:07 dominictarr

oh, sorry what I should add is I saw you had an api for simple reads and writes (readAll, writeAll) but calling them "helpers" implies to me that they where built on top of the stream api - I suggest this situation be reversed.

dominictarr avatar Jul 18 '17 22:07 dominictarr