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

Function render_repository

atomic-cli/src/commands/diagnostics/render.rs:57–145  ·  view source on GitHub ↗
(o: &mut String, repository: &RepositoryMetrics)

Source from the content-addressed store, hash-verified

55}
56
57fn 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

Callers 1

render_textFunction · 0.85

Calls 5

display_numberFunction · 0.85
lineFunction · 0.85
blankFunction · 0.85
sectionFunction · 0.70
fieldFunction · 0.70

Tested by

no test coverage detected