diff --git a/src/server.rs b/src/server.rs index 525a65026f..03f543994d 100644 --- a/src/server.rs +++ b/src/server.rs @@ -20,6 +20,30 @@ pub struct Server { } impl Server { + /// Create a server instance acting as leader. + /// + /// ```text + /// .---------------------. + /// | Leader | + /// | | + /// .--------. | .-----. | + /// | |---->| | | + /// | Client | | | RPU | | + /// | |<----| | | + /// `----+---` | `-----` | + /// | | ^ | + /// | | | | + /// | | .--+---. | + /// | | | Bank | | + /// | | `------` | + /// | | ^ | + /// | | | | .------------. + /// | | .--+--. .-----. | | | + /// `-------->| TPU +-->| NCP +------>| Validators | + /// | `-----` `-----` | | | + /// | | `------------` + /// `---------------------` + /// ``` pub fn new_leader( bank: Bank, tick_duration: Option, @@ -72,6 +96,31 @@ impl Server { Server { thread_hdls } } + + /// Create a server instance acting as validator. + /// + /// ```text + /// .-------------------------------. + /// | Validator | + /// | | + /// .--------. | .-----. | + /// | |-------------->| | | + /// | Client | | | RPU | | + /// | |<--------------| | | + /// `--------` | `-----` | + /// | ^ | + /// | | | + /// | .--+---. | + /// | | Bank | | + /// | `------` | + /// | ^ | + /// .--------. | | | .------------. + /// | | | .-----. .--+--. .-----. | | | + /// | Leader |----| NCP +-->| TVU +-->| NCP +------>| Validators | + /// | | | `-----` `-----` `-----` | | | + /// `--------` | | `------------` + /// `-------------------------------` + /// ``` pub fn new_validator( bank: Bank, me: ReplicatedData,