mirror of
https://github.com/rclone/rclone.git
synced 2025-12-06 00:03:32 +00:00
vfs: add read write files and caching #711
This adds new flags to mount, cmount, serve *
--cache-max-age duration Max age of objects in the cache. (default 1h0m0s)
--cache-mode string Cache mode off|minimal|writes|full (default "off")
--cache-poll-interval duration Interval to poll the cache for stale objects. (default 1m0s)
This commit is contained in:
10
vfs/dir.go
10
vfs/dir.go
@@ -306,9 +306,12 @@ func (d *Dir) ReadDirAll() (items Nodes, err error) {
|
||||
return items, nil
|
||||
}
|
||||
|
||||
// accessModeMask masks off the read modes from the flags
|
||||
const accessModeMask = (os.O_RDONLY | os.O_WRONLY | os.O_RDWR)
|
||||
|
||||
// Open the directory according to the flags provided
|
||||
func (d *Dir) Open(flags int) (fd Handle, err error) {
|
||||
rdwrMode := flags & (os.O_RDONLY | os.O_WRONLY | os.O_RDWR)
|
||||
rdwrMode := flags & accessModeMask
|
||||
if rdwrMode != os.O_RDONLY {
|
||||
fs.Errorf(d, "Can only open directories read only")
|
||||
return nil, EPERM
|
||||
@@ -498,3 +501,8 @@ func (d *Dir) Fsync() error {
|
||||
func (d *Dir) VFS() *VFS {
|
||||
return d.vfs
|
||||
}
|
||||
|
||||
// Truncate changes the size of the named file.
|
||||
func (d *Dir) Truncate(size int64) error {
|
||||
return ENOSYS
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user