New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Design of methods with XXXOptions #3349
Comments
After some discussion it seems preferred not to further complicate the context (with) methods. Another option is to use methods similar to edit:
The options passed into the function will be populated already with values from the context. Anything done to manipulate them further will be what is passed to the api call. We can optionally consider using the signature:
Which would be more concise for the recommended usage pattern, but more restrictive. The methods directly passing in ListOptions will be deprecated. The context withXXX methods that apply to only one operation, such as withPropagationPolicy, could be deprecated - just to minimize what needs to be exposed. @metacosm @manusa @rohanKanojia do you prefer the UnaryOperation or the Builder form of these functions? |
pick fca47f8 chore(deps): bump maven-enforcer-plugin from 3.0.0-M3 to 3.0.0 pick b5ef58c fix fabric8io#3349: adding consistency to the handling of option values pick a7c7b321a Updated changelog pick 1ad8eb953 Fixed indentation, renamed cinverdionReview.json and updated changelog
pick fca47f8 chore(deps): bump maven-enforcer-plugin from 3.0.0-M3 to 3.0.0 pick b5ef58c fix fabric8io#3349: adding consistency to the handling of option values pick a7c7b321a Updated changelog pick 1ad8eb953 Fixed indentation, renamed cinverdionReview.json and updated changelog
This topic originated on #3316. list/watch both support ListOptions as an argument. Delete does not, but does support quite a few context methods.
It is not clear if delete should also support delete(DeleteOptions) for consistency with the list/watch methods.
There is also a consideration of what passing options directly makes sense given the usage of conflicting context values.
For example if you do:
It will currently send both:
An alternative design to directly passing the options is to inline the fluent construction, similar to what is being done for filtering:
That allows for calls like:
The understanding here is that the constructed deleted options will be the ones passed to the operation. If you override the default value passed in from the context, then it is explicit what you want to have happen.
The implementation with inline fluents is straight-forward. The context needs a reference to DeleteOptions and an extended DeleteFluentImpl to maintain a reference to the operation so that it can be returned with the updated context when the fluent nested ends.
Any property that is specific to a given operation (gracePeriodSeconds, propagationPolicy, cascading) would just move to a DeleteOptions on the context, rather than having an individual value. However common things like dryRun and this locked resourceVersion don't map neatly and would still need placeholders in the context and would presumably influence the default values of the DeleteOptions returned by withDeleteOptions.
@rohanKanojia @manusa WDYT:
The text was updated successfully, but these errors were encountered: