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