chore: add is_initialized method for frontend client (#7409)

chore: add `is_initialized` for frontend client
This commit is contained in:
fys
2025-12-15 20:51:09 +08:00
committed by GitHub
parent 0c52d5bb34
commit 913ac325e5

View File

@@ -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<MetaClient>,
auth: Option<FlowAuthHeader>,