MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / RemoveStore

Function RemoveStore

internal/utils/kvstore/utils.go:20–50  ·  view source on GitHub ↗

RemoveStore remove store directory

(path string)

Source from the content-addressed store, hash-verified

18
19// RemoveStore remove store directory
20func RemoveStore(path string) error {
21 var errNotStoreDirectory = errors.New("not store directory")
22
23 if strings.HasSuffix(path, StoreSuffix) {
24 _, err := os.Stat(path)
25 if err != nil {
26 if os.IsNotExist(err) {
27 return nil
28 }
29 return err
30 }
31
32 // validate store
33 {
34 _, err = os.Stat(path + "/CURRENT")
35 if err != nil {
36 return errNotStoreDirectory
37 }
38 }
39 {
40 _, err = os.Stat(path + "/LOCK")
41 if err != nil {
42 return errNotStoreDirectory
43 }
44 }
45
46 return os.RemoveAll(path)
47 }
48
49 return errNotStoreDirectory
50}

Callers 1

TestRemoveDBFunction · 0.92

Calls 2

StatMethod · 0.65
RemoveAllMethod · 0.45

Tested by 1

TestRemoveDBFunction · 0.74