.NET API
RunSpend
Tracon.Abstractions.dllThe one place a run’s token cost and its reported (non-token) amount are added.
public static class RunSpend- Inheritance
- object ← RunSpend
- Inherited Members
- object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
Section titled “Remarks”A decision about money — a quota entry, a budget, a webhook amount — takes its number from here, never from RunCost.Total alone. A caller that reads the token total only under-reports every run that reported a non-token amount, and a tenant’s quota ceiling can then be passed without anyone noticing. The same rule as the cache charge in RunCost.Total: one function answers, and the callers do not repeat the sum.
Amounts in two currencies are never added. When the currencies differ, the token
total stands alone and the reported amount is left out; a custom
IRunPricingResolver is the only way to get there, since the built-in
one prices tokens and the reported amounts in Tracon:Pricing:Currency.
Methods
Section titled “Methods”Total(RunCost?, RunNonTokenCost?)
Section titled “ Total(RunCost?, RunNonTokenCost?)”Adds a run’s token cost and the amount it reported.
public static decimal? Total(RunCost? cost, RunNonTokenCost? nonTokenCost)Parameters
Section titled “Parameters”cost RunCost?
The run’s token cost, or null.
nonTokenCost RunNonTokenCost?
The run’s reported (non-token) cost, or null.
Returns
Section titled “Returns”The sum, or null when neither side has an amount. Never zero for a run nothing could be priced for.
Total(RunTreeCost?, RunNonTokenCost?)
Section titled “ Total(RunTreeCost?, RunNonTokenCost?)”Adds a run tree’s token cost and the amount the tree reported.
public static decimal? Total(RunTreeCost? cost, RunNonTokenCost? nonTokenCost)Parameters
Section titled “Parameters”cost RunTreeCost?
The tree’s token cost, or null.
nonTokenCost RunNonTokenCost?
The tree’s reported (non-token) cost, or null.
Returns
Section titled “Returns”The sum, or null when neither side has an amount, or when the tree’s token cost is in more than one currency.
Remarks
Section titled “Remarks”Both arguments already include the root run’s own share (RunRecord.TreeCost, RunRecord.TreeNonTokenCost).
A tree whose runs are priced in more than one currency (RunTreeCost.CurrencyCount) has no total, and a partial one would read as the whole bill. A reported amount in more than one currency is left out, the same as a reported amount in another currency than the tokens.