2022-08-28 19:21:57 +08:00
|
|
|
// Package vfscommon provides utilities for VFS.
|
2020-02-28 22:44:15 +08:00
|
|
|
package vfscommon
|
|
|
|
|
|
|
|
import (
|
2020-12-12 01:48:09 +08:00
|
|
|
"github.com/rclone/rclone/fs"
|
2020-02-28 22:44:15 +08:00
|
|
|
)
|
|
|
|
|
2023-09-27 22:31:47 +08:00
|
|
|
type cacheModeChoices struct{}
|
|
|
|
|
|
|
|
func (cacheModeChoices) Choices() []string {
|
|
|
|
return []string{
|
|
|
|
CacheModeOff: "off",
|
|
|
|
CacheModeMinimal: "minimal",
|
|
|
|
CacheModeWrites: "writes",
|
|
|
|
CacheModeFull: "full",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-28 22:44:15 +08:00
|
|
|
// CacheMode controls the functionality of the cache
|
2023-09-27 22:31:47 +08:00
|
|
|
type CacheMode = fs.Enum[cacheModeChoices]
|
2020-02-28 22:44:15 +08:00
|
|
|
|
|
|
|
// CacheMode options
|
|
|
|
const (
|
|
|
|
CacheModeOff CacheMode = iota // cache nothing - return errors for writes which can't be satisfied
|
2020-10-14 05:49:58 +08:00
|
|
|
CacheModeMinimal // cache only the minimum, e.g. read/write opens
|
2020-02-28 22:44:15 +08:00
|
|
|
CacheModeWrites // cache all files opened with write intent
|
|
|
|
CacheModeFull // cache all files opened in any mode
|
|
|
|
)
|
|
|
|
|
|
|
|
// Type of the value
|
2023-09-27 22:31:47 +08:00
|
|
|
func (cacheModeChoices) Type() string {
|
2020-02-28 22:44:15 +08:00
|
|
|
return "CacheMode"
|
|
|
|
}
|