From 1ccf82f932fcc845fa6e81fce0019f3c528efe81 Mon Sep 17 00:00:00 2001 From: Alexey Kondratov Date: Tue, 25 May 2021 17:28:02 +0300 Subject: [PATCH] More info about branches tree drawing routines Debt for the #144 --- zenith/src/main.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/zenith/src/main.rs b/zenith/src/main.rs index 779da7efd5..b4674413fb 100644 --- a/zenith/src/main.rs +++ b/zenith/src/main.rs @@ -12,8 +12,13 @@ use std::str::FromStr; use pageserver::{branches::BranchInfo, ZTimelineId}; use zenith_utils::lsn::Lsn; +/// +/// Branches tree element used as a value in the HashMap. +/// struct BranchTreeEl { + /// `BranchInfo` received from the `pageserver` via the `branch_list` libpq API call. pub info: BranchInfo, + /// Holds all direct children of this branch referenced using `timeline_id`. pub children: Vec, } @@ -172,7 +177,9 @@ fn main() -> Result<()> { Ok(()) } -// Print branches list as a tree-like structure. +/// +/// Prints branches list as a tree-like structure. +/// fn print_branches_tree(branches: Vec) -> Result<()> { let mut branches_hash: HashMap = HashMap::new(); @@ -214,7 +221,9 @@ fn print_branches_tree(branches: Vec) -> Result<()> { Ok(()) } -// Recursively print branch info with all its children. +/// +/// Recursively prints branch info with all its children. +/// fn print_branch( nesting_level: usize, is_last: &[bool],