etcdserver/api/v2discovery: move internal "discovery" package

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
This commit is contained in:
Gyuho Lee 2018-05-21 09:49:48 -07:00
parent 346589edd1
commit 671f1c41a8
4 changed files with 11 additions and 11 deletions

View File

@ -26,10 +26,10 @@ import (
"strings" "strings"
"time" "time"
"github.com/coreos/etcd/discovery"
"github.com/coreos/etcd/embed" "github.com/coreos/etcd/embed"
"github.com/coreos/etcd/etcdserver" "github.com/coreos/etcd/etcdserver"
"github.com/coreos/etcd/etcdserver/api/etcdhttp" "github.com/coreos/etcd/etcdserver/api/etcdhttp"
"github.com/coreos/etcd/etcdserver/api/v2discovery"
"github.com/coreos/etcd/pkg/fileutil" "github.com/coreos/etcd/pkg/fileutil"
pkgioutil "github.com/coreos/etcd/pkg/ioutil" pkgioutil "github.com/coreos/etcd/pkg/ioutil"
"github.com/coreos/etcd/pkg/osutil" "github.com/coreos/etcd/pkg/osutil"
@ -170,7 +170,7 @@ func startEtcdOrProxyV2() {
shouldProxy := cfg.isProxy() shouldProxy := cfg.isProxy()
if !shouldProxy { if !shouldProxy {
stopped, errc, err = startEtcd(&cfg.ec) stopped, errc, err = startEtcd(&cfg.ec)
if derr, ok := err.(*etcdserver.DiscoveryError); ok && derr.Err == discovery.ErrFullCluster { if derr, ok := err.(*etcdserver.DiscoveryError); ok && derr.Err == v2discovery.ErrFullCluster {
if cfg.shouldFallbackToProxy() { if cfg.shouldFallbackToProxy() {
if lg != nil { if lg != nil {
lg.Warn( lg.Warn(
@ -197,7 +197,7 @@ func startEtcdOrProxyV2() {
if err != nil { if err != nil {
if derr, ok := err.(*etcdserver.DiscoveryError); ok { if derr, ok := err.(*etcdserver.DiscoveryError); ok {
switch derr.Err { switch derr.Err {
case discovery.ErrDuplicateID: case v2discovery.ErrDuplicateID:
if lg != nil { if lg != nil {
lg.Warn( lg.Warn(
"member has been registered with discovery service", "member has been registered with discovery service",
@ -218,7 +218,7 @@ func startEtcdOrProxyV2() {
plog.Infof("or use a new discovery token if the previous bootstrap failed.") plog.Infof("or use a new discovery token if the previous bootstrap failed.")
} }
case discovery.ErrDuplicateName: case v2discovery.ErrDuplicateName:
if lg != nil { if lg != nil {
lg.Warn( lg.Warn(
"member with duplicated name has already been registered", "member with duplicated name has already been registered",
@ -426,7 +426,7 @@ func startProxy(cfg *config) error {
if cfg.ec.Durl != "" { if cfg.ec.Durl != "" {
var s string var s string
s, err = discovery.GetCluster(lg, cfg.ec.Durl, cfg.ec.Dproxy) s, err = v2discovery.GetCluster(lg, cfg.ec.Durl, cfg.ec.Dproxy)
if err != nil { if err != nil {
return err return err
} }

View File

@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// Package discovery provides an implementation of the cluster discovery that // Package v2discovery provides an implementation of the cluster discovery that
// is used by etcd. // is used by etcd with v2 client.
package discovery package v2discovery
import ( import (
"context" "context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package discovery package v2discovery
import ( import (
"context" "context"

View File

@ -32,9 +32,9 @@ import (
"github.com/coreos/etcd/alarm" "github.com/coreos/etcd/alarm"
"github.com/coreos/etcd/auth" "github.com/coreos/etcd/auth"
"github.com/coreos/etcd/compactor" "github.com/coreos/etcd/compactor"
"github.com/coreos/etcd/discovery"
"github.com/coreos/etcd/etcdserver/api" "github.com/coreos/etcd/etcdserver/api"
"github.com/coreos/etcd/etcdserver/api/snap" "github.com/coreos/etcd/etcdserver/api/snap"
"github.com/coreos/etcd/etcdserver/api/v2discovery"
"github.com/coreos/etcd/etcdserver/api/v2http/httptypes" "github.com/coreos/etcd/etcdserver/api/v2http/httptypes"
stats "github.com/coreos/etcd/etcdserver/api/v2stats" stats "github.com/coreos/etcd/etcdserver/api/v2stats"
"github.com/coreos/etcd/etcdserver/api/v2store" "github.com/coreos/etcd/etcdserver/api/v2store"
@ -375,7 +375,7 @@ func NewServer(cfg ServerConfig) (srv *EtcdServer, err error) {
} }
if cfg.ShouldDiscover() { if cfg.ShouldDiscover() {
var str string var str string
str, err = discovery.JoinCluster(cfg.Logger, cfg.DiscoveryURL, cfg.DiscoveryProxy, m.ID, cfg.InitialPeerURLsMap.String()) str, err = v2discovery.JoinCluster(cfg.Logger, cfg.DiscoveryURL, cfg.DiscoveryProxy, m.ID, cfg.InitialPeerURLsMap.String())
if err != nil { if err != nil {
return nil, &DiscoveryError{Op: "join", Err: err} return nil, &DiscoveryError{Op: "join", Err: err}
} }