pydio / cells-sync

Sync Client for Pydio Cells
https://pydio.com
GNU General Public License v3.0
37 stars 16 forks source link

Improve Selective Sync #24

Open manuth opened 4 years ago

manuth commented 4 years ago

General

The selective sync might become a very powerful but there are some troubles with it atm. Currently it's not possible to sync the root using selective sync.

So let's say we have this tree:

Documents
├───Keys
├───School
└───Work

If I decide to sync the Documents folder and enable the Selective Sync I cannot sync the files inside the Documents folder as only Keys, Schook and Work can be selected when hitting Select folder(s).

Also excluding sub-nodes is not possible. If we assume we have this tree:

Personal Files
└─── [x] Documents
    ├─── [ ] Keys
    ├─── [x] School
    └─── [x] Work

If I decide to sync the "Personal Files" and I want to perform a selective sync of Documents, School and Work, but not Keys though I can deselect Keys in the Select folder(s) dialogue but it still would sync Keys because Documents is selected.

One more case that isn't covered using the current implementation of the selective sync: Think of implementing some sort of "ExcludedRoots" it wouldn't be possible to include subnodes of them:

Personal Files
└─── [x] Documents
    ├─── [ ] Keys
    │       ├─── [x] KeePass
    │       └─── [ ] SSH
    ├─── [x] School
    └─── [x] Work

If I would want to exclude Keys but include the KeePass directory it wouldn't be possible as the parent node Keys is excluded already.

Conclusion and Examples

This leads me to following recommendation:

Rework the SelectireRoots-option of the config-schema to look the following:

"LeftURI": "https://[...]/Documents",
"SelectiveRoots": [
    { "Path": "/", "Include": true },
    { "Path": "/Keys", "Include": false },
    { "Path": "/Keys/KeePass", "Include": true }
]

The entries would then be processed by the order of their appearance, which means:

  1. "/" is included
  2. "/Keys" is excluded, but...
  3. ..."/Keys/KeePass" is included

Also I'd recommend to enable the checkboxes in the Select folder(s) dialogue to match the current config. That way the initial state of said dialoue would represent to current settings.

Another example:

"LeftURI": "https://[...]/Documents",
"SelectiveRoots": [
    { "Path": "/", "Include": true },
    { "Path": "/Keys/KeePass", "Include": true },
    { "Path": "/Keys", "Include": false }
]
  1. "/" is included
  2. "/Keys/KeePass" is included
  3. "/Keys" is excluded which causes "/Keys/KeePass" to be excluded as well
manuth commented 4 years ago

Another way the schema could be reworked would be some sort of an "Action"-field to set a single action or an array of actions. This would allow to implement more actions yet to come for single folders:

"LeftURI": "https://[...]/Documents",
"SelectiveRoots": [
    { "Path": "/", "Action": "Include" },
    { "Path": "/Keys", "Action": "Ignore (or 'Exclude')" },
    { "Path": "/Keys/KeePass", "Action": "Include" }
]
callmelex commented 2 years ago

I also need this feature. But I think an ignore list ( for folders & files ) is enough, keep it simple.