1 Star 0 Fork 2

who7708/etcd

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
Documentation
bench
config
contrib
discovery
error
etcd
fixtures/ca
http
log
metrics
mod
pkg
scripts
server
store
v2
command_factory.go
compare_and_delete_command.go
compare_and_swap_command.go
create_command.go
delete_command.go
set_command.go
sync_command.go
update_command.go
command_factory.go
event.go
event_history.go
event_queue.go
event_test.go
heap_test.go
node.go
node_extern.go
response_v1.go
stats.go
stats_test.go
store.go
store_bench_test.go
store_test.go
ttl.go
ttl_key_heap.go
watcher.go
watcher_hub.go
watcher_hub_test.go
watcher_test.go
tests
third_party
.gitignore
.header
CHANGELOG
CONTRIBUTING.md
DCO
Dockerfile
LICENSE
NOTICE
README.md
Vagrantfile
build
go_version.go
main.go
test.sh
克隆/下载
delete_command.go 836 Bytes
一键复制 编辑 原始数据 按行查看 历史
package v2
import (
"github.com/coreos/etcd/log"
"github.com/coreos/etcd/store"
"github.com/coreos/etcd/third_party/github.com/goraft/raft"
)
func init() {
raft.RegisterCommand(&DeleteCommand{})
}
// The DeleteCommand removes a key from the Store.
type DeleteCommand struct {
Key string `json:"key"`
Recursive bool `json:"recursive"`
Dir bool `json:"dir"`
}
// The name of the delete command in the log
func (c *DeleteCommand) CommandName() string {
return "etcd:delete"
}
// Delete the key
func (c *DeleteCommand) Apply(context raft.Context) (interface{}, error) {
s, _ := context.Server().StateMachine().(store.Store)
if c.Recursive {
// recursive implies dir
c.Dir = true
}
e, err := s.Delete(c.Key, c.Dir, c.Recursive)
if err != nil {
log.Debug(err)
return nil, err
}
return e, nil
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/who7708/etcd.git
git@gitee.com:who7708/etcd.git
who7708
etcd
etcd
v0.4.5

搜索帮助