need API for handling large bytes nodes #319
Labels
effort/days
Estimated to take multiple days, but less than a week
exp/intermediate
Prior experience is likely helpful
kind/architecture
Core architecture of project
kind/enhancement
A net-new feature or improvement to an existing feature
need/analysis
Needs further analysis before proceeding
P1
High: Likely tackled by core team if no one steps up
The
Node
interface needs to provide some way to handle "big" bytes -- bigger than would readily fit into a single[]byte
. Some sort ofio.Reader
implementation; and probably, anio.ReadSeeker
.This should make it possible to work even with data that wouldn't fit entirely in memory. For example, we should be able to use this for ADLs that store huge ranges of bytes, across multiple blocks of actual storage, which may happen via something like the FBL ADL.
A
GetBytesReadSeeker() (io.ReadSeeker, error)
method may be sufficient? Are there any more operations than that which we expect to need?The current
AsBytes() ([]byte, error)
method should also remain (to avoid breaking existing code), but newly written generic code would be encouraged to prefer to useGetBytesReadSeeker
so that it works regardless of data size.Correspondingly,
NodeAssembler
should be able to create a new node of bytes by copying in from anio.Reader
, or returning anio.WriteCloser
.We may be able to provide both these features with feature detection rather than making them a required new part of
Node
andNodeBuilder
, but if so, should make sure we provide good helper functions that provide the streaming style interfaces regardless of whether the optional features are present, so that this doesn't become something user code has to be bothered about.Stretch goal: think about having variants of these features which state that byte slices used for intermediate handling may be retained by the implementation, so that it can attempt zero-copy handling of data. (E.g. I can imagine that one might want to read some data off the filesystem; "chunk" it; and then it might be nice to pass off the chunks in a way that eventually ends up in a
putv([][]byte,...)
-style syscall.)The text was updated successfully, but these errors were encountered: