Skip to content
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

Combine Connections and DefaultConnections classes #453

Merged
merged 2 commits into from
Aug 2, 2018

Conversation

rix0rrr
Copy link
Contributor

@rix0rrr rix0rrr commented Jul 31, 2018

The DefaultConnections type could be advertised on a class because
changing the type of the 'connections: IConnections' property was not
allowed in C#. Hence, all uses of this member needed to be cast.

Change the interface to always advertise the concrete class
'Connections', and fold the methods of DefaultConnections in there.
They now have a runtime check on the presence of default port and
will throw if the Connections class hasn't been initialized properly.

This change is breaking for middleware writers, not for direct
consumers.

This fixes #418.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license.

The DefaultConnections type could be advertised on a class because
changing the type of the 'connections: IConnections' property was not
allowed in C#. Hence, all uses of this member needed to be cast.

Change the interface to always advertise the concrete class
'Connections', and fold the methods of DefaultConnections in there.
They now have a runtime check on the presence of default port and
will throw if the Connections class hasn't been initialized properly.

This change is breaking for middleware writers, not for direct
consumers.

This fixes #418.
@@ -215,7 +215,7 @@ export class DatabaseCluster extends DatabaseClusterRef {
}

this.defaultPortRange = new ec2.TcpPortFromAttribute(this.clusterEndpoint.port);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does defaultPortRange really need to be a property now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still do static typing one-way. We still force the destination to have a default port by forcing it to be of type IDefaultConnectable (which exposes this property).

/**
* This object is used by peers who don't allow reverse connections
*
* It still has an associated connection peer, but that peer does not
* have any security groups to add connections to.
* Because Connections is no longer an interface but a concrete class,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: This sounds like a code review comment, not something that should be checked in.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kind of agree, but the next person coming along in this code base might want some content.

Do you prefer removing it?

It doesn't actually need to be exported, so it becomes private documentation, I can also just do that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah that wasn't actually true. I would still like to retain it somewhere close to the code, but I agree it doesn't need to be a doc comment. Moved to implementation comment.

@rix0rrr rix0rrr merged commit 3798005 into master Aug 2, 2018
@rix0rrr rix0rrr deleted the huijbers/connections branch August 2, 2018 10:18
@NGL321 NGL321 added the contribution/core This is a PR that came from AWS. label Sep 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Redesign IConnections and IDefaultConnections to play nicely with strict type models
4 participants