|
| 1 | +**Title**: Establish how multiple values for the same option are reconciled. |
| 2 | + |
| 3 | +**Status**: proposed |
| 4 | + |
| 5 | +**Context**: There are a variety of ways that options can be customized for a |
| 6 | +given function call. Both `Client` and `Connection` classes can be created with |
| 7 | +`google::cloud::Options`. Individual function calls in a `Client` can be passed |
| 8 | +`google::cloud::Options`. Some environment variables can be set such that the |
| 9 | +variable value sets an option associated with that environment variable. Lastly, |
| 10 | +the storage library predates the `google::cloud::Options` mechanism, and many of |
| 11 | +the functions in this library consume a parameter pack that sets optional values |
| 12 | +for the RPCs used in the function. |
| 13 | + |
| 14 | +When the same option is set, with different values, via more than one of these |
| 15 | +mechanisms, there needs to be a uniform process of determining which value to |
| 16 | +use. |
| 17 | + |
| 18 | +**Decision**: The following priorities will be followed when determining which |
| 19 | +value to use when the same option is set via multiple mechanisms: |
| 20 | + |
| 21 | +1. Environment variables |
| 22 | +1. Per function call/GCS `Request` instance (if both are set with different values, an error is returned) |
| 23 | +1. `<service>Client` constructor `Options` |
| 24 | +1. `Make<service>Connection` factory function `Options` |
| 25 | +1. Default values |
| 26 | + |
| 27 | +**Consequences**: The intent was always to follow the priority defined here. |
| 28 | +Thus: |
| 29 | + |
| 30 | +- Failure to detect conflicts is a bug in the library. |
| 31 | +- Any changes in behavior are bug fixes. |
| 32 | +- The number of conflicts is expected to be small as the overlap is tiny and the features are rarely used. |
0 commit comments