pub struct PluginContext {Show 20 fields
pub request_headers: Vec<(String, String)>,
pub response_headers: Vec<(String, String)>,
pub request_body: Vec<u8>,
pub response_body: Vec<u8>,
pub plugin_config: Vec<u8>,
pub vm_config: Vec<u8>,
pub action: u32,
pub local_response: Option<LocalResponse>,
pub logs: Vec<(u32, String)>,
pub shared_data: Arc<Mutex<SharedData>>,
pub pending_callouts: Vec<PendingCallout>,
pub callout_token_counter: u32,
pub callout_response_headers: Vec<(String, String)>,
pub callout_response_body: Vec<u8>,
pub metrics: HashMap<String, PluginMetric>,
pub current_context_id: u32,
pub effective_context_id: u32,
pub done: bool,
pub memory_used: usize,
pub memory_cap: usize,
/* private fields */
}Expand description
The per-instance context the host imports read from and write to.
Stored as the wasmtime store’s T type. The host import functions
receive a &mut PluginContext via Caller and use it to exchange
data with the plugin.
Fields§
§request_headers: Vec<(String, String)>Request headers (set by the host before proxy_on_request_headers).
response_headers: Vec<(String, String)>Response headers (set by the host before proxy_on_response_headers).
request_body: Vec<u8>Request body (set by the host before proxy_on_request_body).
response_body: Vec<u8>Response body (set by the host before proxy_on_response_body).
plugin_config: Vec<u8>Plugin configuration (passed to proxy_on_configure).
vm_config: Vec<u8>VM configuration (passed to proxy_on_vm_start).
action: u32The action the plugin returned from the last phase callback.
local_response: Option<LocalResponse>Whether the plugin has called proxy_send_http_response (a
short-circuit response). When set, the host should stop
processing and return the stored response.
logs: Vec<(u32, String)>Log lines emitted by the plugin via proxy_log.
The VM-scoped shared-data store handle (see SharedData).
pending_callouts: Vec<PendingCallout>Callouts registered by proxy_http_call and not yet answered
(DW-167). One instance can queue several; the dispatch driver
performs them in FIFO order, one round each.
callout_token_counter: u32Monotonic callout-token counter (tokens are handed out by the
host and delivered back with proxy_on_http_call_response).
callout_response_headers: Vec<(String, String)>The last delivered callout response’s header map (:status
plus ordinary headers, hop-by-hop stripped) — what MapType 6
reads return inside proxy_on_http_call_response.
callout_response_body: Vec<u8>The last delivered callout response’s body — what BufferType 4
reads return inside proxy_on_http_call_response.
metrics: HashMap<String, PluginMetric>Metrics registered by the plugin.
current_context_id: u32The current context ID (set by the host before calling exports).
effective_context_id: u32The effective context ID (set by proxy_set_effective_context).
done: boolWhether proxy_done was called.
memory_used: usizeMemory limiter state (tracks current allocation against the cap).
memory_cap: usizeMemory cap in bytes.
Trait Implementations§
Source§impl ResourceLimiter for PluginContext
The memory cap for a plugin instance, enforced via wasmtime’s
ResourceLimiter trait on the store’s user data (PluginContext).
impl ResourceLimiter for PluginContext
The memory cap for a plugin instance, enforced via wasmtime’s
ResourceLimiter trait on the store’s user data (PluginContext).
Source§fn memory_growing(
&mut self,
_current: usize,
desired: usize,
_maximum: Option<usize>,
) -> Result<bool>
fn memory_growing( &mut self, _current: usize, desired: usize, _maximum: Option<usize>, ) -> Result<bool>
Source§fn table_growing(
&mut self,
_current: usize,
desired: usize,
_maximum: Option<usize>,
) -> Result<bool>
fn table_growing( &mut self, _current: usize, desired: usize, _maximum: Option<usize>, ) -> Result<bool>
§fn memory_grow_failed(&mut self, error: Error) -> Result<(), Error>
fn memory_grow_failed(&mut self, error: Error) -> Result<(), Error>
memory_growing method, has failed. Read more§fn table_grow_failed(&mut self, error: Error) -> Result<(), Error>
fn table_grow_failed(&mut self, error: Error) -> Result<(), Error>
table_growing method, has failed. Read moreAuto Trait Implementations§
impl Freeze for PluginContext
impl RefUnwindSafe for PluginContext
impl Send for PluginContext
impl Sync for PluginContext
impl Unpin for PluginContext
impl UnwindSafe for PluginContext
Blanket Implementations§
§impl<T> AnyExt for T
impl<T> AnyExt for T
§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
T behind reference§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
T behind mutable reference§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
T behind Rc pointer§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
T behind Arc pointer§fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
T behind Box pointer§fn downcast_move<T>(this: Self) -> Option<T>
fn downcast_move<T>(this: Self) -> Option<T>
Self to T,
useful only in generic context as a workaround for specializationSource§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more