Skip to content

Commit

Permalink
deps: update metriken to 0.6.0 (#128)
Browse files Browse the repository at this point in the history
Update metriken to 0.6.0. This is a breaking change
where the Snapshot was removed, and the AtomicHistogram
returns a regular Histogram when the snapshot is taken.

Also remove clippy warnings.
  • Loading branch information
mihirn authored Jun 12, 2024
1 parent 389bee2 commit 17033fd
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 49 deletions.
96 changes: 58 additions & 38 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ httparse = "1.8.0"
libc = "0.2.149"
log = "0.4.20"
memmap2 = "0.9.0"
metriken = "0.3.3"
metriken = "0.6.0"
metrohash = "1.0.6"
mio = "0.8.11"
nom = "7.1.3"
Expand Down
10 changes: 5 additions & 5 deletions src/protocol/admin/src/snapshots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::collections::HashMap;
use std::sync::Arc;
use std::time::SystemTime;

type HistogramSnapshots = HashMap<String, metriken::histogram::Snapshot>;
type HistogramSnapshots = HashMap<String, metriken::histogram::Histogram>;

pub static SNAPSHOTS: Lazy<Arc<RwLock<Snapshots>>> =
Lazy::new(|| Arc::new(RwLock::new(Snapshots::new())));
Expand Down Expand Up @@ -39,9 +39,9 @@ impl Snapshots {

let snapshot = if let Some(histogram) = any.downcast_ref::<metriken::AtomicHistogram>()
{
histogram.snapshot()
histogram.load()
} else if let Some(histogram) = any.downcast_ref::<metriken::RwLockHistogram>() {
histogram.snapshot()
histogram.load()
} else {
None
};
Expand Down Expand Up @@ -76,9 +76,9 @@ impl Snapshots {

let snapshot = if let Some(histogram) = any.downcast_ref::<metriken::AtomicHistogram>()
{
histogram.snapshot()
histogram.load()
} else if let Some(histogram) = any.downcast_ref::<metriken::RwLockHistogram>() {
histogram.snapshot()
histogram.load()
} else {
None
};
Expand Down
3 changes: 1 addition & 2 deletions src/protocol/memcache/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
pub use nom::bytes::streaming::*;
pub use nom::character::streaming::*;
pub use nom::error::ErrorKind;
pub use nom::{AsChar, Err, IResult, InputTakeAtPosition, Needed};
pub use protocol_common::Compose;
pub use nom::{AsChar, Err, IResult, InputTakeAtPosition};
pub use std::io::Write;

use crate::{TimeType, Ttl};
Expand Down
2 changes: 1 addition & 1 deletion src/protocol/resp/src/request/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ impl Klog for Set {
"\"set {} {} {} {}\" {} {}",
string_key(self.key()),
FLAG,
self.expire_time().unwrap_or(ExpireTime::default()),
self.expire_time().unwrap_or_default(),
self.value().len(),
code as u32,
len
Expand Down
3 changes: 1 addition & 2 deletions src/protocol/resp/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

pub use nom::bytes::streaming::*;
pub use nom::character::streaming::*;
pub use nom::{AsChar, Err, IResult, InputTakeAtPosition, Needed};
pub use protocol_common::Compose;
pub use nom::{AsChar, Err, IResult, Needed};
pub use std::io::{Error, ErrorKind, Write};

use crate::message::*;
Expand Down

0 comments on commit 17033fd

Please sign in to comment.