filelocker

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: May 17, 2021 License: MIT 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
}

See the handler.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) (handler.Lock, error)

func (FileLocker) UseIn

func (locker FileLocker) UseIn(composer *handler.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