Show / Hide Table of Contents

Class LockManagerBase

The base implementation for an ILockManager

Inheritance
Object
LockManagerBase
InMemoryLockManager
SQLiteLockManager
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace:FubarDev.WebDavServer.Locking
Assembly:FubarDev.WebDavServer.dll
Syntax
public abstract class LockManagerBase : ILockManager
Remarks

The derived class must implement BeginTransactionAsync(CancellationToken) and return an object that implements LockManagerBase.ILockManagerTransaction.

Constructors

| Improve this Doc View Source

LockManagerBase(ILockCleanupTask, ISystemClock, ILogger, ILockManagerOptions)

Initializes a new instance of the LockManagerBase class.

Declaration
protected LockManagerBase([NotNull] ILockCleanupTask cleanupTask, [NotNull] ISystemClock systemClock, [NotNull] ILogger logger, [CanBeNull] ILockManagerOptions options = null)
Parameters
Type Name Description
ILockCleanupTask cleanupTask

The clean-up task for expired locks

ISystemClock systemClock

The system clock interface

Microsoft.Extensions.Logging.ILogger logger

The logger

ILockManagerOptions options

The options of the lock manager

Properties

| Improve this Doc View Source

Cost

Gets the cost of a LOCK/UNLOCK or lock discovery operation

Declaration
public int Cost { get; }
Property Value
Type Description
Int32
Implements
ILockManager.Cost
| Improve this Doc View Source

LockCleanupTask

Gets the lock cleanup task

Declaration
[NotNull]
protected ILockCleanupTask LockCleanupTask { get; }
Property Value
Type Description
ILockCleanupTask

Methods

| Improve this Doc View Source

BeginTransactionAsync(CancellationToken)

Begins a new transaction

Declaration
protected abstract Task<LockManagerBase.ILockManagerTransaction> BeginTransactionAsync(CancellationToken cancellationToken)
Parameters
Type Name Description
CancellationToken cancellationToken

The cancellation token

Returns
Type Description
Task<LockManagerBase.ILockManagerTransaction>

The transaction to be used to update the active locks

| Improve this Doc View Source

GetAffectedLocksAsync(String, Boolean, Boolean, CancellationToken)

Gets all active locks

Declaration
public Task<IEnumerable<IActiveLock>> GetAffectedLocksAsync(string path, bool findChildren, bool findParents, CancellationToken cancellationToken)
Parameters
Type Name Description
String path

The file system path to get the locks for

Boolean findChildren

Return all locks that are a child of the given path?

Boolean findParents

Return all locks that are a parent of the given path?

CancellationToken cancellationToken

The cancellation token

Returns
Type Description
Task<IEnumerable<IActiveLock>>

Returns all active locks

Implements
ILockManager.GetAffectedLocksAsync(String, Boolean, Boolean, CancellationToken)
Remarks

Be aware that the locks could've been released in the mean time by a concurrent access or by the LockCleanupTask.

| Improve this Doc View Source

GetLocksAsync(CancellationToken)

Gets all active locks

Declaration
public Task<IEnumerable<IActiveLock>> GetLocksAsync(CancellationToken cancellationToken)
Parameters
Type Name Description
CancellationToken cancellationToken

The cancellation token

Returns
Type Description
Task<IEnumerable<IActiveLock>>

Returns all active locks

Implements
ILockManager.GetLocksAsync(CancellationToken)
Remarks

Be aware that the locks could've been released in the mean time by a concurrent access or by the LockCleanupTask.

| Improve this Doc View Source

LockAsync(ILock, CancellationToken)

Tries to issue a lock

Declaration
public Task<LockResult> LockAsync(ILock l, CancellationToken cancellationToken)
Parameters
Type Name Description
ILock l

The lock to issue

CancellationToken cancellationToken

The cancellation token

Returns
Type Description
Task<LockResult>

Either the list of locks preventing issuing a lock or the active lock created

Implements
ILockManager.LockAsync(ILock, CancellationToken)
| Improve this Doc View Source

LockImplicitAsync(IFileSystem, IReadOnlyCollection<IfHeaderList>, ILock, CancellationToken)

