-
-
Notifications
You must be signed in to change notification settings - Fork 588
/
performance_mode.go
37 lines (31 loc) · 1.02 KB
/
performance_mode.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package globalconfig
import (
"github.com/ddev/ddev/pkg/config/types"
)
// GetPerformanceMode returns the performance mode config respecting
// defaults.
func (c *GlobalConfig) GetPerformanceMode() types.PerformanceMode {
switch {
case c.NoBindMounts:
return types.PerformanceModeMutagen
case c.PerformanceMode == types.PerformanceModeEmpty:
return types.GetPerformanceModeDefault()
default:
return c.PerformanceMode
}
}
// SetPerformanceMode sets the performance mode config.
func (c *GlobalConfig) SetPerformanceMode(performanceMode string) *GlobalConfig {
if types.IsValidPerformanceMode(performanceMode, types.ConfigTypeGlobal) {
c.PerformanceMode = performanceMode
}
return c
}
// IsMutagenEnabled returns true if Mutagen is enabled.
func (c *GlobalConfig) IsMutagenEnabled() bool {
return c.GetPerformanceMode() == types.PerformanceModeMutagen
}
// IsNFSMountEnabled returns true if NFS is enabled.
func (c *GlobalConfig) IsNFSMountEnabled() bool {
return c.GetPerformanceMode() == types.PerformanceModeNFS
}