Skip to main content

Module logical

Module logical 

Source
Expand description

Pure, DB-free logical→physical transaction lowering.

This module is the single source of truth for the from→to FX math used by every client surface (CLI, TUI, web) and the upcoming B2b RPC native. No database calls, no async.

Structs§

LogicalSplit
A from→to exchange; to_amount is required iff from_commodity != to_commodity.
PhysicalSplit
One physical ledger entry.
PriceRow
One price-table row linking two physical splits.
RaisedRow
One recovered from→to row.
RowTags
The split tags of a from→to row: shared go on both legs, from and to on that leg only.
SplitFault
A lowering failure; field is None when the whole row is at fault.

Enums§

SplitField
The input a lowering rule rejected.

Constants§

STALE_REVISION
The error text of an update whose expected revision no longer matches.

Functions§

ensure_single_line_names
The shared forms keep tag names and values in single-line cells and descriptions in multiline ones; only a name or value loses a line break.
form_refusal
Ok when the stored transaction round-trips through the logical form, else the reason it does not: reconciliation or lot data, an ambiguous pairing, an exchange rate off its splits, two notes, two values of one tag name, or a line break in a tag name or value.
has_line_break
Whether text holds a line break a single-line cell would lose.
is_note
Whether tag is the note: tags are stored under trimmed names, so a padded note is the note too.
is_note_name
Whether a stored or typed tag name stands for the note.
lower_logical_split
Lower one logical split to two physical splits and an optional price row.
lower_logical_split_located
Lower one logical split to two physical splits and an optional price row, naming the input a rejection comes from.
lower_logical_transaction
Lower a non-empty slice of logical splits into physical splits and price rows.
note_value
The value of the note among a listing’s tags, which are keyed by stored name.
pick_note
The note among tags: the greatest by byte order of (name, value) should a legacy padded name leave several, whatever the order tags come in.
raise_transaction
Recover from→to rows in input order of their FROM splits, or fail when the pairing is not provable.
row_tags
The row’s tags, each part sorted by name.
stored_revision
revision of the stored transaction tags as loaded, the note among them; the last note in tags wins, as GetTransactionDetail shows it.