pub struct Graph<'a> { /* private fields */ }Expand description
Graph is a structure that holds the relational information between products, and has methods to add products to the relational graph
Implementations§
Source§impl<'a> Graph<'a>
impl<'a> Graph<'a>
Sourcepub fn new(db: &'a DB) -> Graph<'_>
pub fn new(db: &'a DB) -> Graph<'_>
Created a new graph that will be associated with the specified database
Sourcepub fn get_name(&self, number: NodeIndex<DefaultIx>) -> String
pub fn get_name(&self, number: NodeIndex<DefaultIx>) -> String
Resolves the index of a graph node into a string of the product name at that node
Sourcepub fn add_or_update_product(&mut self, name: String, node_type: NodeType)
pub fn add_or_update_product(&mut self, name: String, node_type: NodeType)
Add a product to the graph, or update the node type of that product if it already exists
Sourcepub fn has_product(&self, name: &String) -> bool
pub fn has_product(&self, name: &String) -> bool
Checks if the graph contains a given product
Sourcepub fn product_versions(&self, name: &String) -> Vec<&String>
pub fn product_versions(&self, name: &String) -> Vec<&String>
Returns all the different versions of a product that the graph describes. I.E. different nodes in the graph may point to a given product as a dependency with different version of that dependency listed as a requirement
Sourcepub fn is_optional(&self, name: &String) -> bool
pub fn is_optional(&self, name: &String) -> bool
Determines if a given node is listed as an optional node in the graph
Sourcepub fn connect_products(
&mut self,
source: &String,
target: &String,
version: String,
) -> Result<(), &str>
pub fn connect_products( &mut self, source: &String, target: &String, version: String, ) -> Result<(), &str>
Connects two products (nodes) in the graph together with a specific version. Note that this is a directional graph so the version requirement will point from the source to the target node
Sourcepub fn add_product_by_tag(
&mut self,
product: String,
tag: &Vec<&String>,
version_type: VersionType,
node_type: NodeType,
recurse: bool,
)
pub fn add_product_by_tag( &mut self, product: String, tag: &Vec<&String>, version_type: VersionType, node_type: NodeType, recurse: bool, )
Add a product to the graph specified by a given tag. This tag is looked up in the database associated with this graph and resolved into a table file. Optionally add in the dependencies from the table file if recurse is true
Sourcepub fn add_product_by_version(
&mut self,
product: String,
version: String,
version_type: VersionType,
node_type: NodeType,
recurse: bool,
)
pub fn add_product_by_version( &mut self, product: String, version: String, version_type: VersionType, node_type: NodeType, recurse: bool, )
Add a product to the graph specified by a given version. This version is looked up in the database associated with this graph and resolved into a table file. Optionally add in the dependencies from the table file if recurse is true