mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-10 15:22:56 +00:00
feat: return metasrv leader addr (#2110)
This commit is contained in:
@@ -210,7 +210,7 @@ impl MetaClient {
|
||||
|
||||
/// Ask the leader address of `metasrv`, and the heartbeat component
|
||||
/// needs to create a bidirectional streaming to the leader.
|
||||
pub async fn ask_leader(&self) -> Result<()> {
|
||||
pub async fn ask_leader(&self) -> Result<String> {
|
||||
self.heartbeat_client()?.ask_leader().await
|
||||
}
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ impl Client {
|
||||
inner.start(urls).await
|
||||
}
|
||||
|
||||
pub async fn ask_leader(&mut self) -> Result<()> {
|
||||
pub async fn ask_leader(&mut self) -> Result<String> {
|
||||
let inner = self.inner.read().await;
|
||||
inner.ask_leader().await
|
||||
}
|
||||
@@ -169,7 +169,7 @@ impl Inner {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn ask_leader(&self) -> Result<()> {
|
||||
async fn ask_leader(&self) -> Result<String> {
|
||||
ensure!(
|
||||
self.is_started(),
|
||||
error::IllegalGrpcClientStateSnafu {
|
||||
@@ -177,8 +177,7 @@ impl Inner {
|
||||
}
|
||||
);
|
||||
|
||||
let _ = self.ask_leader.as_ref().unwrap().ask_leader().await;
|
||||
Ok(())
|
||||
self.ask_leader.as_ref().unwrap().ask_leader().await
|
||||
}
|
||||
|
||||
async fn heartbeat(&self) -> Result<(HeartbeatSender, HeartbeatStream)> {
|
||||
|
||||
Reference in New Issue
Block a user