Vixen
02b45cc4
csharp
public interface ILedger

The journal every movement of value is written to. Doc 27 § Persistence.

Read the guide page for this →

Remarks

⚠ Balances are a projection of this, not a second source of truth. A store keeps a running balance so a read is not a scan, and ReconcileAsync exists to prove the two agree — which is the only thing that makes a cached balance safe to believe.

Every method takes a CancellationToken and none of them is on a frame path: this is reached from a grain or a gate, never from a system body (ADR-016).

Methods (5)

  • Task<LedgerResult> AppendAsync(LedgerIntent intent, CancellationToken cancellation)

    Applies an intent, or recognises that it already was.

  • Task<long> BalanceAsync(LedgerAccount account, AssetId asset, CancellationToken cancellation)

    What an account holds of an asset.

  • Task<IReadOnlyDictionary<AssetId, long>> HoldingsAsync(LedgerAccount account, CancellationToken cancellation)

    Everything an account holds.

  • Task<IReadOnlyList<LedgerEntry>> HistoryAsync(LedgerQuery query, CancellationToken cancellation)

    Reads the journal.

  • Task<IReadOnlyList<LedgerDiscrepancy>> ReconcileAsync(CancellationToken cancellation)

    Checks the running balances against the journal they were derived from.

Used by (6)

  • ConservationTestsVixen.Live.Persistence.Tests
  • IPersistenceVixen.Live.Persistence
  • LedgerTestsVixen.Live.Persistence.Tests
  • MemoryPersistenceVixen.Live.Persistence
  • SqlPersistenceVixen.Live.Persistence
  • TransferFleetVixen.Live.Realm.Tests