pub fn apply(&mut self, block: &Block) -> Result<()> {
        // NOTE: This only stores the block in the database. It does not process it
        self.adapter.add_block(&mut self.txn, block)?;

        let block_id = BlockId::of(block);
        let ops = &block.get_body().get_ops();

        // Process the operations in the block and apply them to the database
        for op in ops.iter() {
            match op.get_optype() {
                op::Type::ADD => {
                    self.add(
                        op,
                        &block_id,
                        Timestamp::at(block.get_body().get_timestamp()),
                    )?
                }
            };
        }

        Ok(())

    }
/// Apply the operations in the given block to the database
Apply the operations in the given block to the database
Apply the operations in the given block to the database
pub fn apply(&mut self, block: &Block) -> Result<()> {
        // NOTE: This only stores the block in the database. It does not process it
        self.adapter.add_block(&mut self.txn, block)?;
        let block_id = BlockId::of(block);
        let ops = &block.get_body().get_ops();
        // Process the operations in the block and apply them to the database
        for op in ops.iter() {
            match op.get_optype() {
                op::Type::ADD => {
                    self.add(
                        op,
                        &block_id,
                        Timestamp::at(block.get_body().get_timestamp()),
                    )?
                }
            };
        }
        Ok(())
    }
pub fn apply ( & mut self , block : & Block ) -> Result < ( ) > { // NOTE: This only stores the block in the database. It does not process it self . adapter . add_block ( & mut self . txn , block ) ? ; let block_id = BlockId :: of ( block ) ; let ops = & block . get_body ( ) . get_ops ( ) ; // Process the operations in the block and apply them to the database for op in ops . iter ( ) { match op . get_optype ( ) { op :: Type :: ADD => { self . add ( op , & block_id , Timestamp :: at ( block . get_body ( ) . get_timestamp ( ) ) , ) ? } } ; } Ok ( ( ) ) }
Apply the operations in the given block to the database
Apply the operations in the given block to the database
&mut self
block
&Block
&mut self
block
&Block