feat: return metasrv leader addr (#2110)

This commit is contained in:
Weny Xu
2023-08-07 18:01:42 +08:00
committed by GitHub
parent f8d152231d
commit 7d0d8dc6e3
2 changed files with 4 additions and 5 deletions

View File

@@ -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
}

View File

@@ -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)> {