github.com/rclone/rclone@v1.66.1-0.20240517100346-7b89735ae726/vfs/vfscommon/cachemode.go (about)

     1  // Package vfscommon provides utilities for VFS.
     2  package vfscommon
     3  
     4  import (
     5  	"github.com/rclone/rclone/fs"
     6  )
     7  
     8  type cacheModeChoices struct{}
     9  
    10  func (cacheModeChoices) Choices() []string {
    11  	return []string{
    12  		CacheModeOff:     "off",
    13  		CacheModeMinimal: "minimal",
    14  		CacheModeWrites:  "writes",
    15  		CacheModeFull:    "full",
    16  	}
    17  }
    18  
    19  // CacheMode controls the functionality of the cache
    20  type CacheMode = fs.Enum[cacheModeChoices]
    21  
    22  // CacheMode options
    23  const (
    24  	CacheModeOff     CacheMode = iota // cache nothing - return errors for writes which can't be satisfied
    25  	CacheModeMinimal                  // cache only the minimum, e.g. read/write opens
    26  	CacheModeWrites                   // cache all files opened with write intent
    27  	CacheModeFull                     // cache all files opened in any mode
    28  )
    29  
    30  // Type of the value
    31  func (cacheModeChoices) Type() string {
    32  	return "CacheMode"
    33  }