mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 11:35:21 +08:00
dircache: add SetRootIDAlias to update RootID from FindLeaf
This commit is contained in:
parent
af705c754c
commit
07fcba888c
|
@ -126,6 +126,20 @@ func (dc *DirCache) Flush() {
|
|||
dc.cacheMu.Unlock()
|
||||
}
|
||||
|
||||
// SetRootIDAlias sets the rootID to that passed in. This assumes that
|
||||
// the new ID is just an alias for the old ID so does not flush
|
||||
// anything.
|
||||
//
|
||||
// This should be called from FindLeaf (and only from FindLeaf) if it
|
||||
// is discovered that the root ID is incorrect. For example some
|
||||
// backends use "0" as a root ID, but it has a real ID which is needed
|
||||
// for some operations.
|
||||
func (dc *DirCache) SetRootIDAlias(rootID string) {
|
||||
// No locking as this is called from FindLeaf
|
||||
dc.rootID = rootID
|
||||
dc.Put("", dc.rootID)
|
||||
}
|
||||
|
||||
// FlushDir flushes the map of all data starting with with the path
|
||||
// dir.
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue
Block a user