dav

package
v4.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: AGPL-3.0 Imports: 33 Imported by: 0

Documentation

Overview

Package dav provides a REST gateway to communicate with pydio backend via the webdav protocol.

Index

Constants

This section is empty.

Variables

View Source
var (
	MultipartSize int64 = 20 * 1024 * 1024
)

Functions

func GetHandler added in v4.3.2

func GetHandler(ctx context.Context, davPrefix, routerPrefix string) (http.Handler, nodes.Handler)

GetHandler is public to let external package spinning a DAV http handler

func NewMemLS added in v4.2.2

func NewMemLS() webdav.LockSystem

NewMemLS returns a new in-memory LockSystem.

func RouterWithOptionalPrefix added in v4.3.2

func RouterWithOptionalPrefix(runtime context.Context, s ...string) nodes.Handler

Types

type File

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

File implements the webdav.File interface and translates various file accesses into object client PutObject / GetObject calls.

func (*File) Close

func (f *File) Close() error

Close closes the underlying reader if it is open

func (*File) Read

func (f *File) Read(p []byte) (int, error)

Read reads the requested number of bytes starting at the internal cursor. It updates the cursor afterward.

func (*File) ReadFrom

func (f *File) ReadFrom(r io.Reader) (n int64, err error)

ReadFrom bypasses the usual Reader interface to implement multipart uploads to the minio server, rather than using the default Write method that is called by webdav via io.Copy. It enables among others the definition of a part size that is more appropriate than the default 32K used by io.COPY

func (*File) Readdir

func (f *File) Readdir(count int) ([]os.FileInfo, error)

Readdir lists the directory children as a slice of os.FileInfo

func (*File) Seek

func (f *File) Seek(offset int64, whence int) (int64, error)

Seek sets the internal pointer, and clearing any existing reader

func (*File) Stat

func (f *File) Stat() (os.FileInfo, error)

Stat returns an os.FileInfo, calling the underlying fs if it is not already loaded

func (*File) Write

func (f *File) Write(p []byte) (int, error)

Write is unused but left to respect Writer interface. This method is bypassed by io.Copy to use ReadFrom (see above)

type FileSystem

type FileSystem struct {
	Debug  bool
	Router nodes.Handler
	// contains filtered or unexported fields
}

FileSystem is the pydio specific implementation of the generic webdav.FileSystem interface It adds among others a reference to the Router and a mutex

func (*FileSystem) Mkdir

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

func (*FileSystem) OpenFile

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

OpenFile is called before a put or a simple get to retrieve a given file

func (*FileSystem) RemoveAll

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

RemoveAll deletes all resources starting at the given path

func (*FileSystem) Rename

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

Rename updates underlying node name

func (*FileSystem) Stat

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

Stat creates an os.FileInfo from the internal router.ReadNode() method

type ValidUser

type ValidUser struct {
	Hash      string
	Connexion time.Time
	Claims    claim.Claims
}

Jump to

Keyboard shortcuts

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