mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-13 16:32:56 +00:00
Updates storage components to edition 2024. We like to stay on the latest edition if possible. There is no functional changes, however some code changes had to be done to accommodate the edition's breaking changes. The PR has two commits: * the first commit updates storage crates to edition 2024 and appeases `cargo clippy` by changing code. i have accidentially ran the formatter on some files that had other edits. * the second commit performs a `cargo fmt` I would recommend a closer review of the first commit and a less close review of the second one (as it just runs `cargo fmt`). part of https://github.com/neondatabase/neon/issues/10918
65 lines
1.8 KiB
Rust
65 lines
1.8 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;
|
|
|
|
use crate::controller_api::NodeRegisterRequest;
|
|
use crate::models::LocationConfigMode;
|
|
use crate::shard::TenantShardId;
|
|
|
|
/// Upcall message sent by the pageserver to the configured `control_plane_api` on
|
|
/// startup.
|
|
#[derive(Serialize, Deserialize)]
|
|
pub struct ReAttachRequest {
|
|
pub node_id: NodeId,
|
|
|
|
/// Optional inline self-registration: this is useful with the storage controller,
|
|
/// if the node already has a node_id set.
|
|
#[serde(skip_serializing_if = "Option::is_none", default)]
|
|
pub register: Option<NodeRegisterRequest>,
|
|
}
|
|
|
|
fn default_mode() -> LocationConfigMode {
|
|
LocationConfigMode::AttachedSingle
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug)]
|
|
pub struct ReAttachResponseTenant {
|
|
pub id: TenantShardId,
|
|
/// Mandatory if LocationConfigMode is None or set to an Attached* mode
|
|
pub r#gen: Option<u32>,
|
|
|
|
/// Default value only for backward compat: this field should be set
|
|
#[serde(default = "default_mode")]
|
|
pub mode: LocationConfigMode,
|
|
}
|
|
#[derive(Serialize, Deserialize)]
|
|
pub struct ReAttachResponse {
|
|
pub tenants: Vec<ReAttachResponseTenant>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize)]
|
|
pub struct ValidateRequestTenant {
|
|
pub id: TenantShardId,
|
|
pub r#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: TenantShardId,
|
|
pub valid: bool,
|
|
}
|