Explorar o código

Expose the new verify authority API.

Jing Yang %!s(int64=3) %!d(string=hai) anos
pai
achega
ef2573e986
Modificáronse 2 ficheiros con 4 adicións e 4 borrados
  1. 1 0
      src/lib.rs
  2. 3 4
      src/verify_authority.rs

+ 1 - 0
src/lib.rs

@@ -21,6 +21,7 @@ pub use crate::remote_raft::RemoteRaft;
 pub use crate::snapshot::Snapshot;
 use crate::snapshot::{RequestSnapshotFnMut, SnapshotDaemon};
 use crate::verify_authority::VerifyAuthorityDaemon;
+pub use crate::verify_authority::VerifyAuthorityResult;
 
 mod apply_command;
 mod beat_ticker;

+ 3 - 4
src/verify_authority.rs

@@ -12,7 +12,7 @@ use std::time::{Duration, Instant};
 /// The result returned to a verify authority request.
 /// This request is not directly exposed to end users. Instead it is used
 /// internally to implement no-commit read-only requests.
-pub(crate) enum VerifyAuthorityResult {
+pub enum VerifyAuthorityResult {
     Success(Index),
     TermElapsed,
     TimedOut,
@@ -337,10 +337,9 @@ impl<Command: 'static + Send> Raft<Command> {
     /// The application is also free to include any subsequent commits in the
     /// response. Consistency is still guaranteed, because Raft never rolls back
     /// committed commands.
-    #[allow(dead_code)]
-    pub(crate) fn verify_authority_async(
+    pub fn verify_authority_async(
         &self,
-    ) -> Option<impl Future<Output = VerifyAuthorityResult>> {
+    ) -> Option<impl Future<Output = crate::VerifyAuthorityResult>> {
         let (term, commit_index) = {
             let rf = self.inner_state.lock();
             if !rf.is_leader() {