This repository has been archived by the owner on Sep 17, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
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 dont 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 speciefied 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 posible - we have to return the type specified in the brokerapi interface to implemet 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 partialy copies upstream catalog structure but holds only fields (IDs and Units ) that we care about. This together with upstream catalog is wrrapped into on 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
Piotr Komborski
committed
May 26, 2017
1 parent
a9b38b9
commit b5d9900
Showing
5 changed files
with
93 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters