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

Method get_view_changes

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

2329 /// }
2330 /// ```
2331 pub fn get_view_changes(
2332 &self,
2333 view_name: Option<&str>,
2334 ) -> Result<Vec<(u64, Hash)>, RepositoryError> {
2335 let txn = self
2336 .pristine
2337 .read_txn()
2338 .map_err(|e| RepositoryError::Database(e.to_string()))?;
2339
2340 let name = view_name.unwrap_or(&self.current_view);
2341 let view = txn
2342 .get_view(name)
2343 .map_err(|e| RepositoryError::Database(e.to_string()))?
2344 .ok_or_else(|| RepositoryError::ViewNotFound {
2345 name: name.to_string(),
2346 })?;
2347
2348 get_view_changes_fn(&txn, &view).map_err(|e| RepositoryError::Apply(e.to_string()))
2349 }
2350
2351 /// Get changes that are in one view but not another.
2352 ///

Callers 1

insert_from_viewMethod · 0.80

Calls 2

read_txnMethod · 0.80
get_viewMethod · 0.45

Tested by

no test coverage detected