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

Add endpoint to receive updates for tables #262

Merged
merged 7 commits into from
Dec 10, 2024
Merged

Conversation

somtochiama
Copy link
Contributor

@somtochiama somtochiama commented Oct 22, 2024

This pull request adds a HTTP endpoint /updates/:table that sends future updates about the primary keys of rows have been updated or deleted.

$ curl -X POST http://localhost:8081/v1/updates/todos
{"notify":["upsert",["some-id-82"]]}
{"notify":["upsert",["1"]]}
{"notify":["delete",["1"]

@somtochiama somtochiama changed the title Add endpoint to receive updates for public keys Add endpoint to receive updates for tables Oct 22, 2024
@somtochiama somtochiama requested a review from jeromegn October 24, 2024 11:09
crates/corro-types/src/updates.rs Outdated Show resolved Hide resolved
crates/corro-api-types/src/lib.rs Outdated Show resolved Hide resolved
crates/corro-types/src/pubsub.rs Outdated Show resolved Hide resolved
crates/corro-types/src/pubsub.rs Outdated Show resolved Hide resolved
crates/corro-types/src/updates.rs Outdated Show resolved Hide resolved
crates/corro-types/src/updates.rs Outdated Show resolved Hide resolved
crates/corro-types/src/updates.rs Show resolved Hide resolved
crates/corro-types/src/updates.rs Outdated Show resolved Hide resolved
@somtochiama somtochiama requested a review from jeromegn October 28, 2024 20:16
@somtochiama somtochiama marked this pull request as ready for review October 29, 2024 10:34
Copy link
Member

@jeromegn jeromegn left a comment

Choose a reason for hiding this comment

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

Outlined a few changes that can help reduce complexity and make it more efficient. It's looking pretty good though!

crates/corro-agent/src/api/public/update.rs Outdated Show resolved Hide resolved
crates/corro-types/src/updates.rs Outdated Show resolved Hide resolved
crates/corro-types/src/updates.rs Outdated Show resolved Hide resolved
crates/corro-types/src/updates.rs Outdated Show resolved Hide resolved
It's required by the handler but not getting passed to Axum's middleware
stack.
As the client doesn't import "big" corro-types, move public facing
types to the dedicated crate.
The client is much simpler than the existing subscription client:
 - it doesn't handle I/O error and simply bubble it up (as the user
   still need to handle it)
 - the only possible errors are I/O and deserialization as the /updates
   stream doesn't have a "change id" concept
@pborzenkov pborzenkov merged commit e66f039 into main Dec 10, 2024
3 of 4 checks passed
@pborzenkov pborzenkov deleted the cheaper-updates branch December 10, 2024 11:42
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.

3 participants