pub trait HandlerState:
'static
+ Sync
+ Send {
type StoreData: Send;
// Required methods
fn new_store(
&self,
req_id: Option<u64>,
) -> Result<StoreBundle<Self::StoreData>>;
fn request_timeout(&self) -> Duration;
fn idle_instance_timeout(&self) -> Duration;
fn max_instance_reuse_count(&self) -> usize;
fn max_instance_concurrent_reuse_count(&self) -> usize;
fn handle_worker_error(&self, error: Error);
}component-model-async only.Expand description
Represents the application-specific state of a web server.
Required Associated Types§
Required Methods§
Sourcefn new_store(&self, req_id: Option<u64>) -> Result<StoreBundle<Self::StoreData>>
fn new_store(&self, req_id: Option<u64>) -> Result<StoreBundle<Self::StoreData>>
Create a new Store for handling one or more requests.
The req_id parameter is the value passed in the call to
ProxyHandler::spawn that created the worker to which the new Store
will belong. See that function’s documentation for details.
Sourcefn request_timeout(&self) -> Duration
fn request_timeout(&self) -> Duration
Maximum time allowed to handle a request.
In practice, a guest may be allowed to run up to 2x this time in the case of instance reuse to avoid penalizing concurrent requests being handled by the same instance.
Sourcefn idle_instance_timeout(&self) -> Duration
fn idle_instance_timeout(&self) -> Duration
Maximum time to keep an idle instance around before dropping it.
Sourcefn max_instance_reuse_count(&self) -> usize
fn max_instance_reuse_count(&self) -> usize
Maximum number of requests to handle using a single instance before dropping it.
Sourcefn max_instance_concurrent_reuse_count(&self) -> usize
fn max_instance_concurrent_reuse_count(&self) -> usize
Maximum number of requests to handle concurrently using a single instance.
Sourcefn handle_worker_error(&self, error: Error)
fn handle_worker_error(&self, error: Error)
Called when a worker exits with an error.