LCOV - code coverage report
Current view: top level - libs/pageserver_api/src - upcall_api.rs (source / functions) Coverage Total Hit
Test: 09e7485004805bd42b53a0c369170b3228136512.info Lines: 0.0 % 10 0
Test Date: 2024-11-21 18:36:18 Functions: 0.0 % 85 0

            Line data    Source code
       1              : //! Types in this file are for pageserver's upward-facing API calls to the control plane,
       2              : //! required for acquiring and validating tenant generation numbers.
       3              : //!
       4              : //! See docs/rfcs/025-generation-numbers.md
       5              : 
       6              : use serde::{Deserialize, Serialize};
       7              : use utils::id::NodeId;
       8              : 
       9              : use crate::{
      10              :     controller_api::NodeRegisterRequest, models::LocationConfigMode, shard::TenantShardId,
      11              : };
      12              : 
      13              : /// Upcall message sent by the pageserver to the configured `control_plane_api` on
      14              : /// startup.
      15            0 : #[derive(Serialize, Deserialize)]
      16              : pub struct ReAttachRequest {
      17              :     pub node_id: NodeId,
      18              : 
      19              :     /// Optional inline self-registration: this is useful with the storage controller,
      20              :     /// if the node already has a node_id set.
      21              :     #[serde(skip_serializing_if = "Option::is_none", default)]
      22              :     pub register: Option<NodeRegisterRequest>,
      23              : }
      24              : 
      25            0 : fn default_mode() -> LocationConfigMode {
      26            0 :     LocationConfigMode::AttachedSingle
      27            0 : }
      28              : 
      29            0 : #[derive(Serialize, Deserialize, Debug)]
      30              : pub struct ReAttachResponseTenant {
      31              :     pub id: TenantShardId,
      32              :     /// Mandatory if LocationConfigMode is None or set to an Attached* mode
      33              :     pub gen: Option<u32>,
      34              : 
      35              :     /// Default value only for backward compat: this field should be set
      36              :     #[serde(default = "default_mode")]
      37              :     pub mode: LocationConfigMode,
      38              : }
      39            0 : #[derive(Serialize, Deserialize)]
      40              : pub struct ReAttachResponse {
      41              :     pub tenants: Vec<ReAttachResponseTenant>,
      42              : }
      43              : 
      44            0 : #[derive(Serialize, Deserialize)]
      45              : pub struct ValidateRequestTenant {
      46              :     pub id: TenantShardId,
      47              :     pub gen: u32,
      48              : }
      49              : 
      50            0 : #[derive(Serialize, Deserialize)]
      51              : pub struct ValidateRequest {
      52              :     pub tenants: Vec<ValidateRequestTenant>,
      53              : }
      54              : 
      55            0 : #[derive(Serialize, Deserialize)]
      56              : pub struct ValidateResponse {
      57              :     pub tenants: Vec<ValidateResponseTenant>,
      58              : }
      59              : 
      60            0 : #[derive(Serialize, Deserialize)]
      61              : pub struct ValidateResponseTenant {
      62              :     pub id: TenantShardId,
      63              :     pub valid: bool,
      64              : }
        

Generated by: LCOV version 2.1-beta