pub struct PluginPolicyTable {
pub policies: HashMap<String, PluginHttpPolicy>,
}Expand description
Operator-owned policy table keyed by .wasm file stem. Built at
boot from <config_dir>/wasm/policy.json and looked up by the
daemon’s wasm loader when constructing per-plugin host state.
Fields§
§policies: HashMap<String, PluginHttpPolicy>Implementations§
Source§impl PluginPolicyTable
impl PluginPolicyTable
pub fn new() -> Self
Sourcepub fn from_json(s: &str) -> Result<Self, Error>
pub fn from_json(s: &str) -> Result<Self, Error>
Parse a policy.json whose top-level shape is
{ "<stem>": { ...PluginHttpPolicy fields... } }. Missing
fields per entry resolve to PluginHttpPolicy::default
values via serde defaults.
§Errors
Returns Error::compile when the JSON is malformed or any
entry fails to deserialize as PluginHttpPolicy.
Sourcepub fn load_from_dir(wasm_dir: &Path) -> Result<Self, Error>
pub fn load_from_dir(wasm_dir: &Path) -> Result<Self, Error>
Load <wasm_dir>/policy.json into a PluginPolicyTable.
Returns PluginPolicyTable::default (empty table) when the
file is absent. Surfaces parse errors verbatim.
§Errors
Returns Error::compile when the file exists but cannot be
read or parsed.
Sourcepub fn get_or_default(&self, stem: &str) -> PluginHttpPolicy
pub fn get_or_default(&self, stem: &str) -> PluginHttpPolicy
Get the policy for a plugin by file stem, or
PluginHttpPolicy::default when absent.
Trait Implementations§
Source§impl Clone for PluginPolicyTable
impl Clone for PluginPolicyTable
Source§fn clone(&self) -> PluginPolicyTable
fn clone(&self) -> PluginPolicyTable
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more