mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-11 13:18:53 +00:00
drive: parse depth 1 PROPFIND results to include children in cache
Clients often perform a PROPFIND for the parent directory before performing PROPFIND for specific children within that directory. The PROPFIND for the parent directory is usually done at depth 1, meaning that we already have information for all of the children. By immediately adding that to the cache, we save a roundtrip to the remote peer on the PROPFIND for the specific child. Updates tailscale/corp#19779 Signed-off-by: Percy Wegmann <percy@tailscale.com>
This commit is contained in:

committed by
Percy Wegmann

parent
d86d1e7601
commit
7209c4f91e
@@ -26,6 +26,17 @@ func CleanAndSplit(p string) []string {
|
||||
return strings.Split(strings.Trim(path.Clean(p), sepStringAndDot), sepString)
|
||||
}
|
||||
|
||||
// Normalize normalizes the given path (e.g. dropping trailing slashes).
|
||||
func Normalize(p string) string {
|
||||
return Join(CleanAndSplit(p)...)
|
||||
}
|
||||
|
||||
// Parent extracts the parent of the given path.
|
||||
func Parent(p string) string {
|
||||
parts := CleanAndSplit(p)
|
||||
return Join(parts[:len(parts)-1]...)
|
||||
}
|
||||
|
||||
// Join behaves like path.Join() but also includes a leading slash.
|
||||
func Join(parts ...string) string {
|
||||
fullParts := make([]string, 0, len(parts))
|
||||
|
Reference in New Issue
Block a user