Convert v3 initial subscription rows to the normalized table output map.
(
msg: &'a ws_v2::QueryRows,
schema: &RawModuleDefV9,
)
| 735 | |
| 736 | /// Convert v3 initial subscription rows to the normalized table output map. |
| 737 | fn reformat_query_rows<'a>( |
| 738 | msg: &'a ws_v2::QueryRows, |
| 739 | schema: &RawModuleDefV9, |
| 740 | ) -> anyhow::Result<HashMap<&'a str, SubscriptionTable>> { |
| 741 | let mut formatted = HashMap::default(); |
| 742 | |
| 743 | for table in &msg.tables { |
| 744 | let table_ty = schema.typespace.resolve( |
| 745 | schema |
| 746 | .type_ref_for_table_like(&table.table) |
| 747 | .context("table not found in schema")?, |
| 748 | ); |
| 749 | let table_output = formatted.entry(&*table.table).or_insert_with(|| SubscriptionTable { |
| 750 | deletes: Vec::new(), |
| 751 | inserts: Vec::new(), |
| 752 | }); |
| 753 | table_output.inserts.extend(reformat_bsatn_rows(&table.rows, table_ty)?); |
| 754 | } |
| 755 | |
| 756 | Ok(formatted) |
| 757 | } |
| 758 | |
| 759 | /// Convert a v3 transaction update to the normalized table output map. |
| 760 | fn reformat_transaction_update<'a>( |
no test coverage detected
searching dependent graphs…