Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gostnops
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wei.xuan
gostnops
Commits
5ffb1425
Commit
5ffb1425
authored
May 15, 2021
by
ztelur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve etcd version
parent
766c8714
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
195 additions
and
29 deletions
+195
-29
client.go
database/kv/etcd/v3/client.go
+8
-2
client_test.go
database/kv/etcd/v3/client_test.go
+3
-3
go.mod
go.mod
+5
-14
go.sum
go.sum
+179
-10
No files found.
database/kv/etcd/v3/client.go
View file @
5ffb1425
...
@@ -27,8 +27,8 @@ import (
...
@@ -27,8 +27,8 @@ import (
import
(
import
(
perrors
"github.com/pkg/errors"
perrors
"github.com/pkg/errors"
"go.etcd.io/etcd/clientv3"
"go.etcd.io/etcd/client
/
v3"
"go.etcd.io/etcd/clientv3/concurrency"
"go.etcd.io/etcd/client
/
v3/concurrency"
"google.golang.org/grpc"
"google.golang.org/grpc"
)
)
...
@@ -458,6 +458,12 @@ func (c *Client) Update(k, v string) error {
...
@@ -458,6 +458,12 @@ func (c *Client) Update(k, v string) error {
return
perrors
.
WithMessagef
(
err
,
"Update k/v (key: %s value %s)"
,
k
,
v
)
return
perrors
.
WithMessagef
(
err
,
"Update k/v (key: %s value %s)"
,
k
,
v
)
}
}
// Put key value ...
func
(
c
*
Client
)
Put
(
k
,
v
string
,
opts
...
clientv3
.
OpOption
)
error
{
err
:=
c
.
put
(
k
,
v
,
opts
...
)
return
perrors
.
WithMessagef
(
err
,
"Update k/v (key: %s value %s)"
,
k
,
v
)
}
// Update key value ...
// Update key value ...
func
(
c
*
Client
)
UpdateWithRev
(
k
,
v
string
,
rev
int64
,
opts
...
clientv3
.
OpOption
)
error
{
func
(
c
*
Client
)
UpdateWithRev
(
k
,
v
string
,
rev
int64
,
opts
...
clientv3
.
OpOption
)
error
{
err
:=
c
.
updateWithRev
(
k
,
v
,
rev
,
opts
...
)
err
:=
c
.
updateWithRev
(
k
,
v
,
rev
,
opts
...
)
...
...
database/kv/etcd/v3/client_test.go
View file @
5ffb1425
...
@@ -31,8 +31,8 @@ import (
...
@@ -31,8 +31,8 @@ import (
perrors
"github.com/pkg/errors"
perrors
"github.com/pkg/errors"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
"github.com/stretchr/testify/suite"
"go.etcd.io/etcd/
embed
"
"go.etcd.io/etcd/
api/v3/mvccpb
"
"go.etcd.io/etcd/
mvcc/mvccpb
"
"go.etcd.io/etcd/
server/v3/embed
"
"google.golang.org/grpc/connectivity"
"google.golang.org/grpc/connectivity"
)
)
...
@@ -294,7 +294,7 @@ func (suite *ClientTestSuite) TestClientDeleteKV() {
...
@@ -294,7 +294,7 @@ func (suite *ClientTestSuite) TestClientDeleteKV() {
v
:=
tc
.
input
.
v
v
:=
tc
.
input
.
v
expect
:=
ErrKVPairNotFound
expect
:=
ErrKVPairNotFound
if
err
:=
c
.
Create
(
k
,
v
);
err
!=
nil
{
if
err
:=
c
.
Put
(
k
,
v
);
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
...
...
go.mod
View file @
5ffb1425
...
@@ -2,22 +2,13 @@ module github.com/dubbogo/gost
...
@@ -2,22 +2,13 @@ module github.com/dubbogo/gost
require (
require (
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/davecgh/go-spew v1.1.1
github.com/davecgh/go-spew v1.1.1
github.com/dubbogo/go-zookeeper v1.0.3
github.com/dubbogo/go-zookeeper v1.0.3
github.com/dubbogo/jsonparser v1.0.1
github.com/dubbogo/jsonparser v1.0.1
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/go-ole/go-ole v1.2.4 // indirect
github.com/go-ole/go-ole v1.2.4 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/google/uuid v1.2.0 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.2.2 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.14.6 // indirect
github.com/jonboulle/clockwork v0.2.2 // indirect
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 // indirect
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 // indirect
github.com/k0kubun/pp v3.0.1+incompatible
github.com/k0kubun/pp v3.0.1+incompatible
github.com/kr/text v0.2.0 // indirect
github.com/mattn/go-colorable v0.1.7 // indirect
github.com/mattn/go-colorable v0.1.7 // indirect
github.com/mattn/go-isatty v0.0.12
github.com/mattn/go-isatty v0.0.12
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
...
@@ -26,16 +17,16 @@ require (
...
@@ -26,16 +17,16 @@ require (
github.com/shirou/gopsutil v3.20.11+incompatible
github.com/shirou/gopsutil v3.20.11+incompatible
github.com/stretchr/testify v1.7.0
github.com/stretchr/testify v1.7.0
github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 // indirect
github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 // indirect
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/atomic v1.7.0
go.uber.org/zap v1.16.0 // indirect
golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect
golang.org/x/sys v0.0.0-20201223074533-0d417f636930 // indirect
golang.org/x/sys v0.0.0-20201223074533-0d417f636930 // indirect
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324 // indirect
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324 // indirect
google.golang.org/grpc v1.29.1
google.golang.org/genproto v0.0.0-20200806141610-86f49bd18e98 // indirect
google.golang.org/grpc v1.36.0
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
)
)
go 1.13
go 1.13
go.sum
View file @
5ffb1425
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment