Switch the database from LevelDB to SQLite, for greater stability and simpler code. Co-authored-by: Tommy van der Vorst <tommy@pixelspark.nl> Co-authored-by: bt90 <btom1990@googlemail.com>
This commit is contained in:
co-authored by
Tommy van der Vorst
bt90
parent
b1c8f88a44
commit
025905fcdf
+29
-1
@@ -18,7 +18,7 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
const Codename = "Gold Grasshopper"
|
||||
const Codename = "Hafnium Hornet"
|
||||
|
||||
var (
|
||||
// Injected by build script
|
||||
@@ -28,6 +28,9 @@ var (
|
||||
Stamp = "0"
|
||||
Tags = ""
|
||||
|
||||
// Added to by other packages
|
||||
extraTags []string
|
||||
|
||||
// Set by init()
|
||||
Date time.Time
|
||||
IsRelease bool
|
||||
@@ -43,6 +46,11 @@ var (
|
||||
"STNORESTART",
|
||||
"STNOUPGRADE",
|
||||
}
|
||||
replaceTags = map[string]string{
|
||||
"sqlite_omit_load_extension": "",
|
||||
"osusergo": "",
|
||||
"netgo": "",
|
||||
}
|
||||
)
|
||||
|
||||
const versionExtraAllowedChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-. "
|
||||
@@ -108,8 +116,23 @@ func TagsList() []string {
|
||||
if Extra != "" {
|
||||
tags = append(tags, Extra)
|
||||
}
|
||||
tags = append(tags, extraTags...)
|
||||
|
||||
// Replace any tag values we want to have more user friendly versions,
|
||||
// or be removed
|
||||
for i, tag := range tags {
|
||||
if repl, ok := replaceTags[tag]; ok {
|
||||
tags[i] = repl
|
||||
}
|
||||
}
|
||||
|
||||
sort.Strings(tags)
|
||||
|
||||
// Remove any empty tags, which will be at the front of the list now
|
||||
for len(tags) > 0 && tags[0] == "" {
|
||||
tags = tags[1:]
|
||||
}
|
||||
|
||||
return tags
|
||||
}
|
||||
|
||||
@@ -124,3 +147,8 @@ func filterString(s, allowedChars string) string {
|
||||
}
|
||||
return res.String()
|
||||
}
|
||||
|
||||
func AddTag(tag string) {
|
||||
extraTags = append(extraTags, tag)
|
||||
LongVersion = LongVersionFor("syncthing")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user