fn take_next_commits_if_needed(
        &mut self,
        conn_pool: &storage::ConnectionPool,
        limit: i64,
    ) -> Result<(), String> {
        if self.operations.len() < limit as usize {
            let storage = conn_pool.access_storage().expect("failed to connect to db");
            let ops = storage
                .chain()
                .block_schema()
                .load_commits_after_block(self.last_loaded_block, limit)
                .map_err(|e| format!("failed to read commit operations: {}", e))?;

            self.operations.extend(ops);

            if let Some((op, _)) = self.operations.back() {
                self.last_loaded_block = op.block.block_number;
            }

            trace!(
                "Operations: {:?}",
                self.operations
                    .iter()
                    .map(|(op, _)| op.block.block_number)
                    .collect::<Vec<_>>()
            );
        }

        Ok(())
    }
/// Fills the operations queue if the amount of non-processed operations
/// is less than `limit`.
Fills the operations queue if the amount of non-processed operations
is less than `limit`.
Fills the operations queue if the amount of non - processed operations is less than ` limit ` .
fn take_next_commits_if_needed(
        &mut self,
        conn_pool: &storage::ConnectionPool,
        limit: i64,
    ) -> Result<(), String> {
        if self.operations.len() < limit as usize {
            let storage = conn_pool.access_storage().expect("failed to connect to db");
            let ops = storage
                .chain()
                .block_schema()
                .load_commits_after_block(self.last_loaded_block, limit)
                .map_err(|e| format!("failed to read commit operations: {}", e))?;
            self.operations.extend(ops);
            if let Some((op, _)) = self.operations.back() {
                self.last_loaded_block = op.block.block_number;
            }
            trace!(
                "Operations: {:?}",
                self.operations
                    .iter()
                    .map(|(op, _)| op.block.block_number)
                    .collect::<Vec<_>>()
            );
        }
        Ok(())
    }
fn take_next_commits_if_needed ( & mut self , conn_pool : & storage :: ConnectionPool , limit : i64 , ) -> Result < ( ) , String > { if self . operations . len ( ) < limit as usize { let storage = conn_pool . access_storage ( ) . expect ( " " ) ; let ops = storage . chain ( ) . block_schema ( ) . load_commits_after_block ( self . last_loaded_block , limit ) . map_err ( | e | format ! ( " " e ) ) ? ; self . operations . extend ( ops ) ; if let Some ( ( op , _ ) ) = self . operations . back ( ) { self . last_loaded_block = op . block . block_number ; } trace ! ( " " self operations iter ( ) map ( ( op ) op block block_number ) collect Vec ( ) ) ; } Ok ( ( ) ) }
Fills the operations queue if the amount of non-processed operations
is less than `limit`.
Fills the operations queue if the amount of non - processed operations is less than ` limit ` .
&mut self
conn_pool
&storage::ConnectionPool
limit
i64