Interface ILockManager
The interface for a lock manager
Namespace:FubarDev.WebDavServer.Locking
Assembly:FubarDev.WebDavServer.dll
Syntax
public interface ILockManager
Properties
| Improve this Doc View SourceCost
Gets the cost of a LOCK/UNLOCK or lock discovery operation
Declaration
int Cost { get; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
| Improve this Doc View SourceGetAffectedLocksAsync(String, Boolean, Boolean, CancellationToken)
Gets all active locks
Declaration
[NotNull]
[ItemNotNull]
Task<IEnumerable<IActiveLock>> GetAffectedLocksAsync([NotNull] 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 |
Remarks
Be aware that the locks could've been released in the mean time by a concurrent access or by the LockCleanupTask.
GetLocksAsync(CancellationToken)
Gets all active locks
Declaration
[NotNull]
[ItemNotNull]
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 |
Remarks
Be aware that the locks could've been released in the mean time by a concurrent access or by the LockCleanupTask.
LockAsync(ILock, CancellationToken)
Tries to issue a lock
Declaration
[NotNull]
[ItemNotNull]
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 |
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
[NotNull]
[ItemNotNull]
Task<IImplicitLock> LockImplicitAsync([NotNull] IFileSystem rootFileSystem, [CanBeNull, ItemNotNull] 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 |
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 |
RefreshLockAsync(IFileSystem, IfHeader, TimeSpan, CancellationToken)
Tries to refresh a lock
Declaration
[NotNull]
[ItemNotNull]
Task<LockRefreshResult> RefreshLockAsync([NotNull] IFileSystem rootFileSystem, [NotNull] 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 |
ReleaseAsync(String, Uri, CancellationToken)
Releases a lock with the given state token
Declaration
[NotNull]
Task<LockReleaseStatus> ReleaseAsync([NotNull] string path, [NotNull] 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 |
Events
| Improve this Doc View SourceLockAdded
Gets called when a lock was added
Declaration
event EventHandler<LockEventArgs> LockAdded
Event Type
Type | Description |
---|---|
EventHandler<LockEventArgs> |
LockReleased
Gets called when a lock was released
Declaration
event EventHandler<LockEventArgs> LockReleased
Event Type
Type | Description |
---|---|
EventHandler<LockEventArgs> |