namespace ZB.MOM.WW.Secrets.Replicator.AkkaDotNet;
///
/// Configuration for peer-to-peer secret replication over the Akka cluster.
///
public sealed class AkkaSecretsReplicationOptions
{
///
/// How often this node broadcasts its manifest for anti-entropy. Defaults to 30 seconds.
///
///
/// This is the convergence bound, not the propagation latency: a live write reaches peers in
/// milliseconds, and this interval only governs how quickly a dropped write or a
/// rejoining node is repaired. The traffic is one manifest per node per interval — names,
/// revisions, and timestamps, no ciphertext — so shortening it is cheap for a small cluster and
/// grows as O(nodes × secrets).
///
public TimeSpan AnnounceInterval { get; set; } = TimeSpan.FromSeconds(30);
/// Name of the replication actor within the actor system. Defaults to zb-secret-replication.
public string ActorName { get; set; } = "zb-secret-replication";
///
/// Throws if the options are unusable.
///
/// The announce interval is not positive, or the actor name is blank.
public void Validate()
{
if (AnnounceInterval <= TimeSpan.Zero)
{
throw new InvalidOperationException(
$"Secret replication AnnounceInterval must be positive (was {AnnounceInterval}).");
}
if (string.IsNullOrWhiteSpace(ActorName))
{
throw new InvalidOperationException("Secret replication ActorName must not be blank.");
}
}
}