diff --git a/storage/memory/memory.go b/storage/memory/memory.go index baf8329f..beaad6c7 100644 --- a/storage/memory/memory.go +++ b/storage/memory/memory.go @@ -8,10 +8,6 @@ import ( "github.com/coreos/poke/storage" ) -func init() { - storage.Register("memory", new(driver)) -} - // New returns an in memory storage. func New() storage.Storage { return &memStorage{ @@ -22,15 +18,6 @@ func New() storage.Storage { } } -type driver struct{} - -func (f *driver) Open(config map[string]string) (storage.Storage, error) { - if len(config) != 0 { - return nil, errors.New("in memory storage does not take any arguments") - } - return New(), nil -} - type memStorage struct { mu sync.Mutex diff --git a/storage/storage.go b/storage/storage.go index ae09513a..32b65b6c 100644 --- a/storage/storage.go +++ b/storage/storage.go @@ -16,8 +16,6 @@ import ( ) var ( - drivers = make(map[string]Driver) - // stubbed out for testing now = time.Now ) @@ -40,35 +38,6 @@ func NewNonce() string { return strings.TrimRight(encoding.EncodeToString(buff), "=") } -// Driver is the interface implemented by storage drivers. -type Driver interface { - // Open returns a storage implementation. It should only validate its - // arguments and not return an error if the underlying storage is - // unavailable. - Open(config map[string]string) (Storage, error) -} - -// Register makes a storage driver available by the provided name. If Register -// is called twice with the same name or if driver is nil, it panics. -func Register(name string, driver Driver) { - if driver == nil { - panic("driver cannot be nil") - } - if _, ok := drivers[name]; ok { - panic("driver " + name + " is already registered") - } - drivers[name] = driver -} - -// Open returns a new storage object with a given key rotation strategy. -func Open(driverName string, config map[string]string) (Storage, error) { - driver, ok := drivers[driverName] - if !ok { - return nil, fmt.Errorf("no driver of type %s found", driverName) - } - return driver.Open(config) -} - // Storage is the storage interface used by the server. Implementations, at minimum // require compare-and-swap atomic actions. //