From 913ac325e598badff6cba795d2675fa0598cd91c Mon Sep 17 00:00:00 2001 From: fys <40801205+fengys1996@users.noreply.github.com> Date: Mon, 15 Dec 2025 20:51:09 +0800 Subject: [PATCH] chore: add `is_initialized` method for frontend client (#7409) chore: add `is_initialized` for frontend client --- src/flow/src/batching_mode/frontend_client.rs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/flow/src/batching_mode/frontend_client.rs b/src/flow/src/batching_mode/frontend_client.rs index d79c3033e3..174fa25671 100644 --- a/src/flow/src/batching_mode/frontend_client.rs +++ b/src/flow/src/batching_mode/frontend_client.rs @@ -110,6 +110,26 @@ impl FrontendClient { ) } + /// Check if the frontend client is initialized. + /// + /// In distributed mode, it is always initialized. + /// In standalone mode, it checks if the database client is set. + pub fn is_initialized(&self) -> bool { + match self { + FrontendClient::Distributed { .. } => true, + FrontendClient::Standalone { + database_client, .. + } => { + let guard = database_client.lock(); + if let Ok(guard) = guard { + guard.is_some() + } else { + false + } + } + } + } + pub fn from_meta_client( meta_client: Arc, auth: Option,