✨ use globally unique connection IDs for providers #3492
Merged
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.
Use globally unique connection IDs for providers. This allows us to call
Connect
multiple times for providers without having to create new connections in the process. It also helps us to do cross-provider connections in the future since 1 asset will always have 1 connection ID for all providers it talks to.New flow
Connection IDs are assigned by the coordinator. If a connection has no ID yet, it gets one from the coordinator which makes sure it is globally unique.
Old flow
The old flow is maximally contained in the base
Service
struct that is reused by all providers. When we clean that up in v12, most of the changes will be in that struct. The old flow is triggered only when we attempt to create a runtime with connection ID 0. This indicates cnquery/cnspec is an old version and doesn't set IDs externally. The old flow will also create a new runtime for an asset that callsConnect
for a second time