refactor: Use ReplicationFactor type in more places

- Remove the replication_factor.replication_factor() in favor of
  usize::from(replication_factor) to make the conversion more explicit.

- Implement Display on ReplicationFactor so that it can be formatted
  without converting to usize

- Use ReplicationFactor in the constructor of LayoutVersion and add a
  method to get a ReplicationFactor from a LayoutVersion, despite
  LayoutVersion still storing it as usize internally.
This commit is contained in:
Yureka
2025-04-20 20:33:34 +02:00
parent e79b485aa8
commit c8e9c45889
4 changed files with 22 additions and 15 deletions
+1 -1
View File
@@ -68,7 +68,7 @@ impl SystemMetrics {
let replication_factor = system.replication_factor;
meter
.u64_value_observer("garage_replication_factor", move |observer| {
observer.observe(replication_factor.replication_factor() as u64, &[])
observer.observe(usize::from(replication_factor) as u64, &[])
})
.with_description("Garage replication factor setting")
.init()