MCPcopy Create free account
hub / github.com/It4innovations/hyperqueue / resend_stdio

Function resend_stdio

crates/hyperqueue/src/worker/start/program.rs:215–234  ·  view source on GitHub ↗
(
    task_id: TaskId,
    channel: ChannelId,
    stdio: Option<impl tokio::io::AsyncRead + Unpin>,
    stream: StreamSender,
)

Source from the content-addressed store, hash-verified

213}
214
215async fn resend_stdio(
216 task_id: TaskId,
217 channel: ChannelId,
218 stdio: Option<impl tokio::io::AsyncRead + Unpin>,
219 stream: StreamSender,
220) -> tako::Result<()> {
221 if let Some(mut stdio) = stdio {
222 log::debug!("Resending stream {task_id}/{channel}");
223 loop {
224 let mut buffer = vec![0; STDIO_BUFFER_SIZE];
225 let size = stdio.read(&mut buffer[..]).await?;
226 buffer.truncate(size);
227 stream.send_data(channel, buffer).await?;
228 if size == 0 {
229 break;
230 };
231 }
232 }
233 Ok(())
234}
235
236fn create_directory_if_needed(file: &StdioDef) -> std::io::Result<()> {
237 if let StdioDef::File { path, .. } = file

Callers

nothing calls this directly

Calls 1

send_dataMethod · 0.80

Tested by

no test coverage detected