Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jopemachine committed Jan 2, 2024
1 parent 5599c16 commit 58d7141
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ let raft = Raft::build(
)?;
let node_id = 1;
tokio::spawn(raft.clone().run());

// ...
tokio::try_join!(raft_handle)?;
```
Expand All @@ -119,8 +120,8 @@ Then join the follower nodes.
If peer specifies the configuration of the initial members, the cluster will operate after all member nodes are bootstrapped.

```rust
peer_addr = ... "(Some Raft server address)"
join_ticket = await Raft.request_id(peer_addr)
let peer_addr = "127.0.0.1:60061".to_owned();
let join_ticket = await Raft.request_id(peer_addr);

let raft = Raft::build(
node_id,
Expand Down Expand Up @@ -164,9 +165,16 @@ If you want to operate FSM locally, use the RaftNode interface of the Raft objec

```rust
let mut raft_node = raft.get_raft_node();
await raft_node.propose();
await raft_node.propose(LogEntry::Insert {
key: 1,
value: "test".to_string(),
}
.encode()
.unwrap());
```

It also provides a variety of other very useful APIs. Take a look at [the document]()

### Debugging

```
Expand Down

0 comments on commit 58d7141

Please sign in to comment.