libnet/ds: remove unused param key
from List
Since 43dccc6
the `key` param is never used and can be safely
removed.
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
This commit is contained in:
parent
f7ef0e9fc7
commit
3147a013fb
7 changed files with 13 additions and 15 deletions
|
@ -236,7 +236,7 @@ func (ds *Store) ensureParent(parent string) error {
|
|||
|
||||
// List returns of a list of KVObjects belonging to the parent key. The caller
|
||||
// must pass a KVObject of the same type as the objects that need to be listed.
|
||||
func (ds *Store) List(key string, kvObject KVObject) ([]KVObject, error) {
|
||||
func (ds *Store) List(kvObject KVObject) ([]KVObject, error) {
|
||||
ds.mu.Lock()
|
||||
defer ds.mu.Unlock()
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ func (d *driver) initStore(option map[string]interface{}) error {
|
|||
}
|
||||
|
||||
func (d *driver) populateNetworks() error {
|
||||
kvol, err := d.store.List(datastore.Key(bridgePrefix), &networkConfiguration{})
|
||||
kvol, err := d.store.List(&networkConfiguration{})
|
||||
if err != nil && err != datastore.ErrKeyNotFound {
|
||||
return fmt.Errorf("failed to get bridge network configurations from store: %v", err)
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ func (d *driver) populateNetworks() error {
|
|||
}
|
||||
|
||||
func (d *driver) populateEndpoints() error {
|
||||
kvol, err := d.store.List(datastore.Key(bridgeEndpointPrefix), &bridgeEndpoint{})
|
||||
kvol, err := d.store.List(&bridgeEndpoint{})
|
||||
if err != nil && err != datastore.ErrKeyNotFound {
|
||||
return fmt.Errorf("failed to get bridge endpoints from store: %v", err)
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ func (d *driver) initStore(option map[string]interface{}) error {
|
|||
|
||||
// populateNetworks is invoked at driver init to recreate persistently stored networks
|
||||
func (d *driver) populateNetworks() error {
|
||||
kvol, err := d.store.List(datastore.Key(ipvlanNetworkPrefix), &configuration{})
|
||||
kvol, err := d.store.List(&configuration{})
|
||||
if err != nil && err != datastore.ErrKeyNotFound {
|
||||
return fmt.Errorf("failed to get ipvlan network configurations from store: %v", err)
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ func (d *driver) populateNetworks() error {
|
|||
}
|
||||
|
||||
func (d *driver) populateEndpoints() error {
|
||||
kvol, err := d.store.List(datastore.Key(ipvlanEndpointPrefix), &endpoint{})
|
||||
kvol, err := d.store.List(&endpoint{})
|
||||
if err != nil && err != datastore.ErrKeyNotFound {
|
||||
return fmt.Errorf("failed to get ipvlan endpoints from store: %v", err)
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ func (d *driver) initStore(option map[string]interface{}) error {
|
|||
|
||||
// populateNetworks is invoked at driver init to recreate persistently stored networks
|
||||
func (d *driver) populateNetworks() error {
|
||||
kvol, err := d.store.List(datastore.Key(macvlanPrefix), &configuration{})
|
||||
kvol, err := d.store.List(&configuration{})
|
||||
if err != nil && err != datastore.ErrKeyNotFound {
|
||||
return fmt.Errorf("failed to get macvlan network configurations from store: %v", err)
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ func (d *driver) populateNetworks() error {
|
|||
}
|
||||
|
||||
func (d *driver) populateEndpoints() error {
|
||||
kvol, err := d.store.List(datastore.Key(macvlanEndpointPrefix), &endpoint{})
|
||||
kvol, err := d.store.List(&endpoint{})
|
||||
if err != nil && err != datastore.ErrKeyNotFound {
|
||||
return fmt.Errorf("failed to get macvlan endpoints from store: %v", err)
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ func (d *driver) initStore(option map[string]interface{}) error {
|
|||
}
|
||||
|
||||
func (d *driver) populateNetworks() error {
|
||||
kvol, err := d.store.List(datastore.Key(windowsPrefix), &networkConfiguration{Type: d.name})
|
||||
kvol, err := d.store.List(&networkConfiguration{Type: d.name})
|
||||
if err != nil && err != datastore.ErrKeyNotFound {
|
||||
return fmt.Errorf("failed to get windows network configurations from store: %v", err)
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ func (d *driver) populateNetworks() error {
|
|||
}
|
||||
|
||||
func (d *driver) populateEndpoints() error {
|
||||
kvol, err := d.store.List(datastore.Key(windowsEndpointPrefix), &hnsEndpoint{Type: d.name})
|
||||
kvol, err := d.store.List(&hnsEndpoint{Type: d.name})
|
||||
if err != nil && err != datastore.ErrKeyNotFound {
|
||||
return fmt.Errorf("failed to get endpoints from store: %v", err)
|
||||
}
|
||||
|
|
|
@ -174,7 +174,7 @@ func (c *Controller) sandboxCleanup(activeSandboxes map[string]interface{}) erro
|
|||
return fmt.Errorf("could not find local scope store")
|
||||
}
|
||||
|
||||
sandboxStates, err := store.List(datastore.Key(sandboxPrefix), &sbState{c: c})
|
||||
sandboxStates, err := store.List(&sbState{c: c})
|
||||
if err != nil {
|
||||
if err == datastore.ErrKeyNotFound {
|
||||
// It's normal for no sandboxes to be found. Just bail out.
|
||||
|
|
|
@ -50,8 +50,7 @@ func (c *Controller) getNetworks() ([]*Network, error) {
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
kvol, err := store.List(datastore.Key(datastore.NetworkKeyPrefix),
|
||||
&Network{ctrlr: c})
|
||||
kvol, err := store.List(&Network{ctrlr: c})
|
||||
if err != nil && err != datastore.ErrKeyNotFound {
|
||||
return nil, fmt.Errorf("failed to get networks: %w", err)
|
||||
}
|
||||
|
@ -81,7 +80,7 @@ func (c *Controller) getNetworksFromStore(ctx context.Context) []*Network { // F
|
|||
var nl []*Network
|
||||
|
||||
store := c.getStore()
|
||||
kvol, err := store.List(datastore.Key(datastore.NetworkKeyPrefix), &Network{ctrlr: c})
|
||||
kvol, err := store.List(&Network{ctrlr: c})
|
||||
if err != nil {
|
||||
if err != datastore.ErrKeyNotFound {
|
||||
log.G(ctx).Debugf("failed to get networks from store: %v", err)
|
||||
|
@ -128,9 +127,8 @@ func (n *Network) getEndpointFromStore(eid string) (*Endpoint, error) {
|
|||
func (n *Network) getEndpointsFromStore() ([]*Endpoint, error) {
|
||||
var epl []*Endpoint
|
||||
|
||||
tmp := Endpoint{network: n}
|
||||
store := n.getController().getStore()
|
||||
kvol, err := store.List(datastore.Key(tmp.KeyPrefix()...), &Endpoint{network: n})
|
||||
kvol, err := store.List(&Endpoint{network: n})
|
||||
if err != nil {
|
||||
if err != datastore.ErrKeyNotFound {
|
||||
return nil, fmt.Errorf("failed to get endpoints for network %s: %w",
|
||||
|
|
Loading…
Reference in a new issue