Skip to content

Commit

Permalink
chore: clippy command after sync
Browse files Browse the repository at this point in the history
  • Loading branch information
bsbds committed May 16, 2024
1 parent 4d1de9f commit 61e6c74
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions crates/xline/src/server/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ impl CommandExecutor {
Ok((asr, er))
}

/// After sync other type of commands
async fn after_sync_others<T>(
&self,
wrapper: &RequestWrapper,
Expand Down Expand Up @@ -320,13 +321,13 @@ impl CommandExecutor {
.transpose()?;

let (asr, wr_ops) = match wrapper.backend() {
RequestBackend::Auth => self.auth_storage.after_sync(wrapper, &auth_revision)?,
RequestBackend::Auth => self.auth_storage.after_sync(wrapper, auth_revision)?,
RequestBackend::Lease => {
self.lease_storage
.after_sync(wrapper, &general_revision)
.after_sync(wrapper, general_revision)
.await?
}
RequestBackend::Alarm => self.alarm_storage.after_sync(wrapper, &general_revision),
RequestBackend::Alarm => self.alarm_storage.after_sync(wrapper, general_revision),
RequestBackend::Kv => unreachable!("Should not sync kv commands"),
};

Expand Down Expand Up @@ -377,19 +378,15 @@ impl CurpCommandExecutor<Command> for CommandExecutor {
}
cmds.iter()
.map(AfterSyncCmd::cmd)
.map(|c| self.check_alarm(c))
.collect::<Result<_, _>>()?;
.try_for_each(|c| self.check_alarm(c))?;
let quota_enough = cmds
.iter()
.map(AfterSyncCmd::cmd)
.all(|c| self.quota_checker.check(c));
cmds.iter()
.map(AfterSyncCmd::cmd)
.map(|c| {
self.auth_storage
.check_permission(c.request(), c.auth_info())
})
.collect::<Result<_, _>>()?;
cmds.iter().map(AfterSyncCmd::cmd).try_for_each(|c| {
self.auth_storage
.check_permission(c.request(), c.auth_info())
})?;

let index = self.kv_storage.index();
let index_state = index.state();
Expand Down Expand Up @@ -473,8 +470,7 @@ impl CurpCommandExecutor<Command> for CommandExecutor {
snapshot: Option<(Snapshot, LogIndex)>,
) -> Result<(), <Command as CurpCommand>::Error> {
let s = if let Some((snapshot, index)) = snapshot {
_ = self
.persistent
self.persistent
.write_ops(vec![WriteOp::PutAppliedIndex(index)])?;
Some(snapshot)
} else {
Expand Down

0 comments on commit 61e6c74

Please sign in to comment.