-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(types): Deprecate the DBBackend variable in favor of new app-db-backend config entry #11188
Changes from all commits
34615fb
a51cbc2
533a317
53d766f
63ddc2f
d84ef9d
37b3456
6411ab5
33cf13f
9b81772
ee2736c
606c600
d596b60
6a40720
6090bde
22796fe
36bcd0c
d060fc5
7ed5bec
e5a97de
83d2074
f08da2d
ed5caf6
ff6d1ca
00e3615
12df003
3f57be7
52ee92c
55e335b
1cef616
b035260
bf44163
e9ee9b7
0dba287
4705c1c
c8001e0
46e6356
e49f6c5
c08225e
de2cb9b
2d4c6a0
f6b541c
6c6e38f
33b55d6
8ecf3c8
32f758b
812b014
de8ad46
a05638a
bbbccb6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ import ( | |
|
||
"github.com/rs/zerolog" | ||
"github.com/rs/zerolog/log" | ||
"github.com/spf13/cast" | ||
"github.com/spf13/cobra" | ||
"github.com/spf13/pflag" | ||
"github.com/spf13/viper" | ||
|
@@ -348,6 +349,21 @@ func WaitForQuitSignals() ErrorCode { | |
return ErrorCode{Code: int(sig.(syscall.Signal)) + 128} | ||
} | ||
|
||
// GetAppDBBackend gets the backend type to use for the application DBs. | ||
func GetAppDBBackend(opts types.AppOptions) dbm.BackendType { | ||
rv := cast.ToString(opts.Get("app-db-backend")) | ||
if len(rv) == 0 { | ||
rv = sdk.DBBackend | ||
} | ||
if len(rv) == 0 { | ||
rv = cast.ToString(opts.Get("db-backend")) | ||
} | ||
if len(rv) != 0 { | ||
return dbm.BackendType(rv) | ||
} | ||
return dbm.GoLevelDBBackend | ||
} | ||
|
||
Comment on lines
+352
to
+366
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I just pushed up a change that added Order of precedence:
This does a few nice things:
I was tempted to make a magic |
||
func skipInterface(iface net.Interface) bool { | ||
if iface.Flags&net.FlagUp == 0 { | ||
return true // interface down | ||
|
@@ -372,9 +388,9 @@ func addrToIP(addr net.Addr) net.IP { | |
return ip | ||
} | ||
|
||
func openDB(rootDir string) (dbm.DB, error) { | ||
func openDB(rootDir string, backendType dbm.BackendType) (dbm.DB, error) { | ||
dataDir := filepath.Join(rootDir, "data") | ||
return sdk.NewLevelDB("application", dataDir) | ||
return dbm.NewDB("application", backendType, dataDir) | ||
} | ||
|
||
func openTraceWriter(traceWriterFile string) (w io.Writer, err error) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This duplicates the
actions/setup-go@v3
step below?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup. I'd guess it was a bad merge on my part (added both by me in my branch and then later in main).
I created #11420 to remove one of the entries.