Skip to content

Commit

Permalink
add COMPAT(0.10): Remove in 0.10 notes to impl for structs.Resources
Browse files Browse the repository at this point in the history
  • Loading branch information
langmartin committed Apr 11, 2019
1 parent 8528a2a commit 49fbaac
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions nomad/structs/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1771,6 +1771,7 @@ func (r *Resources) Validate() error {
}

// Merge merges this resource with another resource.
// COMPAT(0.10): Remove in 0.10
func (r *Resources) Merge(other *Resources) {
if other.CPU != 0 {
r.CPU = other.CPU
Expand All @@ -1790,6 +1791,7 @@ func (r *Resources) Merge(other *Resources) {
}

// Equals deeply equates the value of this resource with another
// COMPAT(0.10): Remove in 0.10
func (r *Resources) Equals(o *Resources) bool {
if r == nil && o == nil {
return true
Expand All @@ -1814,6 +1816,7 @@ func (r *Resources) Equals(o *Resources) bool {
return false
}

// COMPAT(0.10): Remove in 0.10
func (r *Resources) Canonicalize() {
// Ensure that an empty and nil slices are treated the same to avoid scheduling
// problems since we use reflect DeepEquals.
Expand All @@ -1832,6 +1835,7 @@ func (r *Resources) Canonicalize() {
// MeetsMinResources returns an error if the resources specified are less than
// the minimum allowed.
// This is based on the minimums defined in the Resources type
// COMPAT(0.10): Remove in 0.10
func (r *Resources) MeetsMinResources() error {
var mErr multierror.Error
minResources := MinResources()
Expand Down Expand Up @@ -1880,13 +1884,15 @@ func (r *Resources) Copy() *Resources {
}

// NetIndex finds the matching net index using device name
// COMPAT(0.10): Remove in 0.10
func (r *Resources) NetIndex(n *NetworkResource) int {
return r.Networks.NetIndex(n)
}

// Superset checks if one set of resources is a superset
// of another. This ignores network resources, and the NetworkIndex
// should be used for that.
// COMPAT(0.10): Remove in 0.10
func (r *Resources) Superset(other *Resources) (bool, string) {
if r.CPU < other.CPU {
return false, "cpu"
Expand All @@ -1902,6 +1908,7 @@ func (r *Resources) Superset(other *Resources) (bool, string) {

// Add adds the resources of the delta to this, potentially
// returning an error if not possible.
// COMPAT(0.10): Remove in 0.10
func (r *Resources) Add(delta *Resources) error {
if delta == nil {
return nil
Expand All @@ -1922,6 +1929,7 @@ func (r *Resources) Add(delta *Resources) error {
return nil
}

// COMPAT(0.10): Remove in 0.10
func (r *Resources) GoString() string {
return fmt.Sprintf("*%#v", *r)
}
Expand Down

0 comments on commit 49fbaac

Please sign in to comment.