Skip to content

Align class names and code structure with the connectors in other languages #341

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
hessjcg opened this issue Apr 30, 2024 · 0 comments
Open
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@hessjcg
Copy link
Collaborator

hessjcg commented Apr 30, 2024

The connectors in the other languages are structured with common names and separation of concerns.

Public API:

  • Connector is the main public API to configure and connect.
  • ConnectionOptions is the value object containing connection options. main public API to configure and connect.

Internal API:

  • ConnectorRegistry is the internal class that holds configuration and caches for each database instance.
  • ConnectionInfo is a value object that holds the configuration and data for one database instance.
  • ConnectionInfoCache interface holds the active ConnectionInfo value for a single database instance and keeps it up to date, refreshing the data as needed.
  • RefreshAheadCache implements the ConnectionInfoCache using the current connector refresh algorithm
  • LazyRefreshCache (to be added with Add support for lazy certificate refresh #285) implements ConnectionInfoCache using the lazy refresh algorithm.
  • ConnectionInfoRepository calls the Cloud SQL Admin API to build an up-to-date ConnectionInfo object.

To get to the NodeJS connector codebase into state, we will need to move some code and rename some classes.

  • Rename CloudSQLInstanceMap to ConnectorRegistry
  • Rename InstanceConnectionInfo to ConnectionInfo
  • Rename CloudSQLInstance class to RefreshAheadCache
  • Rename Fetcher interface to ConnectionInfoRepository
  • Rename SqlAdminFetcher class to DefaultConnectionInfoRepository
@hessjcg hessjcg added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label Apr 30, 2024
@hessjcg hessjcg added the priority: p2 Moderately-important priority. Fix may not be included in next release. label Apr 30, 2024
@hessjcg hessjcg assigned hessjcg and unassigned ttosta-google Apr 30, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

2 participants