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 embedded objects with asymmetric sync #5566

Merged
merged 5 commits into from
Jun 10, 2022

Conversation

danieltabacaru
Copy link
Collaborator

@danieltabacaru danieltabacaru commented Jun 7, 2022

What, How & Why?

Embedded objects were wrongly not allowed in asymmetric sync. This PR addresses that.
Fixes #5565.

☑️ ToDos

  • 📝 Changelog update
  • 🚦 Tests (or not relevant)
  • [ ] C-API, if public C++ API changed.

@cla-bot cla-bot bot added the cla: yes label Jun 7, 2022
@danieltabacaru danieltabacaru requested review from jbreams and jedelbo June 7, 2022 13:55
CppContext c(realm);
Object::create(
c, realm, "Asymmetric",
util::Any(AnyDict{{"_id", ObjectId::gen()}, {"embedded_obj", AnyDict{{"value", std::string{"foo"}}}}}));
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this will exercise the create/set link codepaths, but can we add a test here that updates the embedded field to null and then to a new embedded field as well?

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 add that

});

harness.do_with_new_realm([&](SharedRealm realm) {
wait_for_download(*realm);
Copy link
Contributor

Choose a reason for hiding this comment

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

since there aren't any subscriptions here, isn't this a no-op?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

correct. But it's just to make sure that if for example the server would do something weird, we don't get any objects.

@jbreams
Copy link
Contributor

jbreams commented Jun 8, 2022

@jedelbo , can you take a look as well?

get_table()->check_column(col_key);
ColKey::Idx col_ndx = col_key.get_index();
ColumnType type = col_key.get_type();
if (type != col_type_Link)
throw LogicError(LogicError::illegal_type);
TableRef target_table = get_target_table(col_key);
Table& t = *target_table;
// Outgoing links from asymmetric objects are disallowed.
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps "Only embedded objects are allowed"

@danieltabacaru danieltabacaru force-pushed the dt/allow_embedded_objects_with_asymmetric_sync branch from 2e796bf to 974b390 Compare June 10, 2022 14:27
@danieltabacaru danieltabacaru merged commit b67dd38 into master Jun 10, 2022
@danieltabacaru danieltabacaru deleted the dt/allow_embedded_objects_with_asymmetric_sync branch June 10, 2022 15:46
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Asymmetric sync does not work with embedded objects
3 participants