TLA Line data Source code
1 : use serde::{Deserialize, Serialize};
2 : use serde_with::{serde_as, DisplayFromStr};
3 :
4 : use utils::{
5 : id::{NodeId, TenantId, TimelineId},
6 : lsn::Lsn,
7 : };
8 :
9 : #[serde_as]
10 CBC 108 : #[derive(Serialize, Deserialize)]
11 : pub struct TimelineCreateRequest {
12 : #[serde_as(as = "DisplayFromStr")]
13 : pub tenant_id: TenantId,
14 : #[serde_as(as = "DisplayFromStr")]
15 : pub timeline_id: TimelineId,
16 : pub peer_ids: Option<Vec<NodeId>>,
17 : pub pg_version: u32,
18 : pub system_id: Option<u64>,
19 : pub wal_seg_size: Option<u32>,
20 : #[serde_as(as = "DisplayFromStr")]
21 : pub commit_lsn: Lsn,
22 : // If not passed, it is assigned to the beginning of commit_lsn segment.
23 : pub local_start_lsn: Option<Lsn>,
24 : }
25 :
26 25 : fn lsn_invalid() -> Lsn {
27 25 : Lsn::INVALID
28 25 : }
29 :
30 : /// Data about safekeeper's timeline, mirrors broker.proto.
31 : #[serde_as]
32 20 : #[derive(Debug, Clone, Deserialize, Serialize)]
33 : pub struct SkTimelineInfo {
34 : /// Term.
35 : pub term: Option<u64>,
36 : /// Term of the last entry.
37 : pub last_log_term: Option<u64>,
38 : /// LSN of the last record.
39 : #[serde_as(as = "DisplayFromStr")]
40 : #[serde(default = "lsn_invalid")]
41 : pub flush_lsn: Lsn,
42 : /// Up to which LSN safekeeper regards its WAL as committed.
43 : #[serde_as(as = "DisplayFromStr")]
44 : #[serde(default = "lsn_invalid")]
45 : pub commit_lsn: Lsn,
46 : /// LSN up to which safekeeper has backed WAL.
47 : #[serde_as(as = "DisplayFromStr")]
48 : #[serde(default = "lsn_invalid")]
49 : pub backup_lsn: Lsn,
50 : /// LSN of last checkpoint uploaded by pageserver.
51 : #[serde_as(as = "DisplayFromStr")]
52 : #[serde(default = "lsn_invalid")]
53 : pub remote_consistent_lsn: Lsn,
54 : #[serde_as(as = "DisplayFromStr")]
55 : #[serde(default = "lsn_invalid")]
56 : pub peer_horizon_lsn: Lsn,
57 : #[serde_as(as = "DisplayFromStr")]
58 : #[serde(default = "lsn_invalid")]
59 : pub local_start_lsn: Lsn,
60 : /// A connection string to use for WAL receiving.
61 : #[serde(default)]
62 : pub safekeeper_connstr: Option<String>,
63 : #[serde(default)]
64 : pub http_connstr: Option<String>,
65 : }
|