Skip to content

Commit

Permalink
Merge pull request scylladb#935 from muzarski/remove_public_usages_of…
Browse files Browse the repository at this point in the history
…_histogram

Remove `histogram::Histogram` from public API
  • Loading branch information
piodul authored Feb 16, 2024
2 parents 8a5be0a + caa559c commit 77d0089
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions scylla/src/transport/metrics.rs
Original file line number Diff line number Diff line change
@@ -1,30 +1,23 @@
use histogram::Histogram;
use std::sync::atomic::{AtomicU64, Ordering};
use std::sync::{Arc, Mutex, MutexGuard, PoisonError};
use std::sync::{Arc, Mutex};

const ORDER_TYPE: Ordering = Ordering::Relaxed;

#[derive(Debug)]
pub enum MetricsError<'a> {
Poison(PoisonError<MutexGuard<'a, Histogram>>),
Histogram(&'static str),
pub struct MetricsError {
cause: &'static str,
}

impl<'a> From<PoisonError<MutexGuard<'a, Histogram>>> for MetricsError<'a> {
fn from(err: PoisonError<MutexGuard<'_, Histogram>>) -> MetricsError {
MetricsError::Poison(err)
}
}

impl From<&'static str> for MetricsError<'_> {
impl From<&'static str> for MetricsError {
fn from(err: &'static str) -> MetricsError {
MetricsError::Histogram(err)
MetricsError { cause: err }
}
}

impl std::fmt::Display for MetricsError<'_> {
impl std::fmt::Display for MetricsError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self)
write!(f, "metrics error: {}", self.cause)
}
}

Expand Down

0 comments on commit 77d0089

Please sign in to comment.