-
Notifications
You must be signed in to change notification settings - Fork 152
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
Replication of operations on nested collections #6658
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
else if (type == type_List) { | ||
// throw IllegalOperation("Cannot sync nested list"); | ||
return Instruction::Payload(Instruction::Payload::List()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you intend to keep the commented out throw statements?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to disallow syncing of nested collections until this is supported by the server. So at some point we should throw here,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we throw now and then update it to return the payload when we have server support? Edit: I guess we want it this way so we can test with the legacy sync server right? When will we want to throw then?
Some tests in the |
@danieltabacaru fixed error. |
Nice. There also seems to be a linting error. |
@@ -345,6 +370,7 @@ struct Payload { | |||
switch (lhs.type) { | |||
case Type::Erased: | |||
return true; | |||
case Type::List: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: [[fallthrough]];
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't use [[fallthrough]]; when the labels point to the same code. I collapsed even more cases.
@@ -185,6 +199,9 @@ struct Payload { | |||
/// Note: For Mixed columns (including typed links), no separate value is required, because the | |||
/// instruction set encodes the type of each value in the instruction. | |||
enum class Type : int8_t { | |||
// Special value indicating that a list should be created at the position. | |||
List = -5, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update the comment at line 194. Do we also need an ErasedList
option? Or if Erased
should be used in both cases, then consider updation the comment as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment updated. We just use the normal Instruction::ArrayErase instruction.
6491145
to
d2a07a9
Compare
ac41eaf
to
ec740cf
Compare
src/realm/sync/instructions.hpp
Outdated
struct ObjectValue { | ||
}; | ||
struct ObjectValue {}; | ||
/// Create an empty list in-place (does not clear an existing lsit). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lsit -> list
test/test_sync.cpp
Outdated
{ | ||
ReadTransaction read_1{db_1}; | ||
ReadTransaction read_2{db_2}; | ||
// tr.get_group().to_json(std::cout); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should remove this. same below
|
||
{ | ||
ReadTransaction read_1{db_1}; | ||
ReadTransaction read_2{db_2}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could check both realms have the same data, i.e,:
CHECK(compare_groups(rt_1, rt_2));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work
be93b1a
to
2223b6d
Compare
What, How & Why?
Make sure nested collections can be replicated through our legacy test framework.
☑️ ToDos