using Akka.Actor; using ZB.MOM.WW.Secrets.Abstractions; namespace ZB.MOM.WW.Secrets.Replicator.AkkaDotNet; /// /// Publishes local secret writes to cluster peers by handing them to this node's /// . /// /// /// The hand-off is a Tell, so completes as soon as the row is in /// the actor's mailbox rather than when peers have applied it. That is the correct contract here: /// the caller (ReplicatingSecretStore) has already durably written the row locally and treats /// publishing as best-effort, and blocking a write until every peer acknowledged would make each /// node's availability depend on all the others. Delivery is guaranteed by anti-entropy, not by /// this call. /// /// This node's replication actor. public sealed class AkkaSecretReplicator(IActorRef replicationActor) : ISecretReplicator { private readonly IActorRef _replicationActor = replicationActor ?? throw new ArgumentNullException(nameof(replicationActor)); /// public Task PublishAsync(StoredSecret row, CancellationToken ct) { ArgumentNullException.ThrowIfNull(row); _replicationActor.Tell(new SecretReplicationActor.PublishLocalWrite(row)); return Task.CompletedTask; } }