common_meta/ddl/utils/
table_info.rs1use snafu::OptionExt;
16use store_api::storage::TableId;
17use table::table_reference::TableReference;
18
19use crate::error::{Result, TableInfoNotFoundSnafu};
20use crate::key::table_info::{TableInfoManager, TableInfoValue};
21use crate::key::DeserializedValueWithBytes;
22
23pub(crate) async fn get_all_table_info_values_by_table_ids<'a>(
27 table_info_manager: &TableInfoManager,
28 table_ids: &[TableId],
29 table_names: &[TableReference<'a>],
30) -> Result<Vec<DeserializedValueWithBytes<TableInfoValue>>> {
31 let mut table_info_map = table_info_manager.batch_get_raw(table_ids).await?;
32 let mut table_info_values = Vec::with_capacity(table_ids.len());
33 for (table_id, table_name) in table_ids.iter().zip(table_names) {
34 let table_info_value =
35 table_info_map
36 .remove(table_id)
37 .with_context(|| TableInfoNotFoundSnafu {
38 table: table_name.to_string(),
39 })?;
40 table_info_values.push(table_info_value);
41 }
42
43 Ok(table_info_values)
44}