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

feat(service): schema mismatch disables service #198

Merged
merged 8 commits into from
Jan 3, 2024

Conversation

saibatizoku
Copy link
Contributor

@saibatizoku saibatizoku commented Dec 29, 2023

Description

Adds feature to the poem web service which disables it from serving HTTP requests if a DB schema version mismatch has been detected.

Related Issue(s)

Closes #47

Description of Changes

  • Adds poem middleware SchemaVersionValidation to disable the service from responding to requests if a schema version mismatch has been detected.
  • Modifies crate::state::State such that inner variables can only be accessed using methods.
  • Adds State::event_db() which returns an optional handle to the DB connection pool.
  • Adds State::schema_version_check() which retuns the result of the schema version check query.
  • Adds State::is_schema_version_status(svs) which compares the inner value with the argument, returns bool.
  • Adds State::set_schema_version_status(svs) which sets the inner value with the argument.
  • Updates endpoints to use new methods.
  • Updates endpoints with new middleware.

Related Pull Requests

#197

Please confirm the following checks

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream module

@saibatizoku saibatizoku self-assigned this Dec 29, 2023
@saibatizoku saibatizoku changed the title feature(service): schema mismatch disables service feat(service): schema mismatch disables service Dec 29, 2023
…hods

Adds `State::event_db()` which returns an optional handle to the DB connection pool
Adds `State::schema_version_check()` which retuns the result of the schema version check query
Adds `State::is_schema_version_status(svs)` which compares the inner value with the argument
Adds `State::set_schema_version_status(svs)` which sets the inner value with the argument
Add middleware type to check the State's schema version status variable, if a mismatch
is detected, a `503 Service unavailable` response is returned.
@saibatizoku saibatizoku force-pushed the feature/schema-mismatch-disables-service branch from 7793da5 to 65180ff Compare January 1, 2024 19:26
@saibatizoku saibatizoku requested a review from Mr-Leshiy January 3, 2024 19:13
@saibatizoku saibatizoku force-pushed the feature/schema-mismatch-disables-service branch from 9adf677 to d195378 Compare January 3, 2024 19:26
Copy link
Contributor

@Mr-Leshiy Mr-Leshiy left a comment

Choose a reason for hiding this comment

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

LGTM

@minikin minikin merged commit 930c2ce into main Jan 3, 2024
20 checks passed
@minikin minikin deleted the feature/schema-mismatch-disables-service branch January 3, 2024 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

🛠️ [TASK] : cat-gateway health endpoint to probe schema version
4 participants