Table of Contents

Class EventStoreErasureContributor

Namespace
Excalibur.EventSourcing.Erasure
Assembly
Excalibur.EventSourcing.dll

Integrates GDPR erasure with event sourcing by tombstoning events and deleting snapshots for erased aggregates.

public sealed class EventStoreErasureContributor : IErasureContributor
Inheritance
EventStoreErasureContributor
Implements
Inherited Members

Remarks

This contributor is invoked by IErasureService during erasure execution. It delegates to IEventStoreErasure for event tombstoning and ISnapshotStore for snapshot deletion.

The contributor requires an IAggregateDataSubjectMapping to resolve which aggregate IDs belong to a data subject. Without this mapping, the contributor cannot determine which aggregates to erase.

Constructors

EventStoreErasureContributor(IEventStoreErasure, IAggregateDataSubjectMapping, ILogger<EventStoreErasureContributor>, ISnapshotStore?, IServiceProvider?, IErasureRetentionRegistry?)

Initializes a new instance of the EventStoreErasureContributor class.

public EventStoreErasureContributor(IEventStoreErasure eventStoreErasure, IAggregateDataSubjectMapping mapping, ILogger<EventStoreErasureContributor> logger, ISnapshotStore? snapshotStore, IServiceProvider? serviceProvider, IErasureRetentionRegistry? retentions)

Parameters

eventStoreErasure IEventStoreErasure

The event store erasure interface for tombstoning events.

mapping IAggregateDataSubjectMapping

The mapping service that resolves data subject IDs to aggregate IDs.

logger ILogger<EventStoreErasureContributor>

The logger.

snapshotStore ISnapshotStore

Optional snapshot store for deleting associated snapshots.

serviceProvider IServiceProvider

Resolves the projection registry and, through each registration's pre-bound clear delegate, the projection store and recovery service — so an erasure also reaches the read models that already materialized the subject. Null leaves projections untouched.

retentions IErasureRetentionRegistry

The declared erasure retentions, or null when the deployment declares none. An aggregate type named there is left whole — no tombstone, no snapshot deletion, no read-model clear — and is reported on the result so the erasure record names it with its basis, justification and period.

Remarks

There is one constructor, and the reason is that the alternatives were unsafe by default. Two earlier overloads omitted the retention registry, so a consumer taking the shortest one got a completed erasure, a certificate saying Completed, and a legally-required record destroyed, with no signal at any tier. Documenting a fail-open does not make it fail closed, so they are gone rather than deprecated.

A deployment that declares no retention passes null for retentions. That is correct, and it is now a state the caller chooses rather than one they fall into by picking the overload with fewer parameters.

Properties

CoveredStoreKinds

Gets the set of store kinds this contributor erases.

public IReadOnlySet<DataStoreKind> CoveredStoreKinds { get; }

Property Value

IReadOnlySet<DataStoreKind>

The store kinds covered by this contributor; never null.

Remarks

The erasure coverage gate uses this to mark a discovered DataLocation as Covered when its StoreKind is in this set. Must never contain Unknown — the unclassified kind is never coverable.

Name

Gets the display name of this contributor for logging and diagnostics.

public string Name { get; }

Property Value

string

A human-readable name such as "EventStore" or "SnapshotStore".

Methods

EraseAsync(ErasureContributorContext, CancellationToken)

Erases data for the specified erasure request.

public Task<ErasureContributorResult> EraseAsync(ErasureContributorContext context, CancellationToken cancellationToken)

Parameters

context ErasureContributorContext

The erasure context with request details.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<ErasureContributorResult>

The result of this contributor's erasure operation.