forked from TrueCloudLab/frostfs-node
04b06ba539
Set timeout option of BoltDB Open operation to 3s in order to prevent indefinite waiting for file lock. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
26 lines
352 B
Go
26 lines
352 B
Go
package locodebolt
|
|
|
|
import (
|
|
"os"
|
|
"time"
|
|
|
|
"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
|
|
boltOpts: &bbolt.Options{
|
|
Timeout: 3 * time.Second,
|
|
},
|
|
}
|
|
}
|