Table of Contents

Class PostgreSqlTableLockSettingsBuilder

Namespace
Silverback.Lock
Assembly
Silverback.Storage.PostgreSql.dll
public class PostgreSqlTableLockSettingsBuilder : IDistributedLockSettingsImplementationBuilder
Inheritance
PostgreSqlTableLockSettingsBuilder
Implements
Inherited Members

Constructors

PostgreSqlTableLockSettingsBuilder(string, string)

Initializes a new instance of the PostgreSqlTableLockSettingsBuilder class.

public PostgreSqlTableLockSettingsBuilder(string lockName, string connectionString)

Parameters

lockName string

The name of the lock.

connectionString string

The connection string to the PostgreSql database.

Methods

Build()

Builds the settings instance.

public DistributedLockSettings Build()

Returns

DistributedLockSettings

The DistributedLockSettings.

UseTable(string)

Sets the table name.

public PostgreSqlTableLockSettingsBuilder UseTable(string tableName)

Parameters

tableName string

The name of the locks table. If not specified, the default "SilverbackLocks" will be used.

Returns

PostgreSqlTableLockSettingsBuilder

The PostgreSqlTableLockSettingsBuilder so that additional calls can be chained.

WithAcquireInterval(TimeSpan)

Sets the interval between two attempts to acquire the lock.

public PostgreSqlTableLockSettingsBuilder WithAcquireInterval(TimeSpan acquireInterval)

Parameters

acquireInterval TimeSpan

The interval between two attempts to acquire the lock. The default is 1 second.

Returns

PostgreSqlTableLockSettingsBuilder

The PostgreSqlTableLockSettingsBuilder so that additional calls can be chained.

WithCreateTableTimeout(TimeSpan)

Sets the timeout for the table creation.

public PostgreSqlTableLockSettingsBuilder WithCreateTableTimeout(TimeSpan createTableTimeout)

Parameters

createTableTimeout TimeSpan

The timeout for the table creation. The default is 30 seconds.

Returns

PostgreSqlTableLockSettingsBuilder

The PostgreSqlTableLockSettingsBuilder so that additional calls can be chained.

WithDbCommandTimeout(TimeSpan)

Sets the database command timeout.

public PostgreSqlTableLockSettingsBuilder WithDbCommandTimeout(TimeSpan dbCommandTimeout)

Parameters

dbCommandTimeout TimeSpan

The timeout for the database commands. The default is 10 seconds.

Returns

PostgreSqlTableLockSettingsBuilder

The PostgreSqlTableLockSettingsBuilder so that additional calls can be chained.

WithHeartbeatInterval(TimeSpan)

Sets the interval between two heartbeat updates.

public PostgreSqlTableLockSettingsBuilder WithHeartbeatInterval(TimeSpan heartbeatInterval)

Parameters

heartbeatInterval TimeSpan

The interval between two heartbeat updates. The default is 500 milliseconds.

Returns

PostgreSqlTableLockSettingsBuilder

The PostgreSqlTableLockSettingsBuilder so that additional calls can be chained.

WithLockTimeout(TimeSpan)

Sets the maximum duration between two heartbeat updates, after which the lock is considered lost.

public PostgreSqlTableLockSettingsBuilder WithLockTimeout(TimeSpan lockTimeout)

Parameters

lockTimeout TimeSpan

The maximum duration between two heartbeat updates, after which the lock is considered lost. The default is 5 seconds.

Returns

PostgreSqlTableLockSettingsBuilder

The PostgreSqlTableLockSettingsBuilder so that additional calls can be chained.