From 7e891b7c210a2a959132463e8b9d85709570a458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=82=8E=E6=B3=BC?= Date: Fri, 15 Dec 2023 09:13:26 +0800 Subject: [PATCH] Doc: add TOC for FAQ --- Makefile | 1 + openraft/src/docs/faq/Makefile | 5 +++++ openraft/src/docs/faq/faq-toc.md | 9 +++++++++ openraft/src/docs/faq/faq.md | 2 -- openraft/src/docs/faq/mod.rs | 3 +++ 5 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 openraft/src/docs/faq/Makefile create mode 100644 openraft/src/docs/faq/faq-toc.md diff --git a/Makefile b/Makefile index 77870449c..dbff136b3 100644 --- a/Makefile +++ b/Makefile @@ -35,6 +35,7 @@ fix: cargo fix --allow-staged doc: + make -C openraft/src/docs/faq RUSTDOCFLAGS="-D warnings" cargo doc --document-private-items --all --no-deps check_missing_doc: diff --git a/openraft/src/docs/faq/Makefile b/openraft/src/docs/faq/Makefile new file mode 100644 index 000000000..8eb27555e --- /dev/null +++ b/openraft/src/docs/faq/Makefile @@ -0,0 +1,5 @@ +all: + # dependency: + # https://github.com/jonschlinkert/markdown-toc#cli + # brew install markdown-toc + markdown-toc faq.md > faq-toc.md diff --git a/openraft/src/docs/faq/faq-toc.md b/openraft/src/docs/faq/faq-toc.md new file mode 100644 index 000000000..b426512f9 --- /dev/null +++ b/openraft/src/docs/faq/faq-toc.md @@ -0,0 +1,9 @@ +- [What are the differences between Openraft and standard Raft?](#what-are-the-differences-between-openraft-and-standard-raft) +- [Why is log id a tuple of `(term, node_id, log_index)`?](#why-is-log-id-a-tuple-of-term-node_id-log_index) +- [How to initialize a cluster?](#how-to-initialize-a-cluster) +- [Are there any issues with running a single node service?](#are-there-any-issues-with-running-a-single-node-service) +- [How to remove node-2 safely from a cluster `{1, 2, 3}`?](#how-to-remove-node-2-safely-from-a-cluster-1-2-3) +- [What actions are required when a node restarts?](#what-actions-are-required-when-a-node-restarts) +- [What will happen when data gets lost?](#what-will-happen-when-data-gets-lost) +- [Can I wipe out the data of ONE node and wait for the leader to replicate all data to it again?](#can-i-wipe-out-the-data-of-one-node-and-wait-for-the-leader-to-replicate-all-data-to-it-again) +- [Is Openraft resilient to incorrectly configured clusters?](#is-openraft-resilient-to-incorrectly-configured-clusters) \ No newline at end of file diff --git a/openraft/src/docs/faq/faq.md b/openraft/src/docs/faq/faq.md index 1e38e828b..c1657d596 100644 --- a/openraft/src/docs/faq/faq.md +++ b/openraft/src/docs/faq/faq.md @@ -1,5 +1,3 @@ -# FAQ - ### What are the differences between Openraft and standard Raft? - Optionally, In one term there could be more than one leaders to be established, in order to reduce election conflict. See: std mode and adv mode leader id: [`leader_id`][]; diff --git a/openraft/src/docs/faq/mod.rs b/openraft/src/docs/faq/mod.rs index e232f7fa2..7eba4e344 100644 --- a/openraft/src/docs/faq/mod.rs +++ b/openraft/src/docs/faq/mod.rs @@ -1 +1,4 @@ +//! # FAQ +#![doc = include_str!("faq-toc.md")] + #![doc = include_str!("faq.md")]