mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-14 17:02:56 +00:00
Improve the serde impl for several types (`Lsn`, `TenantId`, `TimelineId`) by making them sensitive to `Serializer::is_human_readadable` (true for json, false for bincode). Fixes #3511 by: - Implement the custom serde for `Lsn` - Implement the custom serde for `Id` - Add the helper module `serde_as_u64` in `libs/utils/src/lsn.rs` - Remove the unnecessary attr `#[serde_as(as = "DisplayFromStr")]` in all possible structs Additionally some safekeeper types gained serde tests. --------- Co-authored-by: Joonas Koivunen <joonas@neon.tech>
46 lines
1.0 KiB
Rust
46 lines
1.0 KiB
Rust
//! Types in this file are for pageserver's upward-facing API calls to the control plane,
|
|
//! required for acquiring and validating tenant generation numbers.
|
|
//!
|
|
//! See docs/rfcs/025-generation-numbers.md
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
use utils::id::{NodeId, TenantId};
|
|
|
|
#[derive(Serialize, Deserialize)]
|
|
pub struct ReAttachRequest {
|
|
pub node_id: NodeId,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize)]
|
|
pub struct ReAttachResponseTenant {
|
|
pub id: TenantId,
|
|
pub gen: u32,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize)]
|
|
pub struct ReAttachResponse {
|
|
pub tenants: Vec<ReAttachResponseTenant>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize)]
|
|
pub struct ValidateRequestTenant {
|
|
pub id: TenantId,
|
|
pub gen: u32,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize)]
|
|
pub struct ValidateRequest {
|
|
pub tenants: Vec<ValidateRequestTenant>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize)]
|
|
pub struct ValidateResponse {
|
|
pub tenants: Vec<ValidateResponseTenant>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize)]
|
|
pub struct ValidateResponseTenant {
|
|
pub id: TenantId,
|
|
pub valid: bool,
|
|
}
|