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

Remove in-memory storage engine, refactor config logic #94

Merged
merged 3 commits into from
Mar 3, 2023

Conversation

jnschaeffer
Copy link
Contributor

By convention, Infratographer CRDB configs should be a top-level config item. In reconfiguring this, a number of other things shook out including no longer needing (or necessarily even wanting) a separate in-memory storage engine. The dev container supports a database now and we can just create CRDB test servers as needed for testing. This commit refactors the storage package to take a crdbx config directly and defines migrations, tracing, and database seeding as options on the storage engine.

@jnschaeffer jnschaeffer requested a review from a team March 2, 2023 21:46
@jnschaeffer jnschaeffer requested a review from a team as a code owner March 2, 2023 21:46
By convention, Infratographer CRDB configs should be a top-level
config item. In reconfiguring this, a number of other things shook out
including no longer needing (or necessarily even wanting) a separate
in-memory storage engine. The dev container supports a database now
and we can just create CRDB test servers as needed for testing. This
commit refactors the storage package to take a crdbx config directly
and defines migrations, tracing, and database seeding as options on
the storage engine.

Signed-off-by: John Schaeffer <jschaeffer@equinix.com>
Signed-off-by: John Schaeffer <jschaeffer@equinix.com>
Comment on lines 55 to 56
func (eng *engine) Shutdown() error {
return eng.db.Close()
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can kill this part of the interface now - the docs don't say it's necessary to do close this connection explicitly https://pkg.go.dev/database/sql#DB.Close

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's probably fine; in that case we should have logic in place to better handle signals so we can wait for some amount of time before exiting.

Signed-off-by: John Schaeffer <jschaeffer@equinix.com>
@jnschaeffer jnschaeffer merged commit 375a098 into infratographer:main Mar 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants