MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / get_view_changes

Method get_view_changes

atomic-repository/src/repository/insert.rs:2181–2199  ·  view source on GitHub ↗

Get all changes inserted into a view. Returns changes in order from oldest (sequence 0) to newest. # Arguments `view_name` - Name of the view to query (None = current view) # Returns Vector of (sequence, hash) pairs. # Example ```rust,ignore let changes = repo.get_view_changes(None)?; for (seq, hash) in changes { println!("#{}: {}", seq, hash.to_base32()); } ```

(
        &self,
        view_name: Option<&str>,
    )

Source from the content-addressed store, hash-verified

2179 /// }
2180 /// ```
2181 pub fn get_view_changes(
2182 &self,
2183 view_name: Option<&str>,
2184 ) -> Result<Vec<(u64, Hash)>, RepositoryError> {
2185 let txn = self
2186 .pristine
2187 .read_txn()
2188 .map_err(|e| RepositoryError::Database(e.to_string()))?;
2189
2190 let name = view_name.unwrap_or(&self.current_view);
2191 let view = txn
2192 .get_view(name)
2193 .map_err(|e| RepositoryError::Database(e.to_string()))?
2194 .ok_or_else(|| RepositoryError::ViewNotFound {
2195 name: name.to_string(),
2196 })?;
2197
2198 get_view_changes_fn(&txn, &view).map_err(|e| RepositoryError::Apply(e.to_string()))
2199 }
2200
2201 /// Get changes that are in one view but not another.
2202 ///

Callers 1

insert_from_viewMethod · 0.80

Calls 2

read_txnMethod · 0.80
get_viewMethod · 0.45

Tested by

no test coverage detected