mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
![Tibor Vass](/assets/img/avatar_default.png)
This patch hard-codes support for NVIDIA GPUs. In a future patch it should move out into its own Device Plugin. Signed-off-by: Tibor Vass <tibor@docker.com>
23 lines
576 B
Go
23 lines
576 B
Go
// Package capabilities allows to generically handle capabilities.
|
|
package capabilities
|
|
|
|
// Set represents a set of capabilities.
|
|
type Set map[string]struct{}
|
|
|
|
// Match tries to match set with caps, which is an OR list of AND lists of capabilities.
|
|
// The matched AND list of capabilities is returned; or nil if none are matched.
|
|
func (set Set) Match(caps [][]string) []string {
|
|
if set == nil {
|
|
return nil
|
|
}
|
|
anyof:
|
|
for _, andList := range caps {
|
|
for _, cap := range andList {
|
|
if _, ok := set[cap]; !ok {
|
|
continue anyof
|
|
}
|
|
}
|
|
return andList
|
|
}
|
|
return nil
|
|
}
|