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

Method get_view_changes

atomic-repository/src/repository/insert.rs:2276–2294  ·  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

2274 /// }
2275 /// ```
2276 pub fn get_view_changes(
2277 &self,
2278 view_name: Option<&str>,
2279 ) -> Result<Vec<(u64, Hash)>, RepositoryError> {
2280 let txn = self
2281 .pristine
2282 .read_txn()
2283 .map_err(|e| RepositoryError::Database(e.to_string()))?;
2284
2285 let name = view_name.unwrap_or(&self.current_view);
2286 let view = txn
2287 .get_view(name)
2288 .map_err(|e| RepositoryError::Database(e.to_string()))?
2289 .ok_or_else(|| RepositoryError::ViewNotFound {
2290 name: name.to_string(),
2291 })?;
2292
2293 get_view_changes_fn(&txn, &view).map_err(|e| RepositoryError::Apply(e.to_string()))
2294 }
2295
2296 /// Get changes that are in one view but not another.
2297 ///

Callers 1

insert_from_viewMethod · 0.80

Calls 2

read_txnMethod · 0.80
get_viewMethod · 0.45

Tested by

no test coverage detected