This repository has been archived by the owner on Dec 8, 2021. It is now read-only.
refactor!: remove c'tors from Connection::* param structs #1257
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
https://github.com/googleapis/google-cloud-cpp-spanner/blob/master/google/cloud/spanner/connection.h defines the
Connection
interface, which allows us and our customers to mock out the Spanner "backend" for easier unit testing. That interface defines severalFooParms
structs, which hold all the parameters for each of the virtual methods. Most of those structs are normal/trivial structs, i.e., they do not have constructors.However, we do have two structs that have constructors:
google-cloud-cpp-spanner/google/cloud/spanner/connection.h
Line 78 in 01f634f
and
google-cloud-cpp-spanner/google/cloud/spanner/connection.h
Line 102 in 01f634f
These exist for convenience because the
partition_token
struct field is optional.Proposal
This PR proposes to remove the constructors to make all the params structs the same. This means that all callers constructing the Params will need to specify all fields, including the
partition_token
. But this is the same for all the other params structs already.This doesn't prevent us from ever adding a constructor back at some point in the future, for example, if we decide that we need to add another optional member to a struct.
This change is