2021-02-08 18:25:17 +00:00
|
|
|
package locodebolt
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
2021-02-09 15:12:09 +00:00
|
|
|
"time"
|
2021-02-08 18:25:17 +00:00
|
|
|
|
|
|
|
"go.etcd.io/bbolt"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Option sets an optional parameter of DB.
|
|
|
|
type Option func(*options)
|
|
|
|
|
|
|
|
type options struct {
|
|
|
|
mode os.FileMode
|
|
|
|
|
|
|
|
boltOpts *bbolt.Options
|
|
|
|
}
|
|
|
|
|
|
|
|
func defaultOpts() *options {
|
|
|
|
return &options{
|
|
|
|
mode: os.ModePerm, // 0777
|
2021-02-09 15:12:09 +00:00
|
|
|
boltOpts: &bbolt.Options{
|
|
|
|
Timeout: 3 * time.Second,
|
|
|
|
},
|
2021-02-08 18:25:17 +00:00
|
|
|
}
|
|
|
|
}
|