CultLib/src/GameCult.Caching/CultSchemaConflictException.cs
Meta Vens 2e3312635d C# write set: one re-mint for every store kind, and a foreign refusal carries its reload failure
The directory store wrote an earlier storedAt over a later record it replaced, against the contract.
CacheBackingStore.StoredAtOver is now the one re-mint; the single-file apply and the directory
generation write both call it. A foreign refusal passes the reload's cause to
CultSchemaConflictException as its inner exception. Per-commit build not verified.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-03 06:05:41 +02:00

34 lines
1.5 KiB
C#

using System;
namespace GameCult.Caching
{
/// <summary>
/// A write the catalog cannot describe: two schemas that share a schema id and disagree on the schema name (both arrived with the
/// records, neither registered), a record whose schema id no chosen entry publishes, or a write that would replace or remove a
/// <see cref="CultForeignRecord"/>. Nothing is written, so the store stays as it was. It names the id, the schema names involved
/// and a record key.
/// </summary>
public sealed class CultSchemaConflictException : InvalidOperationException
{
public CultSchemaConflictException(string message, string schemaId, string[] schemaNames, string recordKey)
: base(message)
{
SchemaId = schemaId;
SchemaNames = schemaNames;
RecordKey = recordKey;
}
/// <summary>The same refusal when the reload it owes (what the store holds now, loaded into the cache) itself failed: that failure is the inner exception.</summary>
public CultSchemaConflictException(string message, string schemaId, string[] schemaNames, string recordKey, Exception? innerException)
: base(message, innerException)
{
SchemaId = schemaId;
SchemaNames = schemaNames;
RecordKey = recordKey;
}
public string SchemaId { get; }
public string[] SchemaNames { get; }
public string RecordKey { get; }
}
}