ducky/devices

Paddy 2015-11-20 Parent:34130c700842 Child:74dbc04879a7

9:f5a9d5f8f28d Go to Latest

ducky/devices/memstore.go

Separate out StorerFactory into its own interface. We had previously included a Factory and Destroy method in the Storer interface, but it makes more sense to separate those out into a StorerFactory interface. This lets us avoid the impression that we're using the same instance of a Storer for every test, separates the test methods away from the methods that are actually used in prod, and hides them from Godoc. What's not to like?

History
     1.1 --- a/memstore.go	Sun Nov 15 04:40:30 2015 -0800
     1.2 +++ b/memstore.go	Fri Nov 20 01:14:58 2015 -0800
     1.3 @@ -68,12 +68,3 @@
     1.4  	}
     1.5  	return devices, nil
     1.6  }
     1.7 -
     1.8 -func (m *Memstore) Factory(c context.Context) (Storer, error) {
     1.9 -	return NewMemstore(), nil
    1.10 -}
    1.11 -
    1.12 -func (m *Memstore) Destroy(c context.Context) error {
    1.13 -	m.devices = nil
    1.14 -	return nil
    1.15 -}