Tries to find a lock identified by the ifHeaderLists or creates a new one if none was found.

Declaration
public Task<IImplicitLock> LockImplicitAsync(IFileSystem rootFileSystem, IReadOnlyCollection<IfHeaderList> ifHeaderLists, ILock lockRequirements, CancellationToken cancellationToken)
Parameters
Type Name Description
IFileSystem rootFileSystem

The root file system to identify the lock for

IReadOnlyCollection<IfHeaderList> ifHeaderLists

The If header lists that tries to identify the lock to use

ILock lockRequirements

The requirements the found lock must meet

CancellationToken cancellationToken

The cancellation token

Returns
Type Description
Task<IImplicitLock>

Either the list of locks preventing issuing a lock or the active lock created or reused

Implements
ILockManager.LockImplicitAsync(IFileSystem, IReadOnlyCollection<IfHeaderList>, ILock, CancellationToken)
| Improve this Doc View Source

NormalizePath(Uri)

Converts a client path to a system path.

Declaration
protected virtual Uri NormalizePath(Uri path)
Parameters
Type Name Description
Uri path

The client path to convert

Returns
Type Description
Uri

The system path to be converted to

Remarks

The client path has the form http://localhost/root-file-system/relative/path and is therefore always an absolute path. The returned path must be absolute too and might have the form http://localhost/c/relative/path or something similar. It is of utmost importance that the URI is always stable. The default implementation of this function doesn't make any conversions, because it assumes that the same path path always points to the same file system entry for all clients.

A URI to a directory must always end in a slash (/).

| Improve this Doc View Source

OnLockAdded(IActiveLock)

Gets called when a lock was added

Declaration
protected virtual void OnLockAdded(IActiveLock activeLock)
Parameters
Type Name Description
IActiveLock activeLock

The lock that was added

| Improve this Doc View Source

OnLockReleased(IActiveLock)

Gets called when a lock was released

Declaration
protected virtual void OnLockReleased(IActiveLock activeLock)
Parameters
Type Name Description
IActiveLock activeLock

The lock that was released

| Improve this Doc View Source

RefreshLockAsync(IFileSystem, IfHeader, TimeSpan, CancellationToken)

Tries to refresh a lock

Declaration
public Task<LockRefreshResult> RefreshLockAsync(IFileSystem rootFileSystem, IfHeader ifHeader, TimeSpan timeout, CancellationToken cancellationToken)
Parameters
Type Name Description
IFileSystem rootFileSystem

The root file system

IfHeader ifHeader

The header that tries to identify the lock to refresh

TimeSpan timeout

The header containing the new timeouts

CancellationToken cancellationToken

The cancellation token

Returns
Type Description
Task<LockRefreshResult>

Either the list of locks preventing refreshing a lock or the refreshed lock

Implements
ILockManager.RefreshLockAsync(IFileSystem, IfHeader, TimeSpan, CancellationToken)
| Improve this Doc View Source

ReleaseAsync(String, Uri, CancellationToken)

Releases a lock with the given state token

Declaration
public Task<LockReleaseStatus> ReleaseAsync(string path, Uri stateToken, CancellationToken cancellationToken)
Parameters
Type Name Description
String path

The path to release the lock for

Uri stateToken

The state token of the lock to release

CancellationToken cancellationToken

The cancellation token

Returns
Type Description
Task<LockReleaseStatus>

true when there was a lock to remove

Implements
ILockManager.ReleaseAsync(String, Uri, CancellationToken)

Events

| Improve this Doc View Source

LockAdded

Gets called when a lock was added

Declaration
public event EventHandler<LockEventArgs> LockAdded
Event Type
Type Description
EventHandler<LockEventArgs>
Implements
ILockManager.LockAdded
| Improve this Doc View Source

LockReleased

Gets called when a lock was released

Declaration
public event EventHandler<LockEventArgs> LockReleased
Event Type
Type Description
EventHandler<LockEventArgs>
Implements
ILockManager.LockReleased
  • Improve this Doc
  • View Source
Back to top Copyright © 2016-2017 Fubar Development Junker
Generated by DocFX