.NET API
IAttachmentStorage
Tracon.Abstractions.dllThe extension point that stores attachment content in an external store (S3, Blob).
public interface IAttachmentStorageRemarks
Section titled “Remarks”When it is not registered the content lives in the database, so nothing has to be set up first. Tracon takes no dependency on any cloud SDK; the consumer writes the implementation.
DI lifetime — singleton, optional. No default implementation is
registered. A consumer that registers one must register it as a singleton (or
hand it to IServiceProvider.GetService<IAttachmentStorage>’s
caller, itself resolved once as a singleton dependency, for example
InMemoryAttachmentStore) — never scoped, which would be a captive
dependency.
Methods
Section titled “Methods”DeleteAsync(Uri, CancellationToken)
Section titled “ DeleteAsync(Uri, CancellationToken)”Deletes the content in the external store.
ValueTask DeleteAsync(Uri uri, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”uri Uri
The location returned by IAttachmentStorage.WriteAsync.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”A task that completes when the content is gone.
Remarks
Section titled “Remarks”Must be idempotent. Deleting a location that no longer exists succeeds and does not throw. Tracon deletes the content BEFORE the metadata row, so a retry after a partial failure — or two deletes that race — calls this method again for content that is already gone.
Throw only when the content may still exist. The attachment store, the retention policy, and data subject erasure then keep the metadata row, because it is the only record of where the content is: a single delete and an erasure fail, and retention retries the row on its next run.
ReadAsync(Uri, CancellationToken)
Section titled “ ReadAsync(Uri, CancellationToken)”Reads the content from the external store.
ValueTask<Stream?> ReadAsync(Uri uri, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”uri Uri
The location returned by IAttachmentStorage.WriteAsync.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”A readable stream, or null when the location no longer exists.
Remarks
Section titled “Remarks”Stream ownership. The CALLER owns the returned stream and must dispose it.
WriteAsync(string, Guid, Stream, string, CancellationToken)
Section titled “ WriteAsync(string, Guid, Stream, string, CancellationToken)”Writes the content to the external store.
ValueTask<Uri> WriteAsync(string tenantId, Guid id, Stream content, string mediaType, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”tenantId string
The tenant id.
id Guid
The attachment id.
content Stream
The content to write.
mediaType string
The MIME type of the content.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”ValueTask<Uri>
The location of the content in the external store.
Remarks
Section titled “Remarks”Stream ownership. The CALLER owns content
and disposes it; this method reads from it but does not dispose it.