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