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

Method ready

src/controller/src/lib.rs:336–362  ·  view source on GitHub ↗

Waits until the controller is ready to process a response. This method may block for an arbitrarily long time. When the method returns, the owner should call [`Controller::ready`] to process the ready message. This method is cancellation safe.

(&mut self)

Source from the content-addressed store, hash-verified

334 ///
335 /// This method is cancellation safe.
336 pub async fn ready(&mut self) {
337 if let Readiness::NotReady = self.readiness {
338 // the coordinator wants to be able to make a simple
339 // sequence of ready, process, ready, process, .... calls,
340 // but the controller sometimes has responses immediately
341 // ready to be processed and should do so before calling
342 // into either of the lower-level controllers. This `if`
343 // statement handles that case.
344 if let Some(response) = self.take_internal_response() {
345 self.readiness = Readiness::Internal(response);
346 } else {
347 // The underlying `ready` methods are cancellation safe, so it is
348 // safe to construct this `select!`.
349 tokio::select! {
350 () = self.storage.ready() => {
351 self.readiness = Readiness::Storage;
352 }
353 () = self.compute.ready() => {
354 self.readiness = Readiness::Compute;
355 }
356 Some(metrics) = self.metrics_rx.recv() => {
357 self.readiness = Readiness::Metrics(metrics);
358 }
359 }
360 }
361 }
362 }
363
364 /// Returns the [Readiness] status of this controller.
365 pub fn get_readiness(&self) -> &Readiness {

Callers 1

test_requestFunction · 0.45

Calls 1

Tested by 1

test_requestFunction · 0.36