Reading diagrams / Topic 6 of 42
Direct IO and tables
The rule
IO is anything a program does outside itself. In these programs that means a database. A table is stored data, rows the program reads and writes. An effect site is one place in the code that reads or writes a table. Here are two from Charter: the first names the charter_active table, and the second reads a row from it.
active_table: TxTable[s, ActiveCharter] = stored_table("charter_active")
def read_active_charter(db: Db, _: Principal) -> IO[Outcome[CharterError, Option[ActiveCharter]]]:
_ <- transaction(db)
tx_read(active_table, site_id)A package marked direct IO has effect sites in its own definitions. Select it to see which tables it reads and writes.
A package without the mark has no effect site in its own code.
- The mark confirms that a package’s own code touches the database; its absence rules that out.
- The mark is about the package’s own code only. The topic on IO through other packages comes later.
Icetakes, a community reading site, in full.
Loading the layer diagram.
How to read this: what each mark in these pictures means
Loading the worked examples and practice.