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

Function current_view

atomic-cli/src/commands/diagnostics/metrics.rs:140–158  ·  view source on GitHub ↗
(root: &Path)

Source from the content-addressed store, hash-verified

138}
139
140fn current_view(root: &Path) -> Observation<CurrentViewCounts> {
141 let result = (|| {
142 let repo = atomic_repository::Repository::open_readonly_without_migration(root).ok()?;
143 let id = repo.working_copy_id()?;
144 let name = repo.desired_view_name(id).ok()?;
145 let info = repo.get_view_info(&name).ok()?;
146 Some(CurrentViewCounts {
147 own: info.own_change_count,
148 inherited: info.inherited_change_count,
149 membership: info
150 .own_change_count
151 .checked_add(info.inherited_change_count)?,
152 })
153 })();
154 match result {
155 Some(value) => Observation::available(value),
156 None => Observation::unavailable("current working-copy view cannot be verified"),
157 }
158}
159
160fn intents(txn: &redb::ReadTransaction) -> Observation<IntentCounts> {
161 let result = (|| {

Callers 1

collectFunction · 0.70

Calls 5

working_copy_idMethod · 0.80
desired_view_nameMethod · 0.80
get_view_infoMethod · 0.80
unavailableFunction · 0.50
okMethod · 0.45

Tested by

no test coverage detected