Skip to main content

Transaction

Struct Transaction 

Source
pub struct Transaction<'graph, C = (), O = ()> { /* private fields */ }
Expand description

Staged canonical input transaction.

Implementations§

Source§

impl<C: 'static, O> Transaction<'_, C, O>
where O: Clone + PartialEq + 'static,

Source

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.

Source

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.

Source

pub fn rebaseline_output( &mut self, output: MaterializedOutput<O>, ) -> GraphResult<()>

Stages an explicit output rebaseline.

Source§

impl<C: 'static, O> Transaction<'_, C, O>
where O: Clone + PartialEq + 'static,

Source

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<()>
where K: Clone + Ord + Send + Sync + 'static, V: Clone + PartialEq + Send + Sync + 'static,

Stages a map-diff resource planner.

Source

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<()>
where K: Clone + Ord + Send + Sync + 'static,

Stages a set-diff resource planner.

Source§

impl<'graph, C, O> Transaction<'graph, C, O>
where O: Clone + PartialEq,

Source

pub fn id(&self) -> TransactionId

Returns this transaction’s id.

Source

pub fn set_input<T>(&mut self, input: InputNode<T>, value: T) -> GraphResult<()>
where T: Clone + PartialEq + Send + Sync + 'static,

Stages a typed canonical input change.

Source

pub fn set_input_by_id<T>(&mut self, node: NodeId, value: T) -> GraphResult<()>
where T: Clone + PartialEq + Send + Sync + 'static,

Stages a canonical input change by node id.

Source

pub fn commit(&mut self) -> GraphResult<TransactionResult<C, O>>

Commits staged input changes atomically.

Source§

impl<C: 'static, O> Transaction<'_, C, O>
where O: Clone + PartialEq + 'static,

Source

pub fn create_scope( &mut self, debug_name: impl Into<String>, ) -> GraphResult<ScopeId>

Stages creation of a root scope with no parent.

Source

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.

Source

pub fn close_scope(&mut self, scope: ScopeId) -> GraphResult<()>

Stages closing a scope for resource ownership teardown.

Source

pub fn input<T>( &mut self, debug_name: impl Into<String>, ) -> GraphResult<InputNode<T>>
where T: Clone + PartialEq + Send + Sync + 'static,

Stages creation of an input node.

Source

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>>
where T: Clone + PartialEq + Send + Sync + 'static,

Stages creation of a derived node with explicit dependencies.

Source

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>>
where K: Clone + Ord + Send + Sync + 'static, V: Clone + PartialEq + Send + Sync + 'static,

Stages creation of a map collection node with explicit dependencies.

Source

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>>
where K: Clone + Ord + Send + Sync + 'static, V: Clone + PartialEq + Send + Sync + 'static,

Stages creation of a map collection node with explicit dependencies.

Source

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, ()>>
where K: Clone + Ord + Send + Sync + 'static,

Stages creation of a set collection node with explicit dependencies.

Source

pub fn attach_node_to_scope( &mut self, node: impl NodeHandle, scope: ScopeId, ) -> GraphResult<()>

Stages attaching a node to an owning scope.

Trait Implementations§

Source§

impl<C, O> Drop for Transaction<'_, C, O>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<'graph, C = (), O = ()> !RefUnwindSafe for Transaction<'graph, C, O>

§

impl<'graph, C = (), O = ()> !UnwindSafe for Transaction<'graph, C, O>

§

impl<'graph, C, O> Freeze for Transaction<'graph, C, O>

§

impl<'graph, C, O> Send for Transaction<'graph, C, O>
where O: Send,

§

impl<'graph, C, O> Sync for Transaction<'graph, C, O>
where O: Sync,

§

impl<'graph, C, O> Unpin for Transaction<'graph, C, O>

§

impl<'graph, C, O> UnsafeUnpin for Transaction<'graph, C, O>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.