pub struct CookbookWebState { /* private fields */ }Expand description
Cookbook state exposed by the WebUI route and JSON API.
Implementations§
Source§impl CookbookWebState
impl CookbookWebState
Sourcepub fn seeded() -> Result<Self>
pub fn seeded() -> Result<Self>
Build a WebUI state from the crate-shipped loadable-lib directory.
Sourcepub fn seeded_with_books(extra: &[(&str, EmbeddedDir)]) -> Result<Self>
pub fn seeded_with_books(extra: &[(&str, EmbeddedDir)]) -> Result<Self>
Build a WebUI state from the seeded directory plus host-injected books.
Host-injected books cover facade-level descriptor recipes that are above
sim-lib-cookbook in the dependency graph. They are projected on each
request after the dynamic loadable-lib directory reflects the live Cx.
Sourcepub fn from_loadable_libs(
directory: LoadableLibList,
diagnostics: Vec<String>,
) -> Self
pub fn from_loadable_libs( directory: LoadableLibList, diagnostics: Vec<String>, ) -> Self
Build a WebUI state from an effective loadable-lib directory.
Sourcepub fn store(&self, cx: &Cx) -> Result<RecipeStore>
pub fn store(&self, cx: &Cx) -> Result<RecipeStore>
Project a fresh cookbook store from the current runtime context.
Sourcepub fn handle_request(
&self,
method: &str,
target: &str,
cx: Option<&mut Cx>,
) -> CookbookWebResponse
pub fn handle_request( &self, method: &str, target: &str, cx: Option<&mut Cx>, ) -> CookbookWebResponse
Route one cookbook WebUI request.
target is an HTTP request target such as /api/cookbook?q=x. The run
endpoint requires a runtime context because it executes the same
sim-lib-cookbook recipe runner used by the runtime ops and CLI.