MCPcopy
hub / github.com/etcd-io/etcd / getHashCommandFunc

Function getHashCommandFunc

tools/etcd-dump-db/main.go:140–157  ·  view source on GitHub ↗
(_ *cobra.Command, args []string)

Source from the content-addressed store, hash-verified

138}
139
140func getHashCommandFunc(_ *cobra.Command, args []string) {
141 if len(args) < 1 {
142 log.Fatalf("Must provide at least 1 argument (got %v)", args)
143 }
144 dp := args[0]
145 if !strings.HasSuffix(dp, "db") {
146 dp = filepath.Join(snapDir(dp), "db")
147 }
148 if !existFileOrDir(dp) {
149 log.Fatalf("%q does not exist", dp)
150 }
151
152 hash, err := getHash(dp)
153 if err != nil {
154 log.Fatal(err)
155 }
156 fmt.Printf("db path: %s\nHash: %d\n", dp, hash)
157}

Callers

nothing calls this directly

Calls 5

existFileOrDirFunction · 0.85
getHashFunction · 0.85
snapDirFunction · 0.70
FatalfMethod · 0.65
FatalMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…