1
mirror of https://github.com/rclone/rclone synced 2024-12-22 13:03:02 +01:00
rclone/vfs/vstate_string.go
Nick Craig-Wood 06a12f5e27 vfs: stop virtual directory entries dropping out of the directory cache
Rclone adds virtual directory entries to the directory cache when it
creates a file or directory.

Before this change these dropped out of the directory cache when the
directory cache was reloaded. This meant that when the directory cache
expired:

- On bucket based backends, empty directories would disappear
- When using VFS writeback, files in the process of uploading would disappear

This is fixed by keeping track of the virtual entries in each
directory. The virtual entries are removed when they become real - ie
the object is read back from the listing.

This also keeps tracks of deletes in the same way so if a file is
deleted, it will not re-appear when the directory cache is reloaded if
the deletion hasn't finished yet.
2020-06-30 12:03:39 +01:00

26 lines
594 B
Go

// Code generated by "stringer -type=vState"; DO NOT EDIT.
package vfs
import "strconv"
func _() {
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
var x [1]struct{}
_ = x[vOK-0]
_ = x[vAdd-1]
_ = x[vDel-2]
}
const _vState_name = "vOKvAddvDel"
var _vState_index = [...]uint8{0, 3, 7, 11}
func (i vState) String() string {
if i >= vState(len(_vState_index)-1) {
return "vState(" + strconv.FormatInt(int64(i), 10) + ")"
}
return _vState_name[_vState_index[i]:_vState_index[i+1]]
}