mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-14 03:30:36 +00:00
rename: serde_percent::{Value => Percent}
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
//! A serde::Desierialize type for percentages.
|
||||
//!
|
||||
//! See [`Value`] for details.
|
||||
//! See [`Percent`] for details.
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@@ -8,9 +8,9 @@ use serde::{Deserialize, Serialize};
|
||||
/// deserialization fails with a descriptive error.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
|
||||
#[serde(transparent)]
|
||||
pub struct Value(#[serde(deserialize_with = "deserialize_pct_0_to_100")] u8);
|
||||
pub struct Percent(#[serde(deserialize_with = "deserialize_pct_0_to_100")] u8);
|
||||
|
||||
impl Value {
|
||||
impl Percent {
|
||||
pub fn get(&self) -> u8 {
|
||||
self.0
|
||||
}
|
||||
@@ -31,11 +31,11 @@ where
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::Value;
|
||||
use super::Percent;
|
||||
|
||||
#[derive(serde::Deserialize, serde::Serialize, Debug, PartialEq, Eq)]
|
||||
struct Foo {
|
||||
bar: Value,
|
||||
bar: Percent,
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -38,7 +38,7 @@ use sync_wrapper::SyncWrapper;
|
||||
use tokio::time::Instant;
|
||||
use tokio_util::sync::CancellationToken;
|
||||
use tracing::{debug, error, info, instrument, warn, Instrument};
|
||||
use utils::{approx_accurate::ApproxAccurate, id::TenantId, serde_percent};
|
||||
use utils::{approx_accurate::ApproxAccurate, id::TenantId, serde_percent::Percent};
|
||||
|
||||
use crate::{
|
||||
config::PageServerConf,
|
||||
@@ -48,7 +48,7 @@ use crate::{
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct DiskUsageEvictionTaskConfig {
|
||||
pub max_usage_pct: serde_percent::Value,
|
||||
pub max_usage_pct: Percent,
|
||||
pub min_avail_bytes: u64,
|
||||
#[serde(with = "humantime_serde")]
|
||||
pub period: Duration,
|
||||
|
||||
Reference in New Issue
Block a user