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

Allow provided schema, schema cache #162

Merged
merged 4 commits into from
Aug 1, 2024
Merged

Conversation

lovromazgon
Copy link
Member

Description

This PR contains two additions to schemas:

  • Allows the connector to return a record with structured data and an attached schema. This means the connector doesn't have to take care of encoding the data, it can only provide the schema and the middleware will use the schema to encode the data.
    • The use case are DB connectors like Postgres, which can do a better job extracting the schema directly from the DB. Those can simply attach the extracted schema to the record and return structured data as always, the middleware will take care of the encoding.
  • Adds caches around the standalone schema service.
    • Note that the in-memory schema service is also cached, as it would otherwise not reflect the correct behavior, it's not smart enough to detect the same schema and will always increment the version and ID on CreateSchema. The cache prevents this.

Fixes #158

Quick checks:

  • I have followed the Code Guidelines.
  • There is no other pull request for the same
    update/change.
  • I have written unit tests.
  • I have made sure that the PR is of reasonable size and can be easily reviewed.

@lovromazgon lovromazgon requested a review from a team as a code owner August 1, 2024 11:22
Copy link
Contributor

@hariso hariso left a comment

Choose a reason for hiding this comment

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

@lovromazgon lovromazgon merged commit 62b9c68 into main Aug 1, 2024
3 checks passed
@lovromazgon lovromazgon deleted the lovro/allow-provided-schema branch August 1, 2024 12:45
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.

[Schemas] Add caching to the schema.Get() function
2 participants