vfscommon

package
v1.61.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2022 License: MIT Imports: 7 Imported by: 32

Documentation

Overview

Package vfscommon provides utilities for VFS.

Index

Constants

This section is empty.

Variables

View Source
var DefaultOpt = Options{
	NoModTime:          false,
	NoChecksum:         false,
	NoSeek:             false,
	DirCacheTime:       5 * 60 * time.Second,
	PollInterval:       time.Minute,
	ReadOnly:           false,
	Umask:              0,
	UID:                ^uint32(0),
	GID:                ^uint32(0),
	DirPerms:           os.FileMode(0777),
	FilePerms:          os.FileMode(0666),
	CacheMode:          CacheModeOff,
	CacheMaxAge:        3600 * time.Second,
	CachePollInterval:  60 * time.Second,
	ChunkSize:          128 * fs.Mebi,
	ChunkSizeLimit:     -1,
	CacheMaxSize:       -1,
	CaseInsensitive:    runtime.GOOS == "windows" || runtime.GOOS == "darwin",
	WriteWait:          1000 * time.Millisecond,
	ReadWait:           20 * time.Millisecond,
	WriteBack:          5 * time.Second,
	ReadAhead:          0 * fs.Mebi,
	UsedIsSize:         false,
	DiskSpaceTotalSize: -1,
}

DefaultOpt is the default values uses for Opt

Functions

func FindParent

func FindParent(name string) string

FindParent returns the parent directory of name, or "" for the root for rclone paths.

func OSFindParent added in v1.59.0

func OSFindParent(name string) string

OSFindParent returns the parent directory of name, or "" for the root for OS native paths.

Types

type CacheMode

type CacheMode byte

CacheMode controls the functionality of the cache

const (
	CacheModeOff     CacheMode = iota // cache nothing - return errors for writes which can't be satisfied
	CacheModeMinimal                  // cache only the minimum, e.g. read/write opens
	CacheModeWrites                   // cache all files opened with write intent
	CacheModeFull                     // cache all files opened in any mode
)

CacheMode options

func (*CacheMode) Set

func (l *CacheMode) Set(s string) error

Set a CacheMode

func (CacheMode) String

func (l CacheMode) String() string

String turns a CacheMode into a string

func (*CacheMode) Type

func (l *CacheMode) Type() string

Type of the value

func (*CacheMode) UnmarshalJSON added in v1.55.0

func (l *CacheMode) UnmarshalJSON(in []byte) error

UnmarshalJSON makes sure the value can be parsed as a string or integer in JSON

type Options

type Options struct {
	NoSeek             bool          // don't allow seeking if set
	NoChecksum         bool          // don't check checksums if set
	ReadOnly           bool          // if set VFS is read only
	NoModTime          bool          // don't read mod times for files
	DirCacheTime       time.Duration // how long to consider directory listing cache valid
	PollInterval       time.Duration
	Umask              int
	UID                uint32
	GID                uint32
	DirPerms           os.FileMode
	FilePerms          os.FileMode
	ChunkSize          fs.SizeSuffix // if > 0 read files in chunks
	ChunkSizeLimit     fs.SizeSuffix // if > ChunkSize double the chunk size after each chunk until reached
	CacheMode          CacheMode
	CacheMaxAge        time.Duration
	CacheMaxSize       fs.SizeSuffix
	CachePollInterval  time.Duration
	CaseInsensitive    bool
	WriteWait          time.Duration // time to wait for in-sequence write
	ReadWait           time.Duration // time to wait for in-sequence read
	WriteBack          time.Duration // time to wait before writing back dirty files
	ReadAhead          fs.SizeSuffix // bytes to read ahead in cache mode "full"
	UsedIsSize         bool          // if true, use the `rclone size` algorithm for Used size
	FastFingerprint    bool          // if set use fast fingerprints
	DiskSpaceTotalSize fs.SizeSuffix
}

Options is options for creating the vfs

func (*Options) Init added in v1.59.0

func (opt *Options) Init()

Init the options, making sure everything is withing range

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL