diff options
Diffstat (limited to 'plugins/boltdb/boltjobs/config.go')
-rw-r--r-- | plugins/boltdb/boltjobs/config.go | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/plugins/boltdb/boltjobs/config.go b/plugins/boltdb/boltjobs/config.go index 013e30bf..8cc098c1 100644 --- a/plugins/boltdb/boltjobs/config.go +++ b/plugins/boltdb/boltjobs/config.go @@ -1,16 +1,39 @@ package boltjobs -type Config struct { - // File is boltDB file. No need to create it by your own, - // boltdb driver is able to create the file, or read existing - File string - // Bucket to store data in boltDB - bucket string +const ( + file string = "file" + priority string = "priority" + prefetch string = "prefetch" +) + +type GlobalCfg struct { // db file permissions - Permissions int + 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 + } } |