filelocker

package
v2.0.16 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package filelocker provide an upload locker based on the local file system.

It provides an exclusive upload locking mechanism using lock files which are stored on disk. Each of them stores the PID of the process which acquired the lock. This allows locks to be automatically freed when a process is unable to release it on its own because the process is not alive anymore. For more information, consult the documentation for handler.LockerDataStore interface, which is implemented by FileLocker.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileLocker

type FileLocker struct {
	// Relative or absolute path to store files in. FileStore does not check
	// whether the path exists, use os.MkdirAll in this case on your own.
	Path string
}

FileLocker See the tus.DataStore interface for documentation about the different methods.

func New

func New(path string) FileLocker

New creates a new file based storage backend. The directory specified will be used as the only storage entry. This method does not check whether the path exists, use os.MkdirAll to ensure. In addition, a locking mechanism is provided.

func (FileLocker) NewLock

func (locker FileLocker) NewLock(id string) (tus.Lock, error)

func (FileLocker) UseIn

func (locker FileLocker) UseIn(composer *tus.StoreComposer)

UseIn adds this locker to the passed composer.

Jump to

Keyboard shortcuts

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