File: leader.go

package info (click to toggle)
golang-github-canonical-go-dqlite 3.0.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 716 kB
  • sloc: sh: 380; makefile: 5
file content (15 lines) | stat: -rw-r--r-- 529 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
package client

import (
	"context"
)

// FindLeader returns a Client connected to the current cluster leader.
//
// The function will iterate through to all nodes in the given store, and for
// each of them check if it's the current leader. If no leader is found, the
// function will keep retrying (with a capped exponential backoff) until the
// given context is canceled.
func FindLeader(ctx context.Context, store NodeStore, options ...Option) (*Client, error) {
	return NewLeaderConnector(store, options...).Connect(ctx)
}