Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrTimeout = context.DeadlineExceeded ErrCanceled = context.Canceled ErrNoEndpoints = errors.New("no endpoints available") ErrTooManyRedirects = errors.New("too many redirects") DefaultRequestTimeout = 5 * time.Second DefaultMaxRedirects = 10 )
View Source
var ( ErrNoLeader = errors.New("client: no leader") ErrKeyNoExist = errors.New("client: key does not exist") ErrKeyExists = errors.New("client: key already exists") )
View Source
var (
DefaultV2KeysPrefix = "/v2/keys"
)
View Source
var (
DefaultV2MembersPrefix = "/v2/members"
)
Functions ¶
This section is empty.
Types ¶
type CancelableTransport ¶
type CancelableTransport interface { http.RoundTripper CancelRequest(req *http.Request) }
CancelableTransport mimics http.Transport to provide an interface which can be substituted for testing (since the RoundTripper interface alone does not require the CancelRequest method)
type HTTPClient ¶
type KeysAPI ¶
type KeysAPI interface { Create(ctx context.Context, key, value string, ttl time.Duration) (*Response, error) Get(ctx context.Context, key string) (*Response, error) Watch(key string, idx uint64) Watcher RecursiveWatch(key string, idx uint64) Watcher }
func NewDiscoveryKeysAPI ¶
func NewDiscoveryKeysAPI(c HTTPClient) KeysAPI
func NewKeysAPI ¶
func NewKeysAPI(c HTTPClient) KeysAPI
type MembersAPI ¶
type MembersAPI interface { List(ctx context.Context) ([]httptypes.Member, error) Add(ctx context.Context, peerURL string) (*httptypes.Member, error) Remove(ctx context.Context, mID string) error }
func NewMembersAPI ¶
func NewMembersAPI(c HTTPClient) MembersAPI
type Node ¶
type SyncableHTTPClient ¶
type SyncableHTTPClient interface { HTTPClient Sync(context.Context) error Endpoints() []string }
func NewHTTPClient ¶
func NewHTTPClient(tr CancelableTransport, eps []string) (SyncableHTTPClient, error)
Click to show internal directories.
Click to hide internal directories.