/// Revert the block with the given `block_ptr` which must be the hash
/// of the block to revert. The returned `StoreEvent` reflects the changes
/// that were made during reversion
Revert the block with the given `block_ptr` which must be the hash
of the block to revert. The returned `StoreEvent` reflects the changes
that were made during reversion
Revert the block with the given ` block_ptr ` which must be the hash of the block to revert . The returned ` StoreEvent ` reflects the changes that were made during reversion
fn revert_block(
        &self,
        conn: &PgConnection,
        block_ptr: String,
    ) -> Result<(StoreEvent, i32), StoreError> {
        // We can't use Diesel's JoinOnDsl here because DynamicTable
        // does not implement AppearsInFromClause, so we have to run
        // a raw SQL query
        let query = format!(
            "select h.id, h.entity, h.entity_id, h.data_before, h.op_id
                       from {}.entity_history h, event_meta_data m
                      where m.id = h.event_id
                        and m.source = $1
                      order by h.event_id desc",
            self.schema
        );
        let query = diesel::sql_query(query).bind::<Text, _>(&block_ptr);
        // Collect entity history events for the subgraph for which we're
        // reverting the block
        let entries: Vec<RawHistory> = query.get_results(conn)?;
        // Apply revert operations
        self.revert_entity_history_records(conn, entries)
            .map(|(changes, count)| (StoreEvent::new(changes), count))
    }
fn revert_block ( & self , conn : & PgConnection , block_ptr : String , ) -> Result < ( StoreEvent , i32 ) , StoreError > { // We can't use Diesel's JoinOnDsl here because DynamicTable // does not implement AppearsInFromClause, so we have to run // a raw SQL query let query = format ! ( " " self schema ) ; let query = diesel :: sql_query ( query ) . bind :: < Text , _ > ( & block_ptr ) ; // Collect entity history events for the subgraph for which we're // reverting the block let entries : Vec < RawHistory > = query . get_results ( conn ) ? ; // Apply revert operations self . revert_entity_history_records ( conn , entries ) . map ( | ( changes , count ) | ( StoreEvent :: new ( changes ) , count ) ) }
Revert the block with the given `block_ptr` which must be the hash
of the block to revert.
Revert the block with the given ` block_ptr ` which must be the hash of the block to revert .
&self
conn
&PgConnection
block_ptr
String