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

Real-time Sync: Add base traits/interfaces #508

Closed
wants to merge 8 commits into from

Conversation

hydra-yse
Copy link
Collaborator

Closes #501

@hydra-yse hydra-yse changed the base branch from main to real-time-sync September 28, 2024 15:29
Copy link
Member

@roeierez roeierez left a comment

Choose a reason for hiding this comment

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

Looks good. Dropped some comments.

lib/core/src/sync/model/mod.rs Outdated Show resolved Hide resolved
lib/core/src/sync/model/mod.rs Outdated Show resolved Hide resolved
async fn get_changes_since(&self, record_index: u64) -> Result<Vec<Record>>;

/// Adds a record to the remote
async fn set_record(&self, data: SyncData) -> Result<()>;
Copy link
Member

Choose a reason for hiding this comment

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

Since we are using a list of Records as response to get_changes_since I think we should stick to that structure also on set_record. SyncData seems a higher abstraction.

Copy link
Collaborator Author

@hydra-yse hydra-yse Oct 1, 2024

Choose a reason for hiding this comment

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

That's actually been changed in #509, see here. I opted for having get_changes_since also decode the data.

Also, the reason why set_record does not take a record itself is because we populate the id and version fields automatically:

  • id gets the latestRecordId from the local database
  • version is the current schema verison

Copy link
Member

Choose a reason for hiding this comment

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

@hydra-yse it is hard to review this PR by looking at changes in another PR.
I think either merge both into one PR or move the fixes that are related here to this PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure, I'll merge the new interface definition here.

Copy link
Member

Choose a reason for hiding this comment

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

The fact that we have a trait with set_record & get_changes_since means we have another implementation that will use these which will be triggered by the app. I think we need to see that implementation before we can determine if we need the interface to look like this.
I am OK with merging both PRs together, move to the implementation of the sync itself (at least partial) so we can review that effectively.

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.

Real-time Sync: trait implementation and basic interfaces
2 participants