webdavfs

package
v0.0.0-...-288f078 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: AGPL-3.0, Apache-2.0, CC-BY-SA-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package webdavfs adds special behaviors to an arvados.FileSystem so it's suitable to use with a webdav server.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrReadOnly = errors.New("read-only filesystem")
)
View Source
var NoLockSystem = noLockSystem{}

NoLockSystem implements webdav.LockSystem by returning success for every possible locking operation, even though it has no side effects such as actually locking anything. This works for a read-only webdav filesystem because webdav locks only apply to writes.

This is more suitable than webdav.NewMemLS() for two reasons: First, it allows keep-web to use one locker for all collections even though coll1.vhost/foo and coll2.vhost/foo have the same path but represent different resources. Additionally, it returns valid tokens (rfc2518 specifies that tokens are represented as URIs and are unique across all resources for all time), which might improve client compatibility.

However, it does also permit impossible operations, like acquiring conflicting locks and releasing non-existent locks. This might confuse some clients if they try to probe for correctness.

Currently this is a moot point: the LOCK and UNLOCK methods are not accepted by keep-web, so it suffices to implement the webdav.LockSystem interface.

Functions

This section is empty.

Types

type FS

type FS struct {
	FileSystem arvados.FileSystem
	// Prefix works like fs.Sub: Stat(name) calls
	// Stat(prefix+name) in the wrapped filesystem.
	Prefix string
	// If Writing is false, all write operations return errors.
	// (Opening a file for writing succeeds -- otherwise webdav
	// would return 404 -- but writing to it fails.)
	Writing bool
	// webdav PROPFIND reads the first few bytes of each file
	// whose filename extension isn't recognized, which is
	// prohibitively expensive: we end up fetching multiple 64MiB
	// blocks. Avoid this by returning EOF on all reads when
	// handling a PROPFIND.
	AlwaysReadEOF bool
}

FS implements a webdav.FileSystem by wrapping an arvados.CollectionFilesystem.

func (*FS) Mkdir

func (fs *FS) Mkdir(ctx context.Context, name string, perm os.FileMode) error

func (*FS) OpenFile

func (fs *FS) OpenFile(ctx context.Context, name string, flag int, perm os.FileMode) (f webdav.File, err error)

func (*FS) RemoveAll

func (fs *FS) RemoveAll(ctx context.Context, name string) error

func (*FS) Rename

func (fs *FS) Rename(ctx context.Context, oldName, newName string) error

func (*FS) Stat

func (fs *FS) Stat(ctx context.Context, name string) (os.FileInfo, error)

Jump to

Keyboard shortcuts

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