Module cedar_policy_core::transitive_closure
source · Expand description
Module containing code to compute the transitive closure of a graph. This is a generic utility, and not specific to Cedar.
Enums§
- Error type for errors raised during transitive closure computation. This error type is parametrized by a type
K
which is the type of a unique identifier for graph nodes and the type returned byget_key
on theTCNode
trait.
Traits§
- Trait used to generalize transitive closure computation. This trait should be implemented for types representing a node in the hierarchy (e.g., the entity hierarchy) where we need to compute the transitive closure of the hierarchy starting from only direct adjacencies. This trait is parametrized by a type
K
which represents a unique identifier for graph nodes.
Functions§
- Given Graph as a map from keys with type
K
to implementations ofTCNode
with typeV
, compute the transitive closure of the hierarchy. In case of error, the result contains an error structureErr<K>
which contains the keys (with typeK
) for the nodes in the graph which caused the error. Ifenforce_dag
then also check that the heirarchy is a DAG - Given a graph (as a map from keys to
TCNode
), enforce that all transitive edges are included, ie, the transitive closure has already been computed and that it is a DAG. If this is not the case, return an appropriateTCEnforcementError
.
Type Aliases§
- Type alias for convenience