pub trait ChunkedLoader<K>{
type Value: Send + Sync + Clone + 'static;
type Error: Send + Sync + Clone + 'static;
// Required methods
fn chunk_size(&self) -> usize;
fn load_chunk<'life0, 'life1, 'async_trait>(
&'life0 self,
keys: &'life1 [K],
) -> Pin<Box<dyn Future<Output = Result<HashMap<K, Self::Value>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided method
fn load_chunked<'life0, 'life1, 'async_trait>(
&'life0 self,
keys: &'life1 [K],
) -> Pin<Box<dyn Future<Output = Result<HashMap<K, Self::Value>, Self::Error>> + Send + 'async_trait>>
where Self: Sync + Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
Implemented by LedgerGrpcReader for each key type whose Loader::load needs to stay under
the ledger service’s batch-size limit — DataLoader’s own max_batch_size is only a dispatch
trigger, not a hard cap on how many keys reach a single Loader::load call. load_chunk
supplies the raw, single-chunk fetch and chunk_size supplies the limit; load_chunked’s
default body splits keys into chunks, dispatches load_chunk concurrently per chunk, and
merges the results.
pub, not pub(crate): it’s referenced through LedgerGrpcReader’s blanket Loader<K> impl
below (type Value = <Self as ChunkedLoader<K>>::Value), and that impl is part of
LedgerGrpcReader’s public interface since both the type and Loader are public.