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

Bug: Paths for Synced Realms appear broken #795

Closed
cmelchior opened this issue Apr 20, 2022 · 4 comments · Fixed by #800
Closed

Bug: Paths for Synced Realms appear broken #795

cmelchior opened this issue Apr 20, 2022 · 4 comments · Fixed by #800
Assignees

Comments

@cmelchior
Copy link
Contributor

cmelchior commented Apr 20, 2022

While writing tests for SyncConfiguration.with I noticed that Sync paths appear broken in surprising ways.

It probably happened when we moved support for name() and directory() to Configuration so it is now shared between synced and normal Realms.

@cmelchior
Copy link
Contributor Author

This probably pulls in #412 as well

@cmelchior
Copy link
Contributor Author

cmelchior commented Apr 21, 2022

Intended semantics:

  • Synced Realms should be placed in <syncRoot>/<appId>/<userId>/<filename>. The filename is based on the partition value for partition based sync. It will be default.realm for Flexible Sync.
  • Setting AppConfiguration.syncRootDirectory will the <syncRoot> to whatever is provided
  • Setting SyncConfiguration.directory() will replace the <syncRoot>/<appId>/<userId>/ part.
  • Setting SyncConfiguration.name() will replace the <filename>

realm_sync_client_config_set_base_file_path should set the syncRoot
realm_app_sync_client_get_default_file_path_for_realm should create the entire path including the realm file name.

Given that there are various ways we can customize the path, we need to split the path returned from realm_app_sync_client_get_default_file_path_for_realm. This could be done using SystemUtils.PATH_SEPERATOR

@cmelchior
Copy link
Contributor Author

I do remember some issues with Core setting the root dir name, so if we set the syncroot to /app/files/mongodb-realm/......the path ends up being /app/files/mongodb-realm/mongodb-realm/....

@cmelchior
Copy link
Contributor Author

After discussing, we don't see a use case for having directory for SyncConfigurations. So we should move directory() so it only exists on RealmConfiguration.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants