Repository navigation
drive: constrain list by filter - #5023
Conversation
a1d67ef to
79b6ef0
Compare
79b6ef0 to
1de83d6
Compare
|
@ncw |
1de83d6 to
857bcf2
Compare
|
Integration tests pass for me. |
857bcf2 to
55288f5
Compare
55288f5 to
9599312
Compare
9599312 to
33d52d4
Compare
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
What you are trying to do is make the filters apply to just the backend in question.
However I don't like this approach - there could easily be multiple syncs running at once using the same fi block.
Perhaps what we need is an explicit marker to say to all backends - use the filters. This could be passed in the context.
This needs to pass down the value of the includeAll flag as used in fs/walk and fs/march - applying the flag to the context in those places will make it work for all backends.
So if we made a context variable UseFilters and applied it in those places in fs/walk and fs/march where we actually call Fs.List or Fs.ListR then this would fix it up.
ncw
left a comment
There was a problem hiding this comment.
Apologies for the delay in reviewing - every time I've looked at this PR something has seemed wrong, but I haven't been able to work out why!
I finally figured it out - see the inline comment.
I like the idea of this - it is a great idea and it is worth making work.
5f99ce4 to
a427be9
Compare
a427be9 to
4567baf
Compare
4567baf to
663b23b
Compare
2019614 to
422b1f2
Compare
ncw
left a comment
There was a problem hiding this comment.
Nearly there - looking nice :-)
I put a couple of comments for thought inline.
There was a problem hiding this comment.
I think useFilter should always be !includeAll...
Does that seem correct to you?
There was a problem hiding this comment.
Note:
I didn't introduce the new context flag in every public march/walk function. Instead, I added them selectively in the functions called from sync.Copy/Paste, from operations.List and in Walk which is called from some of them. I didn't touch e.g. list.NewDirList but modified march initialization instead.
I tagged involved functions by a comment line containing the word filter-aware so to simplify analysis a little.
There was a problem hiding this comment.
To me the call stack in march and walk feels so complex that I initially decided to treat such notions as "march side" and "include all" separately:
- passed the "march side" (aka
useFilterwhich is true on the source side) down the stack in context. - passed
includeAllterm as an argument like before. This has an advantage that I don't need to look in every place in the code where it's used.
Now rewritten to obey your review. Then I had to modify the unit test (put in a sidecar commit for visibility) because now query constraining can happen even if drive remote appears on the right side (it's now controlled purely by the march's src/dst includeAll flags).
PTAL 🙏
There was a problem hiding this comment.
Is there no timezone in this time? Or is it guaranteed to be UTC? EIther way this doesn't seem quite right.
There was a problem hiding this comment.
Fixed.
Query times use RFC 3339 format, default timezone is UTC
PTAL 🙏
89ba6bc to
59e9337
Compare
ncw
left a comment
There was a problem hiding this comment.
That looks great now. Not changing the parameters has made the patch quite a bit smaller.
Please merge when ready - thank you :-)
Google Drive API allows for clauses like "modifiedTime > '2012-06-04T12:00:00'" in the query param, so the filter flags --max-age and --min-age can be applied directly at the directory listing phase rather than in a filter. This is extremely helpful when we want to do an incremental backup of a remote drive with many files but the number of recently changed file is small. Co-authored-by: fotile96 <[email protected]>
59e9337 to
9f229d6
Compare
Google Drive API allows for clauses like "modifiedTime > '2012-06-04T12:00:00'" in the query param, so the filter flags --max-age and --min-age can be applied directly at the directory listing phase rather than in a filter. This is extremely helpful when we want to do an incremental backup of a remote drive with many files but the number of recently changed file is small. Co-authored-by: fotile96 <[email protected]>
What is the purpose of this change?
The Google Drive API allows to place a clause like
modifiedTime > '2012-06-04T12:00:00'in the query parameters, so the filterflags--max-ageand--min-agecan be applied directly at the directory listing phase rather than in a filter. This is extremely helpful when we want to do an incremental backup of a remote drive with large number of files but the number of recently changed file is small.Was the change discussed in an issue or in the forum before?
This PR is recovered from the dead PR #3806. See discussion there.
Checklist