6 #include <boost/fiber/buffered_channel.hpp> 9 #include "mr/operator_executor.h" 10 #include "util/fibers/simple_channel.h" 16 const pb::Input* input;
19 ::std::string file_name;
21 using FileNameQueue = ::boost::fibers::buffered_channel<FileInput>;
24 enum Operand { UNDEFINED, BINARY_FORMAT, TEXT_FORMAT, METADATA, RECORD} op = UNDEFINED;
27 absl::variant<const pb::Input::FileSpec*, ::std::pair<size_t, ::std::string>> payload;
31 Record(Operand op2,
size_t pos, ::std::string val)
32 : op(op2), payload(::std::pair<size_t, ::std::string>{pos, ::std::move(val)}) {}
34 Record(Operand op2,
const pb::Input::FileSpec* fspec)
35 : op(op2), payload(fspec) {}
44 void Run(
const std::vector<const InputBase*>& inputs, detail::TableBase* ss,
45 ShardFileMap* out_files)
final;
51 void InitInternal()
final;
57 void IOReadFiber(detail::TableBase* tb);
60 void SetupPerIoThread(
unsigned index, detail::TableBase* tb);
62 static void MapFiber(
RecordQueue* record_q, detail::TableBase* tb);
64 std::unique_ptr<FileNameQueue> file_name_q_;
Base class for operator executors.
Single producer - single consumer thread-safe, fiber-friendly channel.
A pool of IoContext objects, representing and managing CPU resources of the system.