MCPcopy Create free account
hub / github.com/MG-RAST/Shock / reload

Function reload

shock-server/reload.go:19–40  ·  view source on GitHub ↗
(source string)

Source from the content-addressed store, hash-verified

17)
18
19func reload(source string) (err error) {
20 fmt.Println("source:", conf.RELOAD)
21 if strings.HasPrefix(conf.RELOAD, "http://") {
22 fmt.Println("source-type: url")
23 if err = reloadDB(); err != nil {
24 return err
25 }
26 return reloadFromUrl(source)
27 } else {
28 fmt.Println("source-type: dir")
29 if source == conf.PATH_DATA {
30 fmt.Println("source dir is the same as conf data dir: db reload only.")
31 } else {
32 return errors.New("source dir is not the same as conf data dir: copy not implemented yet")
33 }
34 if err = reloadDB(); err != nil {
35 return err
36 }
37 return filepath.Walk(source, reloadFromDir)
38 }
39 return
40}
41
42func reloadDB() (err error) {
43 fmt.Printf("dropping & re-initializing database...")

Callers 1

mainFunction · 0.85

Calls 2

reloadDBFunction · 0.85
reloadFromUrlFunction · 0.85

Tested by

no test coverage detected