mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
feat add set command
This commit is contained in:
@@ -254,11 +254,10 @@ func (s *Server) SpeedTestHandler(w http.ResponseWriter, req *http.Request) erro
|
||||
for i := 0; i < count; i++ {
|
||||
go func() {
|
||||
for j := 0; j < 10; j++ {
|
||||
c := &store.CreateCommand{
|
||||
c := &store.SetCommand{
|
||||
Key: "foo",
|
||||
Value: "bar",
|
||||
ExpireTime: time.Unix(0, 0),
|
||||
Force: true,
|
||||
}
|
||||
s.peerServer.RaftServer().Do(c)
|
||||
}
|
||||
|
||||
@@ -39,11 +39,10 @@ func SetKeyHandler(w http.ResponseWriter, req *http.Request, s Server) error {
|
||||
}
|
||||
|
||||
} else {
|
||||
c = &store.CreateCommand{
|
||||
c = &store.SetCommand{
|
||||
Key: key,
|
||||
Value: value,
|
||||
ExpireTime: expireTime,
|
||||
Force: true,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,11 +35,10 @@ func PutHandler(w http.ResponseWriter, req *http.Request, s Server) error {
|
||||
|
||||
// Set command: create a new node or replace the old one.
|
||||
if !valueOk && !indexOk && !existOk {
|
||||
c = &store.CreateCommand{
|
||||
c = &store.SetCommand{
|
||||
Key: key,
|
||||
Value: value,
|
||||
ExpireTime: expireTime,
|
||||
Force: true,
|
||||
}
|
||||
return s.Dispatch(c, w, req)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user