Apache Mesos
|
Provides RecordIO decoding on top of an http::Pipe::Reader. More...
#include <recordio.hpp>
Public Member Functions | |
Reader (std::function< Try< T >(const std::string &)> deserialize, process::http::Pipe::Reader reader) | |
virtual | ~Reader () |
process::Future< Result< T > > | read () |
Returns the next piece of decoded data from the pipe. More... | |
Provides RecordIO decoding on top of an http::Pipe::Reader.
The caller is responsible for closing the http::Pipe::Reader when a failure is encountered or end-of-file is reached.
TODO(bmahler): Since we currently do not have a generalized abstraction in libprocess for "streams" of asynchronous data (e.g. process::Stream<T>), we have to create a one-off wrapper here. In the future, this would be better expressed as "piping" data from a stream of raw bytes into a decoder, which yields a stream of typed data.
|
inline |
|
inlinevirtual |
|
inline |
Returns the next piece of decoded data from the pipe.
Returns error if an individual record could not be decoded. Returns none when end-of-file is reached. Returns failure when the pipe or decoder has failed.