MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / build_fallible

Method build_fallible

src/timely-util/src/builder_async.rs:685–712  ·  view source on GitHub ↗

Creates a fallible operator implementation from supplied logic constructor. If the `Future` resolves to an error it will be emitted in the returned error stream and then the operator will wait indefinitely until the shutdown button is pressed. # Capability handling Unlike [`OperatorBuilder::build`], this method does not give owned capabilities to the constructor. All initial capabilities are wra

(
        mut self,
        constructor: F,
    )

Source from the content-addressed store, hash-verified

683 /// }));
684 /// ```
685 pub fn build_fallible<E: 'static, F>(
686 mut self,
687 constructor: F,
688 ) -> (Button, StreamVec<'scope, T, Rc<E>>)
689 where
690 F: for<'a> FnOnce(
691 &'a mut [CapabilitySet<T>],
692 ) -> Pin<Box<dyn Future<Output = Result<(), E>> + 'a>>
693 + 'static,
694 {
695 // Create a new completely disconnected output
696 let (error_output, error_stream) = self.new_output::<CapacityContainerBuilder<_>>();
697 let button = self.build(|mut caps| async move {
698 let error_cap = caps.pop().unwrap();
699 let mut caps = caps
700 .into_iter()
701 .map(CapabilitySet::from_elem)
702 .collect::<Vec<_>>();
703 if let Err(err) = constructor(&mut *caps).await {
704 error_output.give(&error_cap, Rc::new(err));
705 drop(error_cap);
706 // IMPORTANT: wedge this operator until the button is pressed. Returning would drop
707 // the capabilities and could produce incorrect progress statements.
708 std::future::pending().await
709 }
710 });
711 (button, error_stream)
712 }
713
714 /// Creates operator info for the operator.
715 pub fn operator_info(&self) -> OperatorInfo {

Callers 12

render_decode_delimitedFunction · 0.80
sink_collectionFunction · 0.80
encode_collectionFunction · 0.80
mint_batch_descriptionsFunction · 0.80
write_data_filesFunction · 0.80
commit_to_icebergFunction · 0.80
renderFunction · 0.80
renderFunction · 0.80
renderFunction · 0.80
renderFunction · 0.80
renderFunction · 0.80
append_batchesFunction · 0.80

Calls 6

unwrapMethod · 0.80
buildMethod · 0.45
popMethod · 0.45
mapMethod · 0.45
into_iterMethod · 0.45
giveMethod · 0.45

Tested by

no test coverage detected