forked from TrueCloudLab/rclone
dircache: add SetRootIDAlias to update RootID from FindLeaf
This commit is contained in:
parent
af705c754c
commit
07fcba888c
1 changed files with 14 additions and 0 deletions
|
@ -126,6 +126,20 @@ func (dc *DirCache) Flush() {
|
||||||
dc.cacheMu.Unlock()
|
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
|
// FlushDir flushes the map of all data starting with with the path
|
||||||
// dir.
|
// dir.
|
||||||
//
|
//
|
||||||
|
|
Loading…
Add table
Reference in a new issue