Open the-moisrex opened 1 year ago
yielding can be just an iterator
But what would be a consumer, if the yielder is an iterator?
Another question:
How we should pass the yeilded value to the consumer?
operator()(begin, end)
: consumeroperator()(value)
: consumeroperator()()
: single shot producerbegin(), end()
: multi shot producerresponse::body
to hold a chain of tasks the return a bodyidea:
what if instead of taking a scheduler or something a-like as the first input of the algorithms, we take an operation state?
connect
on the task/task-chainget_value
on themidea:
Each task would get an Operation State Token which is a kinda-pointer to the real deal and whoever (of the execution contexts) has it owns the operation.
So when a syscall is made into the io execution context, we pass the token as a callback; then the io execution context either
Task Chains are an idea for the Event Manager idea. They represent a chain of task/io-operations/events that will be passed to the execution context and the execution context starts to run them and handle with the errors.
Types of tasks:
taskify(...)
functionread_file
and return a chain ofopen >> read | handle_error
and we can simply append those to the chain.Features:
Other usages:
Chains:
operator >>
: sequence an operationoperator |
: sequence an error handling operationoperator &
: sequence a finally operation that runs whether or not the chain was success or an erroroperator ()
: call the next task in sequence and schedule the next I/O operation if there's any; Required Arguments:chain.set_error(...)
chain.set_success(...)