Use msgpack instead of gob; Added data persistance for badger data store

This commit is contained in:
Pijus Kamandulis committed 2025-03-13 23:59:07 +02:00
1 parent 5fe60d831a
commit 97eea30c97
8 files changed
+43 -24

No files matched your search

+16 -5
View File
@@ -77,11 +77,22 @@ func (c *ServerConfig) PopulateCalculatedFields() {
logger.SetLogLevel(logger.LogLevelInfo)
}
if c.DataStore == DataStoreBadger &&
(c.InitialDataFilePath != "" || c.PersistDataFilePath != "") {
logger.ErrorLn("InitialData and Persist options are currently not supported with Badger data store")
c.InitialDataFilePath = ""
c.PersistDataFilePath = ""
if c.PersistDataFilePath != "" {
fileInfo, _ := os.Stat(c.PersistDataFilePath)
if c.DataStore == DataStoreMap && fileInfo.IsDir() {
logger.ErrorLn("--Persist cannot be a directory when using default data store")
os.Exit(1)
}
if c.DataStore == DataStoreBadger && !fileInfo.IsDir() {
logger.ErrorLn("--Persist must be a directory when using Badger data store")
os.Exit(1)
}
}
if c.DataStore == DataStoreBadger && c.InitialDataFilePath != "" {
logger.ErrorLn("InitialData option is currently not supported with Badger data store")
os.Exit(1)
}
}