Add server and control command

This commit is contained in:
Harshavardhana
2015-06-30 12:18:31 -07:00
parent 101784bc44
commit c2031ca066
4 changed files with 58 additions and 169 deletions

View File

@@ -1,30 +0,0 @@
package featureflags
import (
"sync"
)
var features = make(map[string]bool)
var lock = &sync.RWMutex{}
// Get feature will return true if the feature is enabled, otherwise false
func Get(feature string) bool {
lock.RLock()
defer lock.RUnlock()
res := features[feature]
return res
}
// Enable a feature
func Enable(feature string) {
lock.Lock()
defer lock.Unlock()
features[feature] = true
}
// Disable a feature
func Disable(feature string) {
lock.Lock()
defer lock.Unlock()
features[feature] = false
}

View File

@@ -1,22 +0,0 @@
package featureflags
import (
"testing"
)
func TestFeatureFlag(t *testing.T) {
foo := Get("foo")
if foo {
t.Fail()
}
Enable("foo")
foo = Get("foo")
if !foo {
t.Fail()
}
Disable("foo")
foo = Get("foo")
if foo {
t.Fail()
}
}

View File

@@ -1,6 +0,0 @@
package featureflags
const (
// MultipartPutObject ...
MultipartPutObject = "minio.multipart_put_object"
)