Struct AuditChainPartition
- Namespace
- Excalibur.AuditLogging
- Assembly
- Excalibur.AuditLogging.dll
One chain partition's contribution to a verification: the records in range, in the order they were written, together with the tags that bind them to whatever preceded and followed the range.
public readonly record struct AuditChainPartition : IEquatable<AuditChainPartition>
- Implements
- Inherited Members
Remarks
A partition is the unit a store chains over on write. A store that writes one chain per tenant supplies one partition per tenant; a store that chains per tenant and application supplies one per pair. Records drawn from two partitions must never be combined into one instance: their tags interleave, so each record's prior tag names a predecessor that is not its neighbour here.
Constructors
AuditChainPartition(string?, IAsyncEnumerable<AuditEvent>, AuditEvent?)
One chain partition's contribution to a verification: the records in range, in the order they were written, together with the tags that bind them to whatever preceded and followed the range.
public AuditChainPartition(string? AnchorPriorTag, IAsyncEnumerable<AuditEvent> Events, AuditEvent? Successor)
Parameters
AnchorPriorTagstringThe stored tag of the record immediately preceding
Eventswithin this same partition, or null to assert that the first record in range is the partition's genesis record.EventsIAsyncEnumerable<AuditEvent>The partition's in-range records, streamed in the order they were written. Ordering by a value an attacker or a skewed clock controls — a timestamp, for instance — rather than by write order will report an intact trail broken. The sequence is enumerated once.
SuccessorAuditEventThe record immediately following
Eventswithin this same partition, or null when the range runs to the end of the partition's chain. It pins the right edge: the successor was written to follow the range's last record, so removing records from the end of the range breaks its keyed MAC. Omitting it when a successor does exist forfeits that detection silently.
Remarks
A partition is the unit a store chains over on write. A store that writes one chain per tenant supplies one partition per tenant; a store that chains per tenant and application supplies one per pair. Records drawn from two partitions must never be combined into one instance: their tags interleave, so each record's prior tag names a predecessor that is not its neighbour here.
Properties
AnchorPriorTag
The stored tag of the record immediately preceding Events within this same partition,
or null to assert that the first record in range is the partition's genesis record.
public string? AnchorPriorTag { get; init; }
Property Value
Events
The partition's in-range records, streamed in the order they were written. Ordering by a value an attacker or a skewed clock controls — a timestamp, for instance — rather than by write order will report an intact trail broken. The sequence is enumerated once.
public IAsyncEnumerable<AuditEvent> Events { get; init; }
Property Value
Successor
The record immediately following Events within this same partition, or
null when the range runs to the end of the partition's chain. It pins the right edge:
the successor was written to follow the range's last record, so removing records from the end of the range
breaks its keyed MAC. Omitting it when a successor does exist forfeits that detection silently.
public AuditEvent? Successor { get; init; }
Property Value
Methods
FromList(string?, IReadOnlyList<AuditEvent>, AuditEvent?)
Creates a partition from records a caller already holds in memory.
public static AuditChainPartition FromList(string? anchorPriorTag, IReadOnlyList<AuditEvent> events, AuditEvent? successor)
Parameters
anchorPriorTagstringThe tag of the record immediately preceding the range, or null for genesis.
eventsIReadOnlyList<AuditEvent>The partition's in-range records, in the order they were written.
successorAuditEventThe record immediately following the range in this partition, or null.
Returns
- AuditChainPartition
A partition that streams
eventsin order.
Remarks
A convenience for callers that have a list, not a requirement to produce one. Verification itself needs only a forward stream, and a store able to read its records lazily should supply one rather than materialize the range to call this.
Exceptions
- ArgumentNullException
Thrown when
eventsis null.