|
|
|
@ -1,10 +1,13 @@
|
|
|
|
|
package model
|
|
|
|
|
|
|
|
|
|
import "sync"
|
|
|
|
|
|
|
|
|
|
// Experiments are optional functionality that can be enabled/disabled by an application either completely or individually.
|
|
|
|
|
// examples of experiments include File Sharing, Profile Images and Groups.
|
|
|
|
|
type Experiments struct {
|
|
|
|
|
enabled bool
|
|
|
|
|
experiments map[string]bool
|
|
|
|
|
lock sync.Mutex
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// InitExperiments encapsulates a set of experiments separate from their storage in GlobalSettings.
|
|
|
|
@ -24,6 +27,10 @@ func (e *Experiments) IsEnabled(experiment string) bool {
|
|
|
|
|
// todo handle default-enabled functionality
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// go will sometimes panic if we do not lock this read-only map...
|
|
|
|
|
e.lock.Lock()
|
|
|
|
|
defer e.lock.Unlock()
|
|
|
|
|
enabled, exists := e.experiments[experiment]
|
|
|
|
|
if !exists {
|
|
|
|
|
return false
|
|
|
|
|