Class ItemChange<TKey, TIdentity, TState>
- Namespace
- SodaFlow.Collections
- Assembly
- SodaFlow.Core.Collections.dll
An edit after its resolution. It holds the new snapshot and the new state of each key that changed. An observer of one key reads this event and does not sample a cell, because a sample of a cell in a transaction gives the value from before the transaction.
[PublicAPI]
public sealed class ItemChange<TKey, TIdentity, TState> where TKey : notnull where TIdentity : notnull
Type Parameters
TKeyThe type of the keys.
TIdentityThe type of the immutable part of an item.
TStateThe type of the mutable part of an item.
- Inheritance
-
ItemChange<TKey, TIdentity, TState>
- Inherited Members
- Extension Methods
Remarks
The result of this change on one key is two questions and not one. They are two members here, for the cause that makes the C# wrapper put them in one nested optional value. WasChanged(TKey) gives if the change named the key, and TryGetNewState(TKey, out TState?) gives if the collection has the key after the change. A removal is the pair (true, false).
Properties
- Added
The keys this change added.
- After
The store as this transaction left it.
- Before
The store as this transaction found it.
- ChangedKeys
Each key that this change added, updated, or removed.
- IsStructural
Whether the item count changed or a key changed.
- NewStates
The resolved state of each key that an edit added or updated.
- Removed
The keys this change removed.
Methods
- TryGetNewState(TKey, out TState?)
The state of the key after this change, when the collection has the key.
- WasChanged(TKey)
True when this change names the key. An observer of a key with a false answer has no event to react to.