pub trait LifecyclePlugin: Send + Sync {
// Required method
fn name(&self) -> &str;
// Provided methods
fn priority(&self) -> u32 { ... }
fn on_server_start(&self, _config_json: &str) -> Result<(), String> { ... }
fn on_server_stop(&self) -> Result<(), String> { ... }
fn on_request_complete(&self, _event_json: &str) -> Result<(), String> { ... }
fn on_cache_write(&self, _key: &str, _tags_json: &str) -> Result<(), String> { ... }
fn on_cache_invalidate(
&self,
_pattern: &str,
_count: u32,
) -> Result<(), String> { ... }
fn on_reload(&self) -> Result<(), String> { ... }
fn cleanup(&self) -> Result<(), String> { ... }
}Expand description
A plugin that receives notifications at key server lifecycle points.
Designed for both compile-time and WASM execution. All methods receive and return JSON strings for ABI compatibility. Lifecycle hooks fire asynchronously after the response is sent — they must not block the request path.
WASM plugins: fuel budgets are enforced per call (see types::fuel).
Required Methods§
Provided Methods§
Sourcefn on_server_start(&self, _config_json: &str) -> Result<(), String>
fn on_server_start(&self, _config_json: &str) -> Result<(), String>
Called once when the server starts, after all subsystems are initialized.
config_json contains this plugin’s config section from bext.config.toml.
Sourcefn on_server_stop(&self) -> Result<(), String>
fn on_server_stop(&self) -> Result<(), String>
Called when the server is shutting down gracefully.
Sourcefn on_request_complete(&self, _event_json: &str) -> Result<(), String>
fn on_request_complete(&self, _event_json: &str) -> Result<(), String>
Called after a request has been fully processed and the response sent.
event_json contains: path, method, status, cache_status,
render_time_us, tenant_id, site_id, encoding, is_bot.
Sourcefn on_cache_write(&self, _key: &str, _tags_json: &str) -> Result<(), String>
fn on_cache_write(&self, _key: &str, _tags_json: &str) -> Result<(), String>
Called after a new entry is stored in the ISR cache.
Sourcefn on_cache_invalidate(&self, _pattern: &str, _count: u32) -> Result<(), String>
fn on_cache_invalidate(&self, _pattern: &str, _count: u32) -> Result<(), String>
Called when ISR cache entries are invalidated.