NUXZXM3D64JDAP7TVBAY23Z43RW27JL4XHVOEXFLT5CLDU6CVOOAC
Q5GUHJ4O6GNSL23U77Y3HR2WW7V3LTYVHXPKOMJY76JKIZUU5YWQC
AGX35J5GL7C33UWYITQZEP6QRYBUTFJV3ANW6YMEMZ6WVWG7ZLXAC
BMWVMVJ527SZSVE7VKP5IAAOKNZPAFJ2RKQKXHWU7QTOX4OZUPHQC
6LABQWDWWQUEDTXZBKETGLG65FZ66FJLLY5IW3IFCMYJUO65Q4BAC
WGQH6HZG7HZNKJYKXV6DACDXMPRA6YPXBPA6BOHZDMGVF2DLBQ6QC
DIIDKMIXQENUQIOIFHT62KAX4WL5MJWEB5BXHGUYCDSKIPRQVPOAC
QUPSHDL6MQBVCRQPZ3O7MMG27FJYCASSOWN6LI6X5K3VOL7TCAVAC
KZMW4JDYUYSQHRZMLNL7EOVWYJWOI7L573QAL3KUMMMG6IWKBS6AC
WXLXWHPVYBBSZ76TUABERVLQAN26QTZLF6NGZZMB56FUTCLPSB4QC
use zhur_common::msg::chan::HandleRequest;
use zhur_common::log::*;
use zhur_invk::{HttpRes, Invocation, InvocationError};
/// Wasm executor pool.
pub mod pool;\
use zhur_common::flume::Receiver;
use zhur_common::msg::chan::Envelope;
use zhur_invk::{HttpRes, Invocation, InvocationError};
type InvocEnv = Envelope<Invocation, Result<HttpRes, InvocationError>>;
/// The "WASM executor pool" keeps track of WASM executors and distributes invocations among them.
pub struct WasmPool {
/// This receiver handles incoming invocations to be passed out to executors.
invoc_env_rx: Receiver<InvocEnv>,
/// This is where invocations that can't be handled right away get put.
outstanding_invocations: Vec<InvocEnv>,
/// How many executors are currently active.
n_executors: usize,
/// How many executors can be running at one time.
max_executors: usize,
}\
/// Abstraction for an "envelope" pattern, in which we send some type `T` to another thread and expect to get a `U` back.
/// `T` and `U` must be `Send`.
pub type Envelope<T, U> = (T, Sender<U>);
/// Shorthand for generating a pair of `Envelope` channels.
pub fn envelope_pair<U: Send, T: Send>() -> (Sender<Envelope<T, U>>, Receiver<Envelope<T, U>>) {
unbounded()
}