seafile_recovery/command.go

70 lines
1.4 KiB
Go
Raw Permalink Normal View History

2021-04-22 09:29:04 +00:00
package main
import(
"log"
2021-04-27 14:24:01 +00:00
"code.cloudfoundry.org/bytefmt"
2021-04-22 09:29:04 +00:00
)
2021-04-23 14:44:42 +00:00
func cmdHead(config *configCollect) {
2021-04-22 09:29:04 +00:00
rc := NewRepoCommits(config)
rc.CollectDescs()
log.Println("Repo contains", len(rc.CommitDesc), "commits")
rc.CollectContent()
rc.BuildGraph()
2021-04-22 10:38:52 +00:00
log.Println("Repo has", len(rc.Root), "sources")
2021-04-22 14:15:54 +00:00
if len(rc.Root) > 1 {
for cn, _ := range rc.Root {
log.Println("Commit "+cn.Id+"\n"+cn.Content.String())
}
}
2021-04-22 10:38:52 +00:00
2021-04-22 09:29:04 +00:00
rc.FindLeafs()
2021-04-22 10:38:52 +00:00
log.Println("Repo has", len(rc.Leafs), "sinks")
2021-04-22 09:29:04 +00:00
rc.ChooseHead()
log.Println("Proposing following HEAD:\n"+rc.Head.Content.String())
}
2021-04-22 20:43:44 +00:00
2021-04-23 14:44:42 +00:00
2021-04-23 20:22:26 +00:00
func cmdLs(config *configCollect) {
en := NewEntryNode(config)
2021-04-27 14:24:01 +00:00
lw := new(LsWalker)
en.Walk(lw)
log.Println("Total size:", bytefmt.ByteSize(lw.TotalSize))
2021-04-22 20:43:44 +00:00
}
2021-04-24 09:09:15 +00:00
func cmdInfo(config *configCollect) {
en := NewEntryFileNode(config)
en.Parse()
log.Println(en.Elem.String())
}
2021-04-26 09:05:31 +00:00
func cmdCpFile(config *configCollect) {
en := NewEntryFileNode(config)
2021-04-26 16:39:54 +00:00
cw := new(CopyWalker)
cw.onFile(en)
2021-04-26 09:05:31 +00:00
}
func cmdCpDir(config *configCollect) {
2021-04-26 12:04:18 +00:00
en := NewEntryNode(config)
en.Walk(new(CopyWalker))
2021-04-26 09:05:31 +00:00
}
2021-04-26 16:39:54 +00:00
func cmdS3Dir(config *configCollect) {
en := NewEntryNode(config)
en.Walk(NewS3Walker(config))
}
func cmdS3File(config *configCollect) {
en := NewEntryFileNode(config)
sw := NewS3Walker(config)
sw.onFile(en)
}
2021-04-27 14:24:01 +00:00
func cmdS3Del(config *configCollect) {
sw := NewS3Walker(config)
sw.onDelete()
}