ORO45LQILYKIWSZZHYISPJIHZ7NSI6IJSEMQVC4O2TYENHO35ZTQC
WDXEPRDECMXMYQLE2OKS5IJLYCUAOEN4QWJJKHQTIS2R5M6XO3MAC
7DWHC7LK3XMI7JMAIM35ZEDZY5VLLPPASEGSGGEX36LN7RHBAUVAC
NUXZXM3D64JDAP7TVBAY23Z43RW27JL4XHVOEXFLT5CLDU6CVOOAC
IW4PWOFEACHZURMKN7U7P2ZDOFIXXGMKVUWI7TDFR7F33GVOEDZQC
TUZICZZDQKNR7ZJGOEFQ4LJZDA5H4UHG4ATBAQOBXLQNY2R6IO5QC
ZG4ZSADUTSYDTHKPP7UDK6ZR56SF76KLOWVXXYEYCYBXL66EUWUQC
KZMW4JDYUYSQHRZMLNL7EOVWYJWOI7L573QAL3KUMMMG6IWKBS6AC
trace!("WasmPool decided to spawn a new executor #{} for the current invocation.", self.n_executors);
trace!("WasmPool decided to spawn a new executor #{} for the current invocation.", self.executors.len());
warn!("Not actually doing anything, zhur_apst hasn't been implemented yet.");
}\
pub fn new(max_executors: usize, invoc_env_rx: Receiver<InvocEnv>) -> Self {
Self {
max_executors,
invoc_env_rx,
outstanding_invocations: Vec::new(),
executors: Vec::new()
}
}
/// Runs the `WasmPool` in a background thread.
pub fn run_as_thread(self) -> JoinHandle<()> {
std::thread::Builder::new()
.name("wasm_pool".to_owned())
.spawn(move || {
let mut pool = self;
loop {
let env = match pool.invoc_env_rx.recv() {
Ok(env) => env,
Err(_) => {
let text = "WasmPool could not receive incoming invocation envelope!";
error!("{}", text);
panic!("{}", text);
}
};
pool.handle(env);
}
})
.expect("Could not launch WasmPool thread!")
}
}\
}
fn handle_invoke_bytes(bytes: &[u8]) -> Result<HttpRes, InvocationError> {
match deserialize::<Invocation>(bytes) {
Ok(i) => handle_invocation(&i),
Err(_) => Err(InvocationError::MalformedRequest)
fn handle_invoke_bytes(&self, bytes: &[u8]) -> Result<Vec<u8>, InvocationError> {
let inv = match deserialize::<Invocation>(bytes) {
Ok(i) => i,
Err(_) => {
warn!("The bytes we got could not be deserialized to an Invocation.");
return Err(InvocationError::MalformedRequest)
}
};
trace!("Got an invocation for {}:{}", &inv.owner, &inv.app_name);
let env = (inv, self.reply_tx.clone());
self.invoc_env_tx.send(env)
.expect("Expected to be able to send an invocation envelope from the CoreServer");
let reply = self.reply_rx.recv().expect("Expected to be able to receive a Vec<u8> back from the WasmPool in the CoreServer");
Ok(reply)