lock

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLockNotFound = errors.New("lock not found")
)

Functions

func NewSystem

func NewSystem(store Store) webdav.LockSystem

NewSystem creates a new lock system.

Types

type LockNode

type LockNode struct {
	Details webdav.LockDetails
	Token   string
	Expiry  time.Time
}

type MemoryStore

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

func NewMemoryStore

func NewMemoryStore() *MemoryStore

func (*MemoryStore) ApplyLock

func (m *MemoryStore) ApplyLock(node *LockNode, paths ...string) error

ApplyLock implements Store.

func (*MemoryStore) GetLock

func (m *MemoryStore) GetLock(token string) (*LockNode, error)

GetLock implements Store.

func (*MemoryStore) GetLocksByPath

func (m *MemoryStore) GetLocksByPath(path string) ([]*LockNode, error)

GetLocksByPath implements Store.

func (*MemoryStore) RemoveLock

func (m *MemoryStore) RemoveLock(token string) error

RemoveLock implements Store.

type Store

type Store interface {
	GetLock(token string) (*LockNode, error)
	GetLocksByPath(path string) ([]*LockNode, error)
	ApplyLock(node *LockNode, paths ...string) error
	RemoveLock(token string) error
}

type System

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

System implements webdav.LockSystem. It is safe for concurrent use by multiple goroutines.

func (*System) Confirm

func (s *System) Confirm(now time.Time, name0, name1 string, conditions ...webdav.Condition) (func(), error)

Confirm verifies that the given conditions allow access to the named resource. It returns a release function if the access is granted.

func (*System) Create

func (s *System) Create(now time.Time, details webdav.LockDetails) (string, error)

Create creates a new lock.

func (*System) Refresh

func (s *System) Refresh(now time.Time, token string, duration time.Duration) (webdav.LockDetails, error)

Refresh refreshes an existing lock.

func (*System) Unlock

func (s *System) Unlock(now time.Time, token string) error

Unlock removes a lock.

Jump to

Keyboard shortcuts

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