pub struct ResourceInstanceWrapperCore {
pub graph_id: String,
pub resource_instance: Option<StaticResourceMetadata>,
pub tiles: Option<HashMap<String, StaticTile>>,
pub nodegroup_index: HashMap<String, Vec<String>>,
pub loaded_nodegroups: Arc<Mutex<HashMap<String, LoadState>>>,
pub pseudo_cache: Arc<Mutex<HashMap<String, PseudoListCore>>>,
pub cached_nodes: Option<Arc<HashMap<String, Arc<StaticNode>>>>,
pub cached_edges: Option<Arc<HashMap<String, Vec<String>>>>,
pub cached_reverse_edges: Option<Arc<HashMap<String, Vec<String>>>>,
pub cached_nodes_by_nodegroup: Option<Arc<HashMap<String, Vec<Arc<StaticNode>>>>>,
pub cached_nodegroups: Option<Arc<HashMap<String, Arc<StaticNodegroup>>>>,
}Expand description
Core resource instance wrapper - platform-agnostic business logic
Contains all tile storage, indexing, and business logic.
Used by NAPI and Python bindings. WASM has a parallel copy in
alizarin-wasm::instance_wrapper::ResourceInstanceWrapperCore that uses
Rc
TODO(priority): Unify the WASM copy with this struct so methods like set_tile_data_for_node don’t need to be maintained in two places.
Fields§
§graph_id: StringGraph ID to look up model
resource_instance: Option<StaticResourceMetadata>Resource metadata
tiles: Option<HashMap<String, StaticTile>>Tile storage (tileid -> tile)
nodegroup_index: HashMap<String, Vec<String>>Index: nodegroup_id -> list of tile_ids
loaded_nodegroups: Arc<Mutex<HashMap<String, LoadState>>>Track which nodegroups have been loaded/loading
pseudo_cache: Arc<Mutex<HashMap<String, PseudoListCore>>>Cache of PseudoValues (alias -> PseudoListCore)
cached_nodes: Option<Arc<HashMap<String, Arc<StaticNode>>>>Cached model indices - avoids repeated lookups
cached_edges: Option<Arc<HashMap<String, Vec<String>>>>§cached_reverse_edges: Option<Arc<HashMap<String, Vec<String>>>>§cached_nodes_by_nodegroup: Option<Arc<HashMap<String, Vec<Arc<StaticNode>>>>>§cached_nodegroups: Option<Arc<HashMap<String, Arc<StaticNodegroup>>>>Implementations§
Source§impl ResourceInstanceWrapperCore
impl ResourceInstanceWrapperCore
Sourcepub fn set_cached_indices(&mut self, model: &dyn ModelAccess)
pub fn set_cached_indices(&mut self, model: &dyn ModelAccess)
Set cached model indices from a ModelAccess implementation
Sourcepub fn load_tiles(&mut self, tiles: Vec<StaticTile>)
pub fn load_tiles(&mut self, tiles: Vec<StaticTile>)
Load tiles into the wrapper
Sourcepub fn get_tile(&self, tile_id: &str) -> Option<&StaticTile>
pub fn get_tile(&self, tile_id: &str) -> Option<&StaticTile>
Get a tile by ID
Sourcepub fn set_tile_data_for_node(
&mut self,
tile_id: &str,
node_id: &str,
value: Value,
) -> bool
pub fn set_tile_data_for_node( &mut self, tile_id: &str, node_id: &str, value: Value, ) -> bool
Set a single node’s data in a tile, mutating in place. Returns true if the tile was found and updated, false otherwise.
Sourcepub fn get_tiles_for_nodegroup(&self, nodegroup_id: &str) -> Vec<&StaticTile>
pub fn get_tiles_for_nodegroup(&self, nodegroup_id: &str) -> Vec<&StaticTile>
Get tiles for a nodegroup
Sourcepub fn is_nodegroup_loaded(&self, nodegroup_id: &str) -> bool
pub fn is_nodegroup_loaded(&self, nodegroup_id: &str) -> bool
Check if a nodegroup is loaded
Sourcepub fn mark_nodegroup_loaded(&self, nodegroup_id: &str)
pub fn mark_nodegroup_loaded(&self, nodegroup_id: &str)
Mark a nodegroup as loaded
Sourcepub fn get_cached_pseudo(&self, alias: &str) -> Option<PseudoListCore>
pub fn get_cached_pseudo(&self, alias: &str) -> Option<PseudoListCore>
Get a cached pseudo list by alias
Sourcepub fn store_pseudo(&self, alias: String, pseudo_list: PseudoListCore)
pub fn store_pseudo(&self, alias: String, pseudo_list: PseudoListCore)
Store a pseudo list in the cache
Sourcepub fn values_from_resource_nodegroup(
&self,
existing_values: &HashMap<String, Option<bool>>,
nodegroup_tile_ids: &[String],
nodegroup_id: &str,
model: &dyn ModelAccess,
) -> Result<ValuesFromNodegroupResult, SemanticChildError>
pub fn values_from_resource_nodegroup( &self, existing_values: &HashMap<String, Option<bool>>, nodegroup_tile_ids: &[String], nodegroup_id: &str, model: &dyn ModelAccess, ) -> Result<ValuesFromNodegroupResult, SemanticChildError>
Build pseudo values from tiles for a nodegroup.
Delegates to the standalone values_from_resource_nodegroup function,
passing this wrapper’s tile store.
Sourcepub fn ensure_nodegroup(
&self,
all_values_map: &HashMap<String, Option<bool>>,
all_nodegroups: &mut HashMap<String, bool>,
nodegroup_id: &str,
add_if_missing: bool,
nodegroup_permissions: &HashMap<String, PermissionRule>,
do_implied_nodegroups: bool,
model: &dyn ModelAccess,
) -> Result<EnsureNodegroupResult, SemanticChildError>
pub fn ensure_nodegroup( &self, all_values_map: &HashMap<String, Option<bool>>, all_nodegroups: &mut HashMap<String, bool>, nodegroup_id: &str, add_if_missing: bool, nodegroup_permissions: &HashMap<String, PermissionRule>, do_implied_nodegroups: bool, model: &dyn ModelAccess, ) -> Result<EnsureNodegroupResult, SemanticChildError>
Process a single nodegroup and return structured values.
Delegates to the standalone ensure_nodegroup function,
passing this wrapper’s tile store.
Sourcepub fn populate(
&self,
lazy: bool,
nodegroup_ids: &[String],
root_node_alias: &str,
model: &dyn ModelAccess,
) -> Result<PopulateResult, SemanticChildError>
pub fn populate( &self, lazy: bool, nodegroup_ids: &[String], root_node_alias: &str, model: &dyn ModelAccess, ) -> Result<PopulateResult, SemanticChildError>
Main populate implementation
Orchestrates loading all nodegroups for a resource.
Sourcepub fn get_semantic_child_value(
&self,
parent_tile_id: Option<&String>,
parent_node_id: &str,
parent_nodegroup_id: Option<&String>,
child_alias: &str,
model: &dyn ModelAccess,
) -> Result<SemanticChildResult, SemanticChildError>
pub fn get_semantic_child_value( &self, parent_tile_id: Option<&String>, parent_node_id: &str, parent_nodegroup_id: Option<&String>, child_alias: &str, model: &dyn ModelAccess, ) -> Result<SemanticChildResult, SemanticChildError>
Get semantic child values for a given parent node and child alias
Sourcepub fn resolve_path(
&self,
path: &str,
model: &dyn ModelAccess,
) -> Result<PathResolutionInfo, PathError>
pub fn resolve_path( &self, path: &str, model: &dyn ModelAccess, ) -> Result<PathResolutionInfo, PathError>
Resolve a dot-separated path through the graph model.
Walks the graph edges matching node aliases at each segment, returning the target node’s metadata and nodegroup ID.
Sourcepub fn resolve_and_filter_tiles(
&self,
path: &str,
model: &dyn ModelAccess,
filter_tile_id: Option<&str>,
) -> Result<(PathResolutionInfo, Vec<StaticTile>), PathError>
pub fn resolve_and_filter_tiles( &self, path: &str, model: &dyn ModelAccess, filter_tile_id: Option<&str>, ) -> Result<(PathResolutionInfo, Vec<StaticTile>), PathError>
Resolve a path and return the resolution info plus matching tiles.
Delegates to the standalone resolve_and_filter_tiles function,
passing this wrapper’s tile store and nodegroup index.
Sourcepub fn get_values_at_path(
&self,
path: &str,
model: &dyn ModelAccess,
filter_tile_id: Option<&str>,
) -> Result<PseudoListCore, PathError>
pub fn get_values_at_path( &self, path: &str, model: &dyn ModelAccess, filter_tile_id: Option<&str>, ) -> Result<PseudoListCore, PathError>
Resolve a dot-separated path and return a PseudoListCore for the target node.
This is the main entry point for path-based value access. It walks the graph model to find the target node, then retrieves matching tiles from the store and builds a PseudoListCore — all without materializing the full tree.
If filter_tile_id is provided, only tiles that match the parent-child
relationship for that tile are included (using matches_semantic_child).