This repository has been archived by the owner on Sep 17, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We had several options how to implement that: * one plan and user provided json to specify number of units: we don't like this option * multiple plans and we hardcode number of units based on plan name which means we have to change broker code every time the plan changes : nah... * fork brokerAPI and modify the Catalog struct and do PR upstream: it's hard to extend this in a generic way by using json.RawMessage. The name of the field has to be known and specified as json unmarshaller option. So we would have to specify `json:"units,omitempty"` json unmarshaler option which is very compose specific. There is a go lang issue opened to fix that: golang/go#15314 * do not use upstream Catalog and implement our own struct. Not possible - we have to return the type specified in the brokerapi interface to implement it: https://github.com/pivotal-cf/brokerapi/blob/0d62e62ec041b8ff39c0e304f437b4eabb4175fa/service_broker.go#L10 * extend external Catalog struct to include units field - not possible. Same reason as above I had to implement the sixth option. Now we have a new struct that partially copies upstream catalog structure but holds only fields (IDs and Units ) that we care about. This together with upstream catalog is wrrapped into one struct and stored in main broker structure so all interface methods have access to it. There is also new catalog.Load method that replaces catalog.New. It has two unmarshalling passes to fill upstream catalog and our Units struct.
- Loading branch information