Class PostgreSqlTableLockSettingsBuilder
Builds the PostgreSqlTableLockSettings.
Inherited Members
Namespace: Silverback.Lock
Assembly: Silverback.Storage.PostgreSql.dll
Syntax
public class PostgreSqlTableLockSettingsBuilder : IDistributedLockSettingsImplementationBuilder
Constructors
PostgreSqlTableLockSettingsBuilder(string, string)
Initializes a new instance of the PostgreSqlTableLockSettingsBuilder class.
Declaration
public PostgreSqlTableLockSettingsBuilder(string lockName, string connectionString)
Parameters
| Type | Name | Description |
|---|---|---|
| string | lockName | The name of the lock. |
| string | connectionString | The connection string to the PostgreSql database. |
Methods
Build()
Builds the settings instance.
Declaration
public DistributedLockSettings Build()
Returns
| Type | Description |
|---|---|
| DistributedLockSettings |
UseTable(string)
Sets the table name.
Declaration
public PostgreSqlTableLockSettingsBuilder UseTable(string tableName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | tableName | The name of the locks table. If not specified, the default |
Returns
| Type | Description |
|---|---|
| PostgreSqlTableLockSettingsBuilder | The PostgreSqlTableLockSettingsBuilder so that additional calls can be chained. |
WithAcquireInterval(TimeSpan)
Sets the interval between two attempts to acquire the lock.
Declaration
public PostgreSqlTableLockSettingsBuilder WithAcquireInterval(TimeSpan acquireInterval)
Parameters
| Type | Name | Description |
|---|---|---|
| TimeSpan | acquireInterval | The interval between two attempts to acquire the lock. The default is 1 second. |
Returns
| Type | Description |
|---|---|
| PostgreSqlTableLockSettingsBuilder | The PostgreSqlTableLockSettingsBuilder so that additional calls can be chained. |
WithCreateTableTimeout(TimeSpan)
Sets the timeout for the table creation.
Declaration
public PostgreSqlTableLockSettingsBuilder WithCreateTableTimeout(TimeSpan createTableTimeout)
Parameters
| Type | Name | Description |
|---|---|---|
| TimeSpan | createTableTimeout | The timeout for the table creation. The default is 30 seconds. |
Returns
| Type | Description |
|---|---|
| PostgreSqlTableLockSettingsBuilder | The PostgreSqlTableLockSettingsBuilder so that additional calls can be chained. |
WithDbCommandTimeout(TimeSpan)
Sets the database command timeout.
Declaration
public PostgreSqlTableLockSettingsBuilder WithDbCommandTimeout(TimeSpan dbCommandTimeout)
Parameters
| Type | Name | Description |
|---|---|---|
| TimeSpan | dbCommandTimeout | The timeout for the database commands. The default is 10 seconds. |
Returns
| Type | Description |
|---|---|
| PostgreSqlTableLockSettingsBuilder | The PostgreSqlTableLockSettingsBuilder so that additional calls can be chained. |
WithHeartbeatInterval(TimeSpan)
Sets the interval between two heartbeat updates.
Declaration
public PostgreSqlTableLockSettingsBuilder WithHeartbeatInterval(TimeSpan heartbeatInterval)
Parameters
| Type | Name | Description |
|---|---|---|
| TimeSpan | heartbeatInterval | The interval between two heartbeat updates. The default is 500 milliseconds. |
Returns
| Type | Description |
|---|---|
| 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.
Declaration
public PostgreSqlTableLockSettingsBuilder WithLockTimeout(TimeSpan lockTimeout)
Parameters
| Type | Name | Description |
|---|---|---|
| TimeSpan | lockTimeout | The maximum duration between two heartbeat updates, after which the lock is considered lost. The default is 5 seconds. |
Returns
| Type | Description |
|---|---|
| PostgreSqlTableLockSettingsBuilder | The PostgreSqlTableLockSettingsBuilder so that additional calls can be chained. |