tikv / raft-rs

Raft distributed consensus algorithm implemented in Rust.
Apache License 2.0
2.93k stars 394 forks source link

Clarification needed: processing ready state #471

Closed rosik closed 2 years ago

rosik commented 2 years ago

Hi! I'm trying to understand the API in details, and need your help in figuring out valid use cases for the Ready state.

The doc states:

The returned Ready MUST be handled and subsequently passed back via advance or its families. Before that, DO NOT call any function like step, propose, campaign to change internal state.

But does the app HAVE TO call ready() if has_ready() == true? In other words, is it legal to call several step() and ignore a pending ready() for a while?

Thank you in advance.

BusyJay commented 2 years ago

is it legal to call several step() and ignore a pending ready() for a while?

Yes, it's legal. It's part of the reason why designing ready interface that allowing batching up state changes and handle them at once.