Skip to content
Tracon

IDataSubjectStore

Namespace Tracon · Assembly Tracon.Abstractions.dll

The data plane that counts, exports, and erases one data subject’s content across the schema.

public interface IDataSubjectStore

The default (in-memory) setup registers NullDataSubjectStore, which always returns an empty result: export and erasure are meaningful only when a SQL provider is enabled — the same precedent as IRetentionStore and its NullRetentionStore.

EraseAsync(string, DataSubjectScope, Func<IReadOnlyDictionary<string, int>, CancellationToken, ValueTask>, CancellationToken)

Section titled “ EraseAsync(string, DataSubjectScope, Func<IReadOnlyDictionary<string, int>, CancellationToken, ValueTask>, CancellationToken)”

Deletes a scope’s content.

ValueTask<IReadOnlyDictionary<string, int>> EraseAsync(string tenantId, DataSubjectScope scope, Func<IReadOnlyDictionary<string, int>, CancellationToken, ValueTask> beforeCommitAsync, CancellationToken cancellationToken = default)

tenantId string

The tenant id.

scope DataSubjectScope

The subject’s scope.

beforeCommitAsync Func<IReadOnlyDictionary<string, int>, CancellationToken, ValueTask>

Runs after every delete has executed but BEFORE the change is committed. When it throws, every delete is rolled back and the exception propagates — That rule applied here: an erasure that cannot be written to the audit trail is not applied. The caller uses this to write the audit entry (which needs the row counts this method computes) while the erasure itself can still be undone if that write fails.

cancellationToken CancellationToken

The cancellation token.

ValueTask<IReadOnlyDictionary<string, int>>

The row count actually deleted per target.

The content includes the bytes of the scope’s attachments. When they live in IAttachmentStorage, they are deleted after the rows and BEFORE beforeCommitAsync runs. A byte delete that throws rolls every delete back and propagates, so the audit trail never records an erasure that did not happen. If the commit fails after the bytes are gone, a repeat call finishes the erasure: the storage treats a repeat delete as success.

ExportAsync(string, DataSubjectScope, CancellationToken)

Section titled “ ExportAsync(string, DataSubjectScope, CancellationToken)”

Reads every column of a scope’s content, target by target, as one export document.

ValueTask<DataSubjectExport> ExportAsync(string tenantId, DataSubjectScope scope, CancellationToken cancellationToken = default)

tenantId string

The tenant id.

scope DataSubjectScope

The subject’s scope.

cancellationToken CancellationToken

The cancellation token.

ValueTask<DataSubjectExport>

The export document.

PreviewAsync(string, DataSubjectScope, CancellationToken)

Section titled “ PreviewAsync(string, DataSubjectScope, CancellationToken)”

Counts the rows that would be deleted for a scope, by target, without deleting anything.

ValueTask<IReadOnlyDictionary<string, int>> PreviewAsync(string tenantId, DataSubjectScope scope, CancellationToken cancellationToken = default)

tenantId string

The tenant id.

scope DataSubjectScope

The subject’s scope.

cancellationToken CancellationToken

The cancellation token.

ValueTask<IReadOnlyDictionary<string, int>>

The row count per target; a target with nothing to delete is present with the value 0.