(o: &mut String, repository: &RepositoryMetrics)
| 55 | } |
| 56 | |
| 57 | fn render_repository(o: &mut String, repository: &RepositoryMetrics) { |
| 58 | section(o, "Repository and redb"); |
| 59 | match repository { |
| 60 | RepositoryMetrics::NotApplicable { reason } => { |
| 61 | field(o, "Status", &format!("not applicable — {reason}")) |
| 62 | } |
| 63 | RepositoryMetrics::Unavailable { |
| 64 | reason, |
| 65 | database_bytes, |
| 66 | } => { |
| 67 | field(o, "Status", &format!("unknown — {reason}")); |
| 68 | if let Some(bytes) = database_bytes { |
| 69 | field(o, "Database size", &format!("{bytes} bytes")); |
| 70 | } |
| 71 | } |
| 72 | RepositoryMetrics::Available { |
| 73 | database_bytes, |
| 74 | registered_changes, |
| 75 | views, |
| 76 | intents, |
| 77 | current_view, |
| 78 | build_versions, |
| 79 | tables, |
| 80 | last_compacted, |
| 81 | } => { |
| 82 | field( |
| 83 | o, |
| 84 | "Database size", |
| 85 | &display_number(database_bytes, " bytes"), |
| 86 | ); |
| 87 | field( |
| 88 | o, |
| 89 | "Registered changes", |
| 90 | &display_number(registered_changes, ""), |
| 91 | ); |
| 92 | field(o, "Views", &display_number(views, "")); |
| 93 | for (label, version) in [ |
| 94 | ("Created with", &build_versions.created_with), |
| 95 | ("Last migrated with", &build_versions.migrated_with), |
| 96 | ( |
| 97 | "Last writable initialization open with", |
| 98 | &build_versions.last_writable_open_with, |
| 99 | ), |
| 100 | ] { |
| 101 | match version { |
| 102 | Observation::Available { value } => field(o, label, value), |
| 103 | Observation::Unavailable { reason } => { |
| 104 | field(o, label, &format!("unknown — {reason}")) |
| 105 | } |
| 106 | } |
| 107 | } |
| 108 | match current_view { |
| 109 | Observation::Available { value } => field( |
| 110 | o, |
| 111 | "Current view", |
| 112 | &format!( |
| 113 | "{} direct membership ({} own, {} inherited)", |
| 114 | value.membership, value.own, value.inherited |
no test coverage detected