Update resource quota for requests

This commit is contained in:
derekwaynecarr
2015-08-13 10:19:27 -04:00
parent b6f2f396ba
commit 2e76842eb7
5 changed files with 444 additions and 393 deletions

View File

@@ -309,6 +309,14 @@ func (q *Quantity) Add(y Quantity) error {
return nil
}
func (q *Quantity) Sub(y Quantity) error {
if q.Format != y.Format {
return fmt.Errorf("format mismatch: %v vs. %v", q.Format, y.Format)
}
q.Amount.Sub(q.Amount, y.Amount)
return nil
}
// MarshalJSON implements the json.Marshaller interface.
func (q Quantity) MarshalJSON() ([]byte, error) {
return []byte(`"` + q.String() + `"`), nil