Table of Contents

Class PostgreSqlTableLock

Namespace
Silverback.Lock
Assembly
Silverback.Storage.PostgreSql.dll

The distributed lock based on a PostgreSql table.

public class PostgreSqlTableLock : TableBasedDistributedLock, IDistributedLock
Inheritance
PostgreSqlTableLock
Implements
Inherited Members

Constructors

PostgreSqlTableLock(PostgreSqlTableLockSettings, ISilverbackLogger<PostgreSqlTableLock>)

Initializes a new instance of the PostgreSqlTableLock class.

public PostgreSqlTableLock(PostgreSqlTableLockSettings settings, ISilverbackLogger<PostgreSqlTableLock> logger)

Parameters

settings PostgreSqlTableLockSettings

The lock settings.

logger ISilverbackLogger<PostgreSqlTableLock>

The logger.

Methods

ReleaseLockAsync(string)

Releases the lock.

protected override Task ReleaseLockAsync(string handlerName)

Parameters

handlerName string

The name of the current handler.

Returns

Task

A Task representing the asynchronous operation.

TryAcquireLockAsync(string)

Tries to acquire the lock.

protected override Task<bool> TryAcquireLockAsync(string handlerName)

Parameters

handlerName string

The name of the current handler.

Returns

Task<bool>

A Task representing the asynchronous operation. The result is true if the lock was acquired, otherwise false.

UpdateHeartbeatAsync(string)

Updates the last heartbeat of the lock.

protected override Task UpdateHeartbeatAsync(string handlerName)

Parameters

handlerName string

The name of the current handler.

Returns

Task

A Task representing the asynchronous operation.