Compare commits
3 commits
f3898b288d
...
de7a678640
| Author | SHA1 | Date | |
|---|---|---|---|
|
de7a678640 |
|||
|
8787904833 |
|||
|
7dbb508058 |
4 changed files with 7 additions and 5 deletions
|
|
@ -136,7 +136,7 @@ func main() {
|
||||||
|
|
||||||
DB = kv.InitDB(kv.Config{
|
DB = kv.InitDB(kv.Config{
|
||||||
Path: conf.Database.Path,
|
Path: conf.Database.Path,
|
||||||
})
|
}, false)
|
||||||
defer DB.Close()
|
defer DB.Close()
|
||||||
|
|
||||||
if len(args) < 1 {
|
if len(args) < 1 {
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ func main() {
|
||||||
|
|
||||||
db := kv.InitDB(kv.Config{
|
db := kv.InitDB(kv.Config{
|
||||||
Path: conf.Database.Path,
|
Path: conf.Database.Path,
|
||||||
})
|
}, false)
|
||||||
defer db.Close()
|
defer db.Close()
|
||||||
|
|
||||||
if *start {
|
if *start {
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,8 @@ func getFromDB(config Config) NoCloudData {
|
||||||
|
|
||||||
conf_db, _ := configuration.LoadConfig(config.ConfFile)
|
conf_db, _ := configuration.LoadConfig(config.ConfFile)
|
||||||
|
|
||||||
db := kv.InitDB(kv.Config{Path: conf_db.Database.Path})
|
db := kv.InitDB(kv.Config{Path: conf_db.Database.Path}, true)
|
||||||
|
defer db.Close()
|
||||||
|
|
||||||
metadata, _ := kv.GetFromDB(db, "metadata/"+config.VmName+"/meta-data")
|
metadata, _ := kv.GetFromDB(db, "metadata/"+config.VmName+"/meta-data")
|
||||||
userdata, _ := kv.GetFromDB(db, "metadata/"+config.VmName+"/user-data")
|
userdata, _ := kv.GetFromDB(db, "metadata/"+config.VmName+"/user-data")
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,9 @@ import (
|
||||||
"github.com/dgraph-io/badger/v4"
|
"github.com/dgraph-io/badger/v4"
|
||||||
)
|
)
|
||||||
|
|
||||||
func InitDB(conf Config) *badger.DB {
|
func InitDB(conf Config, readonly bool) *badger.DB {
|
||||||
opts := badger.DefaultOptions(conf.Path)
|
opts := badger.DefaultOptions(conf.Path).
|
||||||
|
WithReadOnly(readonly)
|
||||||
opts.Logger = nil
|
opts.Logger = nil
|
||||||
opts.ValueLogFileSize = 10 << 20 // 10 Mo par fichier vlog
|
opts.ValueLogFileSize = 10 << 20 // 10 Mo par fichier vlog
|
||||||
opts.NumMemtables = 1
|
opts.NumMemtables = 1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue