Skip to content

Provide Unique ID for directories #3593

Description

@dragotin

To detect that a directory was not changed, it would be good if (at least) every directory could provide a unique ID through a PROPFIND on the directory. The ID must never change, also not on rename.

The usecase is that clients will store the ID and use to detect if it's still the same ID or if the directory has changed. In that case the client journal needs to be deactivated.

This is an enhancement that we need to detect if people removed the server dir and recreated it with the same name.

Activity

  1. karlitschek commented on Jun 5, 2013

    @karlitschek
    Contributor

    Makes sense. @icewind1991 @bartv2 What do you think?

  2. danimo commented on Oct 10, 2013

    @danimo
    Contributor

    Any news here?

  3. karlitschek commented on Oct 10, 2013

    @karlitschek
    Contributor

    why has this an engineering flag? Who did this?

  4. icewind1991 commented on Oct 10, 2013

    @icewind1991
    Contributor

    There is the file ID which all folders have which stays the same after a rename. I'm not sure id that's exposed over webdav though

  5. dragotin commented on Oct 20, 2013

    @dragotin
    ContributorAuthor

    This is what a PROPFIND on a directory returns:

    dav:/ocm/remote.php/webdav/> propget goof
    Fetching properties for `goof':
    DAV: getetag = "525faa3288c8b"
    DAV: getlastmodified = Thu, 17 Oct 2013 09:13:22 GMT
    DAV: resourcetype = <DAV:collection></DAV:collection>
    DAV: quota-used-bytes = 2070
    DAV: quota-available-bytes = 20529418240
    

    I don't think the id is promoted. Can we still add that to the oC6 codebase? Otherwise we can not detect renames while syncing.

  6. karlitschek commented on Oct 20, 2013

    @karlitschek
    Contributor

    @icewind1991 Is it possible to add it?

  7. DeepDiver1975 commented on Oct 20, 2013

    @DeepDiver1975
    Contributor

    I don't think the id is promoted. Can we still add that to the oC6 codebase? Otherwise we can not detect renames while syncing.

    Should not be that hard @icewind1991 can you take care? Otherwise I'll hack this tomorrow - let me know. THX

  8. DeepDiver1975 commented on Oct 20, 2013

    @DeepDiver1975
    Contributor

    Is it possible to add it?

    yes 😉

  9. karlitschek commented on Oct 20, 2013

    @karlitschek
    Contributor

    Hehe. Same comment in the same second. Must be true ;-)

  10. dragotin commented on Oct 21, 2013

    @dragotin
    ContributorAuthor

    Actually I need to correct myself here: We do not need an API to check if the server knows an file with a given ID. The reason is: We do the update phase as the first step, and than we know all IDs the server knows. Thanks to @ogoffart who pushed me on the right way.

  11. ogoffart commented on Oct 22, 2013

    @ogoffart

    The easiest way would be to change the etag to ensure that:

    • Two different files always have different etags.
    • The etag does not change when a file is moved or renamed.

    (Note: using md5 as etag satify this properties)

    Even if another field is used for unique id, the etag also need not to change when a file is moved because else we don't know if the file has just been moved, or if it has been moved AND modified

  12. ogoffart commented on Oct 22, 2013

    @ogoffart

    My previous comment was talking about files, not about directory.
    But we probably do not need more for directories. Because if we detect that all files within a directory have been moved, that's enough not to download them again (they can all be moved one by one and that will be sufficiently fast)
    But it wouold be perfect if:

    • Two different directories always have a different etag
    • The etag do not change when a directory is moved or renamed and no other change was done within the directory.
  13. dragotin commented on Oct 22, 2013

    @dragotin
    ContributorAuthor

    This is status quo:

    • the etag of a directory does not change if it is moved (tested through cadaver)
    • all etags are different from each other for different file. Is that true @DeepDiver1975 ??

    I think it will be an issue earlier or later if all files are moved separately. But I also think that if we can detect the moves of all files in the update phase, the new propagator will be able to be smart and find out the minimum amount of moves needed to achieve that.

  14. DeepDiver1975 commented on Oct 22, 2013

    @DeepDiver1975
    Contributor

    this is the function which is used:
    http://php.net/manual/en/function.uniqid.php

    Am Dienstag, dem 22.10.2013 um 19:09 schrieb dragotin:

    This is status quo:

    • the etag of a directory does not change if it is moved (tested through cadaver)
    • all etags are different from each other for different file. Is that true @DeepDiver1975 ??

    I think it will be an issue earlier or later if all files are moved separately. But I also think that if we can detect the moves of all files in the update phase, the new propagator will be able to be smart and find out the minimum amount of moves needed to achieve that.


    Reply to this email directly or view it on GitHub:
    #3593 (comment)

  15. icewind1991 commented on Oct 22, 2013

    @icewind1991
    Contributor

    Etags are not unique, they are currently unique within a single storage backend but mounting a backend twice gives you two files with the same etag, I also believe a shared file will have the same etag for every shared instance of the file.

  16. ogoffart commented on Oct 23, 2013

    @ogoffart

    If the file is the same, then it is fine. Then we can optimize and do a copy locally instead of re-downloading.

  17. icewind1991 commented on Oct 23, 2013

    @icewind1991
    Contributor

    I still wouldn't assume uniqueness of etag's, they are unique in the current implementation but there is no guaranty that that will remain that way.

    Only file id's are guaranteed to be unique.

  18. DeepDiver1975 commented on Oct 23, 2013

    @DeepDiver1975
    Contributor

    as just discussed: I'll implement this ...

  19. karlitschek commented on Oct 23, 2013

    @karlitschek
    Contributor

    you rock!

  20. dragotin commented on Oct 25, 2013

    @dragotin
    ContributorAuthor

    Two more requests:

    • Please turn the the two tupels around to put the faster changing part in front.
    • Please add the file ID as an additional header to the PUT reply similar to what we do with the etag. That saves additional requests. Please name it X-OC-FileID similar to the modification time.
  21. locked as resolved and limited conversation to collaborators on Aug 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions