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

Function compute_row

atomic-cli/src/commands/memory/list.rs:234–266  ·  view source on GitHub ↗

Compute one memory's row. A read/lift/attestation failure for a SINGLE memory degrades that row's computed columns to `–`/0 rather than aborting the list.

(repo: &Repository, id: &str, verifier: Option<&Verifier>)

Source from the content-addressed store, hash-verified

232/// Compute one memory's row. A read/lift/attestation failure for a SINGLE memory
233/// degrades that row's computed columns to `–`/0 rather than aborting the list.
234fn compute_row(repo: &Repository, id: &str, verifier: Option<&Verifier>) -> Row {
235 let inputs = match bridge::read_memory(repo, id) {
236 Ok(i) => i,
237 Err(_) => {
238 return Row {
239 id: id.to_string(),
240 kind: NA.to_string(),
241 status: NA.to_string(),
242 about: 0,
243 attested: Attested::None,
244 verifies: Verifies::Na,
245 }
246 }
247 };
248 let attestation = bridge::load_attestation(repo, id, &inputs);
249 let (attested, verifies, node_owned) = match attestation {
250 Ok(a) => {
251 let verifies = compute_verifies(&a, verifier);
252 (classify(&a), verifies, Some(a))
253 }
254 Err(_) => (Attested::None, Verifies::Na, None),
255 };
256 let node = node_owned.as_ref().and_then(attested_node);
257 let (kind, status, about) = kind_status_about(node, &inputs);
258 Row {
259 id: id.to_string(),
260 kind,
261 status,
262 about,
263 attested,
264 verifies,
265 }
266}
267
268impl Command for MemoryList {
269 fn run(&self) -> CliResult<()> {

Callers 2

runMethod · 0.70
row_forFunction · 0.70

Calls 6

read_memoryFunction · 0.85
kind_status_aboutFunction · 0.85
as_refMethod · 0.80
load_attestationFunction · 0.70
compute_verifiesFunction · 0.70
classifyFunction · 0.70

Tested by

no test coverage detected