From 3eb326f3ca4cbdef294639e7979be724a2320fc8 Mon Sep 17 00:00:00 2001 From: disksing Date: Mon, 9 Dec 2019 16:24:03 +0800 Subject: [PATCH] client: export GetLeaderAddr Signed-off-by: disksing --- client/client.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/client.go b/client/client.go index 45c16b1e17a..13bda41ce57 100644 --- a/client/client.go +++ b/client/client.go @@ -34,6 +34,9 @@ import ( type Client interface { // GetClusterID gets the cluster ID from PD. GetClusterID(ctx context.Context) uint64 + // GetLeaderAddr returns current leader's address. It returns "" before + // syncing leader from server. + GetLeaderAddr() string // GetTS gets a timestamp from PD. GetTS(ctx context.Context) (int64, int64, error) // GetTSAsync gets a timestamp from PD, without block the caller. @@ -540,7 +543,6 @@ func (c *client) GetClusterID(context.Context) uint64 { return c.clusterID } -// For testing use. func (c *client) GetLeaderAddr() string { c.connMu.RLock() defer c.connMu.RUnlock()