use crate::GlinClient;
use anyhow::Result;
use futures::future::join_all;
pub struct BatchRpc {
client: GlinClient,
}
impl BatchRpc {
pub fn new(client: GlinClient) -> Self {
Self { client }
}
pub async fn fetch_storage_parallel<T>(
&self,
keys: Vec<Vec<u8>>,
) -> Result<Vec<Option<Vec<u8>>>> {
let futures = keys.into_iter().map(|_key| {
let _client = self.client.clone();
async move {
Ok::<Option<Vec<u8>>, anyhow::Error>(None)
}
});
let results: Vec<_> = join_all(futures).await;
results.into_iter().collect()
}
}
#[cfg(test)]
mod tests {
#[test]
fn test_batch_creation() {
}
}