All checks were successful
Pre Release Workflow / set-release-target (push) Successful in 1s
Pre Release Workflow / build (agent, amd64, linux) (push) Successful in 1m29s
Pre Release Workflow / build (db, amd64, linux) (push) Successful in 1m29s
Pre Release Workflow / build (dhcp, amd64, linux) (push) Successful in 1m25s
Pre Release Workflow / build (metacli, amd64, linux) (push) Successful in 1m28s
Pre Release Workflow / build (metadata, amd64, linux) (push) Successful in 1m29s
Pre Release Workflow / build (vpc, amd64, linux) (push) Successful in 1m28s
Pre Release Workflow / upload-scripts (run-dnsmasq-in-netns.sh) (push) Successful in 5s
Pre Release Workflow / prerelease (push) Successful in 12s
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
21 lines
453 B
Go
21 lines
453 B
Go
package kv
|
|
|
|
import (
|
|
"github.com/dgraph-io/badger/v4"
|
|
)
|
|
|
|
func InitDB(conf Config, readonly bool) *badger.DB {
|
|
opts := badger.DefaultOptions(conf.Path).
|
|
WithReadOnly(readonly).
|
|
WithBypassLockGuard(readonly)
|
|
opts.Logger = nil
|
|
opts.ValueLogFileSize = 10 << 20 // 10 Mo par fichier vlog
|
|
opts.NumMemtables = 1
|
|
opts.NumLevelZeroTables = 1
|
|
opts.NumLevelZeroTablesStall = 2
|
|
db, err := badger.Open(opts)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return db
|
|
}
|