Get changes that are in the source view but not in the target view. # Arguments `txn` - Read transaction `from_view` - Source view `to_view` - Target view # Returns Vector of hashes that need to be inserted, in dependency order.
(
txn: &T,
from_view: &ViewState,
to_view: &ViewState,
)
| 57 | /// |
| 58 | /// Vector of hashes that need to be inserted, in dependency order. |
| 59 | pub fn get_missing_changes<T: ViewTxnT>( |
| 60 | txn: &T, |
| 61 | from_view: &ViewState, |
| 62 | to_view: &ViewState, |
| 63 | ) -> InsertResult<Vec<Hash>> { |
| 64 | // Get all changes in source |
| 65 | let source_changes = get_view_changes(txn, from_view)?; |
| 66 | |
| 67 | // Build set of changes in target |
| 68 | let target_set: HashSet<Hash> = get_view_changes(txn, to_view)? |
| 69 | .into_iter() |
| 70 | .map(|(_, hash)| hash) |
| 71 | .collect(); |
| 72 | |
| 73 | // Filter to changes not in target, preserving order |
| 74 | let missing: Vec<Hash> = source_changes |
| 75 | .into_iter() |
| 76 | .filter(|(_, hash)| !target_set.contains(hash)) |
| 77 | .map(|(_, hash)| hash) |
| 78 | .collect(); |
| 79 | |
| 80 | Ok(missing) |
| 81 | } |
| 82 | |
| 83 | /// Get changes up to a specific sequence number. |
| 84 | /// |
no test coverage detected