cord-776 create build / runtime containers for autmation uservices
Change-Id: I246973192adef56a250ffe93a5f65fff488840c1
diff --git a/switchq/vendor/github.com/juju/utils/set/ints.go b/switchq/vendor/github.com/juju/utils/set/ints.go
new file mode 100644
index 0000000..02009ea
--- /dev/null
+++ b/switchq/vendor/github.com/juju/utils/set/ints.go
@@ -0,0 +1,112 @@
+// Copyright 2014 Canonical Ltd.
+// Licensed under the LGPLv3, see LICENCE file for details.
+
+package set
+
+import (
+ "sort"
+)
+
+// Ints represents the classic "set" data structure, and contains ints.
+type Ints map[int]bool
+
+// NewInts creates and initializes an Ints and populates it with
+// initial values as specified in the parameters.
+func NewInts(initial ...int) Ints {
+ result := make(Ints)
+ for _, value := range initial {
+ result.Add(value)
+ }
+ return result
+}
+
+// Size returns the number of elements in the set.
+func (is Ints) Size() int {
+ return len(is)
+}
+
+// IsEmpty is true for empty or uninitialized sets.
+func (is Ints) IsEmpty() bool {
+ return len(is) == 0
+}
+
+// Add puts a value into the set.
+func (is Ints) Add(value int) {
+ if is == nil {
+ panic("uninitalised set")
+ }
+ is[value] = true
+}
+
+// Remove takes a value out of the set. If value wasn't in the set to start
+// with, this method silently succeeds.
+func (is Ints) Remove(value int) {
+ delete(is, value)
+}
+
+// Contains returns true if the value is in the set, and false otherwise.
+func (is Ints) Contains(value int) bool {
+ _, exists := is[value]
+ return exists
+}
+
+// Values returns an unordered slice containing all the values in the set.
+func (is Ints) Values() []int {
+ result := make([]int, len(is))
+ i := 0
+ for key := range is {
+ result[i] = key
+ i++
+ }
+ return result
+}
+
+// SortedValues returns an ordered slice containing all the values in the set.
+func (is Ints) SortedValues() []int {
+ values := is.Values()
+ sort.Ints(values)
+ return values
+}
+
+// Union returns a new Ints representing a union of the elments in the
+// method target and the parameter.
+func (is Ints) Union(other Ints) Ints {
+ result := make(Ints)
+ // Use the internal map rather than going through the friendlier functions
+ // to avoid extra allocation of slices.
+ for value := range is {
+ result[value] = true
+ }
+ for value := range other {
+ result[value] = true
+ }
+ return result
+}
+
+// Intersection returns a new Ints representing a intersection of the elments in the
+// method target and the parameter.
+func (is Ints) Intersection(other Ints) Ints {
+ result := make(Ints)
+ // Use the internal map rather than going through the friendlier functions
+ // to avoid extra allocation of slices.
+ for value := range is {
+ if other.Contains(value) {
+ result[value] = true
+ }
+ }
+ return result
+}
+
+// Difference returns a new Ints representing all the values in the
+// target that are not in the parameter.
+func (is Ints) Difference(other Ints) Ints {
+ result := make(Ints)
+ // Use the internal map rather than going through the friendlier functions
+ // to avoid extra allocation of slices.
+ for value := range is {
+ if !other.Contains(value) {
+ result[value] = true
+ }
+ }
+ return result
+}
diff --git a/switchq/vendor/github.com/juju/utils/set/strings.go b/switchq/vendor/github.com/juju/utils/set/strings.go
new file mode 100644
index 0000000..b89f932
--- /dev/null
+++ b/switchq/vendor/github.com/juju/utils/set/strings.go
@@ -0,0 +1,112 @@
+// Copyright 2013 Canonical Ltd.
+// Licensed under the LGPLv3, see LICENCE file for details.
+
+package set
+
+import (
+ "sort"
+)
+
+// Strings represents the classic "set" data structure, and contains strings.
+type Strings map[string]bool
+
+// NewStrings creates and initializes a Strings and populates it with
+// initial values as specified in the parameters.
+func NewStrings(initial ...string) Strings {
+ result := make(Strings)
+ for _, value := range initial {
+ result.Add(value)
+ }
+ return result
+}
+
+// Size returns the number of elements in the set.
+func (s Strings) Size() int {
+ return len(s)
+}
+
+// IsEmpty is true for empty or uninitialized sets.
+func (s Strings) IsEmpty() bool {
+ return len(s) == 0
+}
+
+// Add puts a value into the set.
+func (s Strings) Add(value string) {
+ if s == nil {
+ panic("uninitalised set")
+ }
+ s[value] = true
+}
+
+// Remove takes a value out of the set. If value wasn't in the set to start
+// with, this method silently succeeds.
+func (s Strings) Remove(value string) {
+ delete(s, value)
+}
+
+// Contains returns true if the value is in the set, and false otherwise.
+func (s Strings) Contains(value string) bool {
+ _, exists := s[value]
+ return exists
+}
+
+// Values returns an unordered slice containing all the values in the set.
+func (s Strings) Values() []string {
+ result := make([]string, len(s))
+ i := 0
+ for key := range s {
+ result[i] = key
+ i++
+ }
+ return result
+}
+
+// SortedValues returns an ordered slice containing all the values in the set.
+func (s Strings) SortedValues() []string {
+ values := s.Values()
+ sort.Strings(values)
+ return values
+}
+
+// Union returns a new Strings representing a union of the elments in the
+// method target and the parameter.
+func (s Strings) Union(other Strings) Strings {
+ result := make(Strings)
+ // Use the internal map rather than going through the friendlier functions
+ // to avoid extra allocation of slices.
+ for value := range s {
+ result[value] = true
+ }
+ for value := range other {
+ result[value] = true
+ }
+ return result
+}
+
+// Intersection returns a new Strings representing a intersection of the elments in the
+// method target and the parameter.
+func (s Strings) Intersection(other Strings) Strings {
+ result := make(Strings)
+ // Use the internal map rather than going through the friendlier functions
+ // to avoid extra allocation of slices.
+ for value := range s {
+ if other.Contains(value) {
+ result[value] = true
+ }
+ }
+ return result
+}
+
+// Difference returns a new Strings representing all the values in the
+// target that are not in the parameter.
+func (s Strings) Difference(other Strings) Strings {
+ result := make(Strings)
+ // Use the internal map rather than going through the friendlier functions
+ // to avoid extra allocation of slices.
+ for value := range s {
+ if !other.Contains(value) {
+ result[value] = true
+ }
+ }
+ return result
+}
diff --git a/switchq/vendor/github.com/juju/utils/set/tags.go b/switchq/vendor/github.com/juju/utils/set/tags.go
new file mode 100644
index 0000000..0fb6f87
--- /dev/null
+++ b/switchq/vendor/github.com/juju/utils/set/tags.go
@@ -0,0 +1,150 @@
+// Copyright 2014 Canonical Ltd.
+// Licensed under the LGPLv3, see LICENCE file for details.
+
+package set
+
+import (
+ "sort"
+
+ "github.com/juju/errors"
+ "gopkg.in/juju/names.v2"
+)
+
+// Tags represents the Set data structure, it implements tagSet
+// and contains names.Tags.
+type Tags map[names.Tag]bool
+
+// NewTags creates and initializes a Tags and populates it with
+// inital values as specified in the parameters.
+func NewTags(initial ...names.Tag) Tags {
+ result := make(Tags)
+ for _, value := range initial {
+ result.Add(value)
+ }
+ return result
+}
+
+// NewTagsFromStrings creates and initializes a Tags and populates it
+// by using names.ParseTag on the initial values specified in the parameters.
+func NewTagsFromStrings(initial ...string) (Tags, error) {
+ result := make(Tags)
+ for _, value := range initial {
+ tag, err := names.ParseTag(value)
+ if err != nil {
+ return result, errors.Trace(err)
+ }
+ result.Add(tag)
+ }
+ return result, nil
+}
+
+// Size returns the number of elements in the set.
+func (t Tags) Size() int {
+ return len(t)
+}
+
+// IsEmpty is true for empty or uninitialized sets.
+func (t Tags) IsEmpty() bool {
+ return len(t) == 0
+}
+
+// Add puts a value into the set.
+func (t Tags) Add(value names.Tag) {
+ if t == nil {
+ panic("uninitalised set")
+ }
+ t[value] = true
+}
+
+// Remove takes a value out of the set. If value wasn't in the set to start
+// with, this method silently succeeds.
+func (t Tags) Remove(value names.Tag) {
+ delete(t, value)
+}
+
+// Contains returns true if the value is in the set, and false otherwise.
+func (t Tags) Contains(value names.Tag) bool {
+ _, exists := t[value]
+ return exists
+}
+
+// Values returns an unordered slice containing all the values in the set.
+func (t Tags) Values() []names.Tag {
+ result := make([]names.Tag, len(t))
+ i := 0
+ for key := range t {
+ result[i] = key
+ i++
+ }
+ return result
+}
+
+// stringValues returns a list of strings that represent a names.Tag
+// Used internally by the SortedValues method.
+func (t Tags) stringValues() []string {
+ result := make([]string, t.Size())
+ i := 0
+ for key := range t {
+ result[i] = key.String()
+ i++
+ }
+ return result
+}
+
+// SortedValues returns an ordered slice containing all the values in the set.
+func (t Tags) SortedValues() []names.Tag {
+ values := t.stringValues()
+ sort.Strings(values)
+
+ result := make([]names.Tag, len(values))
+ for i, value := range values {
+ // We already know only good strings can live in the Tags set
+ // so we can safely ignore the error here.
+ tag, _ := names.ParseTag(value)
+ result[i] = tag
+ }
+ return result
+}
+
+// Union returns a new Tags representing a union of the elments in the
+// method target and the parameter.
+func (t Tags) Union(other Tags) Tags {
+ result := make(Tags)
+ // Use the internal map rather than going through the friendlier functions
+ // to avoid extra allocation of slices.
+ for value := range t {
+ result[value] = true
+ }
+ for value := range other {
+ result[value] = true
+ }
+ return result
+}
+
+// Intersection returns a new Tags representing a intersection of the elments in the
+// method target and the parameter.
+func (t Tags) Intersection(other Tags) Tags {
+ result := make(Tags)
+ // Use the internal map rather than going through the friendlier functions
+ // to avoid extra allocation of slices.
+ for value := range t {
+ if other.Contains(value) {
+ result[value] = true
+ }
+ }
+ return result
+}
+
+// Difference returns a new Tags representing all the values in the
+// target that are not in the parameter.
+func (t Tags) Difference(other Tags) Tags {
+ result := make(Tags)
+ // Use the internal map rather than going through the friendlier functions
+ // to avoid extra allocation of slices.
+ for value := range t {
+ if !other.Contains(value) {
+ result[value] = true
+ }
+ }
+ return result
+}