pub struct Transaction<'graph, C = (), O = ()> { /* private fields */ }Expand description
Staged canonical input transaction.
Implementations§
Source§impl<C: 'static, O> Transaction<'_, C, O>
impl<C: 'static, O> Transaction<'_, C, O>
Sourcepub fn materialized_output(
&mut self,
debug_name: impl Into<String>,
scope: ScopeId,
dependencies: DependencyList,
materialize: impl for<'ctx> Fn(&OutputContext<'ctx, C, O>) -> Result<O, OutputError> + Send + Sync + 'static,
) -> GraphResult<MaterializedOutput<O>>
pub fn materialized_output( &mut self, debug_name: impl Into<String>, scope: ScopeId, dependencies: DependencyList, materialize: impl for<'ctx> Fn(&OutputContext<'ctx, C, O>) -> Result<O, OutputError> + Send + Sync + 'static, ) -> GraphResult<MaterializedOutput<O>>
Stages creation of a materialized output with default options.
Sourcepub fn materialized_output_with_options(
&mut self,
debug_name: impl Into<String>,
scope: ScopeId,
dependencies: DependencyList,
options: OutputOptions,
materialize: impl for<'ctx> Fn(&OutputContext<'ctx, C, O>) -> Result<O, OutputError> + Send + Sync + 'static,
) -> GraphResult<MaterializedOutput<O>>
pub fn materialized_output_with_options( &mut self, debug_name: impl Into<String>, scope: ScopeId, dependencies: DependencyList, options: OutputOptions, materialize: impl for<'ctx> Fn(&OutputContext<'ctx, C, O>) -> Result<O, OutputError> + Send + Sync + 'static, ) -> GraphResult<MaterializedOutput<O>>
Stages creation of a materialized output with explicit options.
Sourcepub fn rebaseline_output(
&mut self,
output: MaterializedOutput<O>,
) -> GraphResult<()>
pub fn rebaseline_output( &mut self, output: MaterializedOutput<O>, ) -> GraphResult<()>
Stages an explicit output rebaseline.
Source§impl<C: 'static, O> Transaction<'_, C, O>
impl<C: 'static, O> Transaction<'_, C, O>
Sourcepub fn map_resource_planner<K, V>(
&mut self,
collection: CollectionNode<K, V>,
scope: ScopeId,
planner: impl for<'ctx> Fn(&PlanContext<'ctx, MapDiff<K, V>>) -> Result<ResourcePlan<C>, PlanError> + Send + Sync + 'static,
) -> GraphResult<()>
pub fn map_resource_planner<K, V>( &mut self, collection: CollectionNode<K, V>, scope: ScopeId, planner: impl for<'ctx> Fn(&PlanContext<'ctx, MapDiff<K, V>>) -> Result<ResourcePlan<C>, PlanError> + Send + Sync + 'static, ) -> GraphResult<()>
Stages a map-diff resource planner.
Sourcepub fn set_resource_planner<K>(
&mut self,
collection: CollectionNode<K, ()>,
scope: ScopeId,
planner: impl for<'ctx> Fn(&PlanContext<'ctx, SetDiff<K>>) -> Result<ResourcePlan<C>, PlanError> + Send + Sync + 'static,
) -> GraphResult<()>
pub fn set_resource_planner<K>( &mut self, collection: CollectionNode<K, ()>, scope: ScopeId, planner: impl for<'ctx> Fn(&PlanContext<'ctx, SetDiff<K>>) -> Result<ResourcePlan<C>, PlanError> + Send + Sync + 'static, ) -> GraphResult<()>
Stages a set-diff resource planner.
Source§impl<'graph, C, O> Transaction<'graph, C, O>
impl<'graph, C, O> Transaction<'graph, C, O>
Sourcepub fn id(&self) -> TransactionId
pub fn id(&self) -> TransactionId
Returns this transaction’s id.
Sourcepub fn set_input<T>(&mut self, input: InputNode<T>, value: T) -> GraphResult<()>
pub fn set_input<T>(&mut self, input: InputNode<T>, value: T) -> GraphResult<()>
Stages a typed canonical input change.
Sourcepub fn set_input_by_id<T>(&mut self, node: NodeId, value: T) -> GraphResult<()>
pub fn set_input_by_id<T>(&mut self, node: NodeId, value: T) -> GraphResult<()>
Stages a canonical input change by node id.
Sourcepub fn commit(&mut self) -> GraphResult<TransactionResult<C, O>>
pub fn commit(&mut self) -> GraphResult<TransactionResult<C, O>>
Commits staged input changes atomically.
Source§impl<C: 'static, O> Transaction<'_, C, O>
impl<C: 'static, O> Transaction<'_, C, O>
Sourcepub fn create_scope(
&mut self,
debug_name: impl Into<String>,
) -> GraphResult<ScopeId>
pub fn create_scope( &mut self, debug_name: impl Into<String>, ) -> GraphResult<ScopeId>
Stages creation of a root scope with no parent.
Sourcepub fn create_scope_with_parent(
&mut self,
debug_name: impl Into<String>,
parent: Option<ScopeId>,
) -> GraphResult<ScopeId>
pub fn create_scope_with_parent( &mut self, debug_name: impl Into<String>, parent: Option<ScopeId>, ) -> GraphResult<ScopeId>
Stages creation of a scope with an optional parent.
Sourcepub fn close_scope(&mut self, scope: ScopeId) -> GraphResult<()>
pub fn close_scope(&mut self, scope: ScopeId) -> GraphResult<()>
Stages closing a scope for resource ownership teardown.
Sourcepub fn input<T>(
&mut self,
debug_name: impl Into<String>,
) -> GraphResult<InputNode<T>>
pub fn input<T>( &mut self, debug_name: impl Into<String>, ) -> GraphResult<InputNode<T>>
Stages creation of an input node.
Sourcepub fn derived<T>(
&mut self,
debug_name: impl Into<String>,
dependencies: DependencyList,
derive: impl for<'ctx> Fn(&DeriveContext<'ctx, C, O>) -> Result<T, DeriveError> + Send + Sync + 'static,
) -> GraphResult<DerivedNode<T>>
pub fn derived<T>( &mut self, debug_name: impl Into<String>, dependencies: DependencyList, derive: impl for<'ctx> Fn(&DeriveContext<'ctx, C, O>) -> Result<T, DeriveError> + Send + Sync + 'static, ) -> GraphResult<DerivedNode<T>>
Stages creation of a derived node with explicit dependencies.
Sourcepub fn collection<K, V>(
&mut self,
debug_name: impl Into<String>,
dependencies: DependencyList,
derive: impl for<'ctx> Fn(&CollectionContext<'ctx, C, O>) -> Result<BTreeMap<K, V>, DeriveError> + Send + Sync + 'static,
) -> GraphResult<CollectionNode<K, V>>
pub fn collection<K, V>( &mut self, debug_name: impl Into<String>, dependencies: DependencyList, derive: impl for<'ctx> Fn(&CollectionContext<'ctx, C, O>) -> Result<BTreeMap<K, V>, DeriveError> + Send + Sync + 'static, ) -> GraphResult<CollectionNode<K, V>>
Stages creation of a map collection node with explicit dependencies.
Sourcepub fn map_collection<K, V>(
&mut self,
debug_name: impl Into<String>,
dependencies: DependencyList,
derive: impl for<'ctx> Fn(&CollectionContext<'ctx, C, O>) -> Result<BTreeMap<K, V>, DeriveError> + Send + Sync + 'static,
) -> GraphResult<CollectionNode<K, V>>
pub fn map_collection<K, V>( &mut self, debug_name: impl Into<String>, dependencies: DependencyList, derive: impl for<'ctx> Fn(&CollectionContext<'ctx, C, O>) -> Result<BTreeMap<K, V>, DeriveError> + Send + Sync + 'static, ) -> GraphResult<CollectionNode<K, V>>
Stages creation of a map collection node with explicit dependencies.
Sourcepub fn set_collection<K>(
&mut self,
debug_name: impl Into<String>,
dependencies: DependencyList,
derive: impl for<'ctx> Fn(&CollectionContext<'ctx, C, O>) -> Result<BTreeSet<K>, DeriveError> + Send + Sync + 'static,
) -> GraphResult<CollectionNode<K, ()>>
pub fn set_collection<K>( &mut self, debug_name: impl Into<String>, dependencies: DependencyList, derive: impl for<'ctx> Fn(&CollectionContext<'ctx, C, O>) -> Result<BTreeSet<K>, DeriveError> + Send + Sync + 'static, ) -> GraphResult<CollectionNode<K, ()>>
Stages creation of a set collection node with explicit dependencies.
Sourcepub fn attach_node_to_scope(
&mut self,
node: impl NodeHandle,
scope: ScopeId,
) -> GraphResult<()>
pub fn attach_node_to_scope( &mut self, node: impl NodeHandle, scope: ScopeId, ) -> GraphResult<()>
Stages attaching a node to an owning scope.