Module gosh_remote::task

source ·
Expand description

Task for remote execution

Example

let (rx, tx) = Task::new().split();
 
// client side
tx1 = tx.clone();
tx2 = tx.clone();
let out1 = tx1.remote_compute("test input 1")?;
let out2 = tx2.remote_compute("test input 2")?;
 
// server side
if let Some(RemoteIO(input, tx_out)) = rx.recv() {
    // compute with job input
    let output = compute_with(input)?;
    // send job output to client side
    tx_out.send(output)?;
} else {
    // task channel closed
    // ...
}

Structs

RemoteIO contains input and output for remote execution. The first field in tuple is job input, and the second is for writing job output.
A Task channel for remote execution (multi-producer, single-consumer)
The server side for remote execution
The client side for remote execution

Type Definitions

The receiver of task for remote execution
The sender of computational results.