-
Notifications
You must be signed in to change notification settings - Fork 0
/
wupdedup.go
53 lines (41 loc) · 866 Bytes
/
wupdedup.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package main
import (
"log"
"github.com/timblaktu/wupdedup/config"
"github.com/timblaktu/wupdedup/db"
"github.com/timblaktu/wupdedup/logging"
"github.com/timblaktu/wupdedup/profiler"
"golang.org/x/exp/slog"
)
const (
dbfile string = "wupdedup.bolt.db"
)
func init() {
slog.Debug("init: logging initialized")
slog.Debug("init exiting..")
}
func main() {
slog.Debug("main entered")
c := config.LoadConfig()
logging.Init(c.LogLevel)
var p *profiler.Profiler
if c.Profile.Specified() {
p = profiler.New(c.Profile)
p.Start()
}
contexts := loadStorageStrategyContexts(&c)
d := db.Init(c.DBFile)
defer d.Close()
for _, context := range contexts {
b, err := d.Bucket([]byte(context.name))
if err != nil {
log.Fatal(err)
}
context.SetBucket(b)
context.scanTree()
}
if p != nil {
p.Stop()
}
slog.Debug("main exiting..")
}