Path: redb-route/redb.Route.Sql/Repositories/SqlIdempotentOptions.cs
Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route
Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route.Sql/Repositories/SqlIdempotentOptions.cs
----
using System.Text.RegularExpressions;
namespace redb.Route.Sql.Repositories;
///
/// Configuration for .
///
public sealed class SqlIdempotentOptions
{
private static readonly Regex ValidTableName = new(@"^[a-zA-Z_][a-zA-Z0-9_.]*$", RegexOptions.Compiled);
private string _tableName = "redb_idempotent";
/// Named data source from the registry.
public string DataSource { get; set; } = string.Empty;
///
/// Table name for storing idempotent keys. Default: "redb_idempotent". The name goes into DDL and statements as written,
/// so only an identifier (letters, digits, _, .) is accepted.
///
/// The value is not an identifier.
public string TableName
{
get => _tableName;
set
{
if (string.IsNullOrWhiteSpace(value) || !ValidTableName.IsMatch(value))
throw new ArgumentException($"Invalid table name: '{value}'. Must match [a-zA-Z_][a-zA-Z0-9_.]*", nameof(value));
_tableName = value;
}
}
/// Scope identifier (route id). Allows multiple routes to share one table.
public string ProcessorName { get; set; } = string.Empty;
/// Auto-cleanup: delete entries older than TTL. Null = no cleanup.
public TimeSpan? Ttl { get; set; }
/// Auto-create the table on first use. Default: true.
public bool CreateTable { get; set; } = true;
}