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 support for Unsorted List #25

Open
dgarros opened this issue Oct 23, 2020 · 3 comments
Open

Add support for Unsorted List #25

dgarros opened this issue Oct 23, 2020 · 3 comments
Labels
status: gathering feedback Further discussion is needed to determine this issue's scope and/or implementation type: enhancement

Comments

@dgarros
Copy link
Contributor

dgarros commented Oct 23, 2020

Environment

  • DSync version: master

Proposed Functionality

Currently when an attribute is defined as a list, DSync will report a diff if the lists have the same content but in a different order.
In some cases that's the expected behavior but in other cases the order doesn't matter and it's hard to predict how things will be loaded on both adapters.
It would be great to be able to explicitly define if a list should be sorted or not when we are calculating the diff.

Use Case

In some cases it's hard to predict how a list will be loaded which can lead to false positive when we are generating the diff. A possible workaround is to ensure that, as we construct the list, the content is always ordered but it adds some complexity in the adapter.

@glennmatthews
Copy link
Collaborator

Can we just use set instead of list in this case, or is there a case where we want to preserve the order within the adapter and just ignore order when diffing?

@itdependsnetworks
Copy link
Contributor

Speaking a bit out of school here, but I do think we want to keep order, but sometimes diff unordered

@glennmatthews
Copy link
Collaborator

That makes sense. This should be relatively simple to do within the scope of the existing DSyncModelFlags paradigm if we want this to be toggle at a per-model level; if we need it to be configurable at a per-field level (e.g. Site.devices should be sorted while Site.vlans should be unsorted) then that will of course be more complex to implement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: gathering feedback Further discussion is needed to determine this issue's scope and/or implementation type: enhancement
Projects
None yet
Development

No branches or pull requests

3 participants