vfscache

package
v1.52.3-0...-16af9ab Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package vfscache deals with caching of files locally for the VFS layer

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache opened files

func New

func New(ctx context.Context, fremote fs.Fs, opt *vfscommon.Options) (*Cache, error)

New creates a new cache heirachy for fremote

This starts background goroutines which can be cancelled with the context passed in.

func (*Cache) Check

func (c *Cache) Check(ctx context.Context, o fs.Object, remote string) error

Check the local file is up to date in the cache

func (*Cache) CleanUp

func (c *Cache) CleanUp() error

CleanUp empties the cache of everything

func (*Cache) Close

func (c *Cache) Close(name string)

Close marks name as closed

name should be a remote path not an osPath

func (*Cache) Exists

func (c *Cache) Exists(name string) bool

Exists checks to see if the file exists in the cache or not

func (*Cache) Fetch

func (c *Cache) Fetch(ctx context.Context, o fs.Object, remote string) error

Fetch fetches the object to the cache file

func (*Cache) Mkdir

func (c *Cache) Mkdir(name string) (string, error)

Mkdir makes the directory for name in the cache and returns an os path for the file

name should be a remote path not an osPath

func (*Cache) Open

func (c *Cache) Open(name string)

Open marks name as open

name should be a remote path not an osPath

func (*Cache) Opens

func (c *Cache) Opens(name string) int

Opens returns the number of opens that are on the file

name should be a remote path not an osPath

func (*Cache) Remove

func (c *Cache) Remove(name string)

Remove should be called if name is deleted

func (*Cache) Rename

func (c *Cache) Rename(name string, newName string) (err error)

Rename the file in cache

func (*Cache) SetModTime

func (c *Cache) SetModTime(name string, modTime time.Time)

SetModTime should be called to set the modification time of the cache file

func (*Cache) Store

func (c *Cache) Store(ctx context.Context, objOld fs.Object, remote string) (fs.Object, error)

Store stores the local cache file to the remote object, returning the new remote object. objOld is the old object if known.

func (*Cache) ToOSPath

func (c *Cache) ToOSPath(name string) string

ToOSPath turns a remote relative name into an OS path in the cache

Jump to

Keyboard shortcuts

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