1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Make filtering a linear operation.

Improves the current filtering implementation complixity.
Currently, the best case is O(N) and worst case O(N^2) for key-value filtering.
In the new implementation, the best case is O(1) and worst case O(N), again for key-value filtering.

Signed-off-by: David Calavera <david.calavera@gmail.com>
This commit is contained in:
David Calavera 2015-11-25 20:27:11 -05:00
parent 8a350c5c7b
commit 93d1dd8036
13 changed files with 444 additions and 238 deletions

View file

@ -230,9 +230,9 @@ func isNetworkAvailable(c *check.C, name string) bool {
func getNetworkIDByName(c *check.C, name string) string {
var (
v = url.Values{}
filterArgs = filters.Args{}
filterArgs = filters.NewArgs()
)
filterArgs["name"] = []string{name}
filterArgs.Add("name", name)
filterJSON, err := filters.ToParam(filterArgs)
c.Assert(err, checker.IsNil)
v.Set("filters", filterJSON)