mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-08-16 20:26:45 +00:00
* mount: tell windows about changes made elsewhere Nothing invalidates a Windows client's cache from this side, so a file created or removed by another mount, the S3 gateway or the filer API stayed invisible in Explorer until the user refreshed by hand. The mount already receives those events; they just had nowhere to go. WFS gains a listener for every applied metadata event, and on Windows that turns into the WinFsp notification for the path. A rename reports both ends, since the destination's own event may never arrive when it falls outside this mount. * mount: report a removed directory as a directory Entry is nil once a path is vacated, so asking it whether the thing that went away was a directory always answered no and every removal was reported as a file. Windows watches the two through different filters, so a folder removed elsewhere never refreshed. The invalidation now carries what used to be there, which the event already knew and simply was not passing on. * mount: report a rename destination once The event stream already carries a second invalidation describing the new path, so reporting RenamedTo here sent the destination twice — and always as a create, so a moved directory arrived as a create followed by a mkdir.
26 lines
646 B
Go
26 lines
646 B
Go
package winfsp
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/seaweedfs/seaweedfs/weed/util"
|
|
)
|
|
|
|
// relativeToMount rebases a filer path onto the mount root. Metadata events
|
|
// cover the whole subscription, so a path outside this mount is not ours to
|
|
// report, and a sibling whose name merely starts with the root is not inside
|
|
// it either.
|
|
func relativeToMount(root, path util.FullPath) (string, bool) {
|
|
full, prefix := string(path), string(root)
|
|
if prefix == "" || prefix == "/" {
|
|
return full, full != ""
|
|
}
|
|
if full == prefix {
|
|
return "/", true
|
|
}
|
|
if !strings.HasPrefix(full, prefix+"/") {
|
|
return "", false
|
|
}
|
|
return full[len(prefix):], true
|
|
}
|