summaryrefslogtreecommitdiff
path: root/plugins/boltdb/boltjobs/config.go
blob: 8cc098c16e9b3c8aa51eb9555940272f69f5e5da (plain)
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
package boltjobs

const (
	file     string = "file"
	priority string = "priority"
	prefetch string = "prefetch"
)

type GlobalCfg struct {
	// db file permissions
	Permissions int `mapstructure:"permissions"`
	// consume timeout
}

func (c *GlobalCfg) InitDefaults() {
	if c.Permissions == 0 {
		c.Permissions = 0777
	}
}

type Config struct {
	File     string `mapstructure:"file"`
	Priority int    `mapstructure:"priority"`
	Prefetch int    `mapstructure:"prefetch"`
}

func (c *Config) InitDefaults() {
	if c.File == "" {
		c.File = "rr.db"
	}

	if c.Priority == 0 {
		c.Priority = 10
	}

	if c.Prefetch == 0 {
		c.Prefetch = 1000
	}
}