public record class LedgerIntentA movement of value somebody is asking for. Applied whole or not at all.
Remarks
⚠ Several movements, not one, and that is not a convenience. A trade takes a sword off one character and puts gold on another; a purchase moves gold to Vendor and an item out of Loot. If those were two appends, a crash between them is a lost sword, and no amount of retrying fixes a half-applied trade because the retry's idempotency key already exists.
LeaseEpoch is ADR-021 reaching the database: a realm may only move a character's value while it holds that character's lease, and an intent naming a superseded epoch is refused. Without it, a realm that lost its lease mid-combat and is still simulating would keep writing — which is exactly the window the lease exists to close.
Fields and properties (5)
public IdempotencyKey KeyWhat this is, and what makes the retry free.
public long LeaseEpochThe epoch the acting realm holds for Player.
public DateTimeOffset AtWhen the realm decided it. Its clock, recorded rather than trusted.
public ImmutableArray<AssetMovement> MovementsThe legs, which must sum to zero per asset.
public string DetailWhy, for the support tool. Free text, and the only field nothing depends on.
Methods (3)
public bool IsBalanced()Whether the legs balance — the invariant a store refuses to break.
public static LedgerIntent Transfer(IdempotencyKey key, long epoch, DateTimeOffset at, LedgerAccount from, LedgerAccount to, AssetId asset, long quantity)The commonest shape: one asset, from one account to another.
public override string ToString()Returns a string that represents the current object.
Used by (6)
- ConservationTestsVixen.Live.Persistence.Tests
- ILedgerVixen.Live.Persistence
- LedgerTestsVixen.Live.Persistence.Tests
- MemoryPersistenceVixen.Live.Persistence
- SqlPersistenceVixen.Live.Persistence
- TransferFleetVixen.Live.Realm.Tests