Skip to content
Snippets Groups Projects
Unverified Commit 4cb6e440 authored by randy's avatar randy Committed by GitHub
Browse files

improve etcd version and change create to put (#1203)

parent bda9a0b0
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
...@@ -66,21 +66,21 @@ func (e *etcdMetadataReport) PublishAppMetadata(metadataIdentifier *identifier.S ...@@ -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 // 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 { func (e *etcdMetadataReport) StoreProviderMetadata(providerIdentifier *identifier.MetadataIdentifier, serviceDefinitions string) error {
key := e.getNodeKey(providerIdentifier) key := e.getNodeKey(providerIdentifier)
return e.client.Create(key, serviceDefinitions) return e.client.Put(key, serviceDefinitions)
} }
// StoreConsumerMetadata will store the metadata // StoreConsumerMetadata will store the metadata
// metadata including the basic info of the server, consumer info, and other user custom info // 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 { func (e *etcdMetadataReport) StoreConsumerMetadata(consumerMetadataIdentifier *identifier.MetadataIdentifier, serviceParameterString string) error {
key := e.getNodeKey(consumerMetadataIdentifier) key := e.getNodeKey(consumerMetadataIdentifier)
return e.client.Create(key, serviceParameterString) return e.client.Put(key, serviceParameterString)
} }
// SaveServiceMetadata will store the metadata // SaveServiceMetadata will store the metadata
// metadata including the basic info of the server, service info, and other user custom info // 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 { func (e *etcdMetadataReport) SaveServiceMetadata(metadataIdentifier *identifier.ServiceMetadataIdentifier, url *common.URL) error {
key := e.getNodeKey(metadataIdentifier) key := e.getNodeKey(metadataIdentifier)
return e.client.Create(key, url.String()) return e.client.Put(key, url.String())
} }
// RemoveServiceMetadata will remove the service metadata // RemoveServiceMetadata will remove the service metadata
...@@ -105,7 +105,7 @@ func (e *etcdMetadataReport) GetExportedURLs(metadataIdentifier *identifier.Serv ...@@ -105,7 +105,7 @@ func (e *etcdMetadataReport) GetExportedURLs(metadataIdentifier *identifier.Serv
// SaveSubscribedData will convert the urlList to json array and then store it // SaveSubscribedData will convert the urlList to json array and then store it
func (e *etcdMetadataReport) SaveSubscribedData(subscriberMetadataIdentifier *identifier.SubscriberMetadataIdentifier, urls string) error { func (e *etcdMetadataReport) SaveSubscribedData(subscriberMetadataIdentifier *identifier.SubscriberMetadataIdentifier, urls string) error {
key := e.getNodeKey(subscriberMetadataIdentifier) key := e.getNodeKey(subscriberMetadataIdentifier)
return e.client.Create(key, urls) return e.client.Put(key, urls)
} }
// GetSubscribedURLs will lookup the url // GetSubscribedURLs will lookup the url
......
...@@ -26,7 +26,7 @@ import ( ...@@ -26,7 +26,7 @@ import (
import ( import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"go.etcd.io/etcd/embed" "go.etcd.io/etcd/server/v3/embed"
) )
import ( import (
......
...@@ -26,7 +26,7 @@ import ( ...@@ -26,7 +26,7 @@ import (
import ( import (
"github.com/apache/dubbo-getty" "github.com/apache/dubbo-getty"
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
"go.etcd.io/etcd/embed" "go.etcd.io/etcd/server/v3/embed"
) )
import ( import (
......
...@@ -140,7 +140,7 @@ func (r *etcdV3Registry) CreatePath(k string) error { ...@@ -140,7 +140,7 @@ func (r *etcdV3Registry) CreatePath(k string) error {
var tmpPath string var tmpPath string
for _, str := range strings.Split(k, "/")[1:] { for _, str := range strings.Split(k, "/")[1:] {
tmpPath = path.Join(tmpPath, "/", str) 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) return perrors.WithMessagef(err, "create path %s in etcd", tmpPath)
} }
} }
......
...@@ -25,8 +25,8 @@ import ( ...@@ -25,8 +25,8 @@ import (
import ( import (
gxetcd "github.com/dubbogo/gost/database/kv/etcd/v3" gxetcd "github.com/dubbogo/gost/database/kv/etcd/v3"
perrors "github.com/pkg/errors" perrors "github.com/pkg/errors"
"go.etcd.io/etcd/clientv3" "go.etcd.io/etcd/api/v3/mvccpb"
"go.etcd.io/etcd/mvcc/mvccpb" clientv3 "go.etcd.io/etcd/client/v3"
) )
import ( import (
......
...@@ -27,7 +27,7 @@ import ( ...@@ -27,7 +27,7 @@ import (
import ( import (
gxetcd "github.com/dubbogo/gost/database/kv/etcd/v3" gxetcd "github.com/dubbogo/gost/database/kv/etcd/v3"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"go.etcd.io/etcd/embed" "go.etcd.io/etcd/server/v3/embed"
) )
import ( import (
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment