Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve etcd version and change create to put #1203

Merged
merged 3 commits into from May 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions go.mod
Expand Up @@ -15,7 +15,7 @@ require (
github.com/creasty/defaults v1.5.1
github.com/docker/go-connections v0.4.0 // indirect
github.com/dubbogo/go-zookeeper v1.0.3
github.com/dubbogo/gost v1.11.8
github.com/dubbogo/gost v1.11.9
github.com/dubbogo/triple v1.0.0
github.com/elazarl/go-bindata-assetfs v1.0.0 // indirect
github.com/emicklei/go-restful/v3 v3.4.0
Expand Down Expand Up @@ -51,10 +51,12 @@ require (
github.com/stretchr/objx v0.2.0 // indirect
github.com/stretchr/testify v1.7.0
github.com/zouyx/agollo/v3 v3.4.5
go.etcd.io/etcd v0.0.0-20200402134248-51bdeb39e698
go.etcd.io/etcd/api/v3 v3.5.0-alpha.0
go.etcd.io/etcd/client/v3 v3.5.0-alpha.0
go.etcd.io/etcd/server/v3 v3.5.0-alpha.0
go.uber.org/atomic v1.7.0
go.uber.org/zap v1.16.0
google.golang.org/grpc v1.33.1
google.golang.org/grpc v1.36.0
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.16.9
k8s.io/apimachinery v0.16.9
Expand Down
70 changes: 57 additions & 13 deletions go.sum

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions metadata/report/etcd/report.go
Expand Up @@ -66,21 +66,21 @@ func (e *etcdMetadataReport) PublishAppMetadata(metadataIdentifier *identifier.S
// metadata including the basic info of the server, provider info, and other user custom info
func (e *etcdMetadataReport) StoreProviderMetadata(providerIdentifier *identifier.MetadataIdentifier, serviceDefinitions string) error {
key := e.getNodeKey(providerIdentifier)
return e.client.Create(key, serviceDefinitions)
return e.client.Put(key, serviceDefinitions)
}

// StoreConsumerMetadata will store the metadata
// metadata including the basic info of the server, consumer info, and other user custom info
func (e *etcdMetadataReport) StoreConsumerMetadata(consumerMetadataIdentifier *identifier.MetadataIdentifier, serviceParameterString string) error {
key := e.getNodeKey(consumerMetadataIdentifier)
return e.client.Create(key, serviceParameterString)
return e.client.Put(key, serviceParameterString)
}

// SaveServiceMetadata will store the metadata
// metadata including the basic info of the server, service info, and other user custom info
func (e *etcdMetadataReport) SaveServiceMetadata(metadataIdentifier *identifier.ServiceMetadataIdentifier, url *common.URL) error {
key := e.getNodeKey(metadataIdentifier)
return e.client.Create(key, url.String())
return e.client.Put(key, url.String())
}

// RemoveServiceMetadata will remove the service metadata
Expand All @@ -105,7 +105,7 @@ func (e *etcdMetadataReport) GetExportedURLs(metadataIdentifier *identifier.Serv
// SaveSubscribedData will convert the urlList to json array and then store it
func (e *etcdMetadataReport) SaveSubscribedData(subscriberMetadataIdentifier *identifier.SubscriberMetadataIdentifier, urls string) error {
key := e.getNodeKey(subscriberMetadataIdentifier)
return e.client.Create(key, urls)
return e.client.Put(key, urls)
}

// GetSubscribedURLs will lookup the url
Expand Down
2 changes: 1 addition & 1 deletion metadata/report/etcd/report_test.go
Expand Up @@ -26,7 +26,7 @@ import (

import (
"github.com/stretchr/testify/assert"
"go.etcd.io/etcd/embed"
"go.etcd.io/etcd/server/v3/embed"
)

import (
Expand Down
2 changes: 1 addition & 1 deletion registry/etcdv3/listener_test.go
Expand Up @@ -26,7 +26,7 @@ import (
import (
"github.com/apache/dubbo-getty"
"github.com/stretchr/testify/suite"
"go.etcd.io/etcd/embed"
"go.etcd.io/etcd/server/v3/embed"
)

import (
Expand Down
2 changes: 1 addition & 1 deletion registry/etcdv3/registry.go
Expand Up @@ -140,7 +140,7 @@ func (r *etcdV3Registry) CreatePath(k string) error {
var tmpPath string
for _, str := range strings.Split(k, "/")[1:] {
tmpPath = path.Join(tmpPath, "/", str)
if err := r.client.Create(tmpPath, ""); err != nil {
if err := r.client.Put(tmpPath, ""); err != nil {
return perrors.WithMessagef(err, "create path %s in etcd", tmpPath)
}
}
Expand Down
4 changes: 2 additions & 2 deletions remoting/etcdv3/listener.go
Expand Up @@ -25,8 +25,8 @@ import (
import (
gxetcd "github.com/dubbogo/gost/database/kv/etcd/v3"
perrors "github.com/pkg/errors"
"go.etcd.io/etcd/clientv3"
"go.etcd.io/etcd/mvcc/mvccpb"
"go.etcd.io/etcd/api/v3/mvccpb"
clientv3 "go.etcd.io/etcd/client/v3"
)

import (
Expand Down
2 changes: 1 addition & 1 deletion remoting/etcdv3/listener_test.go
Expand Up @@ -27,7 +27,7 @@ import (
import (
gxetcd "github.com/dubbogo/gost/database/kv/etcd/v3"
"github.com/stretchr/testify/assert"
"go.etcd.io/etcd/embed"
"go.etcd.io/etcd/server/v3/embed"
)

import (
Expand Down