Add bbolt store

This commit is contained in:
2022-08-31 23:22:20 +02:00
parent 52c2bd1060
commit 940a512d56
7 changed files with 294 additions and 68 deletions

View File

@@ -85,6 +85,26 @@ func ActionServe(c *cli.Context) error {
} else {
s = pgStore
}
case "bolt", "BOLT":
boltStartTime := time.Now()
loggers.rootLogger.Debugw("Initializing store", "store_type", "bolt")
boltStore, err := store.NewBBoltStore(cfg.Store.Bolt.DBPath)
if err != nil {
return err
}
defer boltStore.Close()
loggers.rootLogger.Infow("Initialized store", "store_type", "bolt", "init_time", time.Since(boltStartTime))
if cfg.Store.EnableCache {
loggers.rootLogger.Debugw("Initializing store", "store_type", "cache-bolt")
startTime := time.Now()
cachingStore := store.NewCachingStore(boltStore)
s = cachingStore
loggers.rootLogger.Infow("Initialized store", "store_type", "cache-bolt", "init_time", time.Since(startTime))
} else {
s = boltStore
}
default:
return fmt.Errorf("Invalid store configured")
}