async fn all_blocks(
        &self,
        first: Option<i32>,
        last: Option<i32>,
        before: Option<IndexCursor>,
        after: Option<IndexCursor>,
        context: &Context,
    ) -> FieldResult<BlockConnection> {
        let longest_chain = latest_block(context).await?.chain_length;

        let block0 = 0u32;

        let boundaries = PaginationInterval::Inclusive(InclusivePaginationInterval {
            lower_bound: block0,
            upper_bound: u32::from(longest_chain),
        });

        let pagination_arguments = PaginationArguments {
            first,
            last,
            before: before.map(u32::try_from).transpose()?,
            after: after.map(u32::try_from).transpose()?,
        }
        .validate()?;

        BlockConnection::new_async(boundaries, pagination_arguments, |range| async {
            match range {
                PaginationInterval::Empty => vec![],
                PaginationInterval::Inclusive(range) => {
                    let a = range.lower_bound.into();
                    let b = range.upper_bound.checked_add(1).unwrap().into();
                    context
                        .db
                        .get_block_hash_range(a, b)
                        .await
                        .iter_mut()
                        .map(|(hash, chain_length)| (*hash, u32::from(*chain_length)))
                        .collect()
                }
            }
        })
        .await
    }
/// query all the blocks in a paginated view
query all the blocks in a paginated view
query all the blocks in a paginated view
async fn all_blocks(
        &self,
        first: Option<i32>,
        last: Option<i32>,
        before: Option<IndexCursor>,
        after: Option<IndexCursor>,
        context: &Context,
    ) -> FieldResult<BlockConnection> {
        let longest_chain = latest_block(context).await?.chain_length;
        let block0 = 0u32;
        let boundaries = PaginationInterval::Inclusive(InclusivePaginationInterval {
            lower_bound: block0,
            upper_bound: u32::from(longest_chain),
        });
        let pagination_arguments = PaginationArguments {
            first,
            last,
            before: before.map(u32::try_from).transpose()?,
            after: after.map(u32::try_from).transpose()?,
        }
        .validate()?;
        BlockConnection::new_async(boundaries, pagination_arguments, |range| async {
            match range {
                PaginationInterval::Empty => vec![],
                PaginationInterval::Inclusive(range) => {
                    let a = range.lower_bound.into();
                    let b = range.upper_bound.checked_add(1).unwrap().into();
                    context
                        .db
                        .get_block_hash_range(a, b)
                        .await
                        .iter_mut()
                        .map(|(hash, chain_length)| (*hash, u32::from(*chain_length)))
                        .collect()
                }
            }
        })
        .await
    }
async fn all_blocks ( & self , first : Option < i32 > , last : Option < i32 > , before : Option < IndexCursor > , after : Option < IndexCursor > , context : & Context , ) -> FieldResult < BlockConnection > { let longest_chain = latest_block ( context ) . await ? . chain_length ; let block0 = 0u32 ; let boundaries = PaginationInterval :: Inclusive ( InclusivePaginationInterval { lower_bound : block0 , upper_bound : u32 :: from ( longest_chain ) , } ) ; let pagination_arguments = PaginationArguments { first , last , before : before . map ( u32 :: try_from ) . transpose ( ) ? , after : after . map ( u32 :: try_from ) . transpose ( ) ? , } . validate ( ) ? ; BlockConnection :: new_async ( boundaries , pagination_arguments , | range | async { match range { PaginationInterval :: Empty => vec ! [ ] , PaginationInterval :: Inclusive ( range ) => { let a = range . lower_bound . into ( ) ; let b = range . upper_bound . checked_add ( 1 ) . unwrap ( ) . into ( ) ; context . db . get_block_hash_range ( a , b ) . await . iter_mut ( ) . map ( | ( hash , chain_length ) | ( * hash , u32 :: from ( * chain_length ) ) ) . collect ( ) } } } ) . await }
query all the blocks in a paginated view
query all the blocks in a paginated view
&self
first
Option<i32>
last
Option<i32>
before
Option<IndexCursor>
after
Option<IndexCursor>
context
&Context
&self
first
Option<i32>
last
Option<i32>
before
Option<IndexCursor>
after
Option<IndexCursor>
context
&Context