From 6e0a1118b9e3c2590ed8ae4c192fa54f21a080d2 Mon Sep 17 00:00:00 2001 From: bsbds <69835502+bsbds@users.noreply.github.com> Date: Fri, 19 Apr 2024 15:52:26 +0800 Subject: [PATCH] squash!: rename xor to exclusive Signed-off-by: bsbds <69835502+bsbds@users.noreply.github.com> --- crates/xline/src/conflict/mod.rs | 2 +- crates/xline/src/conflict/spec_pool.rs | 12 ++++++------ crates/xline/src/conflict/uncommitted_pool.rs | 12 ++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/crates/xline/src/conflict/mod.rs b/crates/xline/src/conflict/mod.rs index aa93a1a763..d0823dc6b9 100644 --- a/crates/xline/src/conflict/mod.rs +++ b/crates/xline/src/conflict/mod.rs @@ -30,7 +30,7 @@ where } /// Returns `true` if this command conflicts with all other commands -fn is_xor_cmd(cmd: &Command) -> bool { +fn is_exclusive_cmd(cmd: &Command) -> bool { matches!( *cmd.request(), RequestWrapper::CompactionRequest(_) diff --git a/crates/xline/src/conflict/spec_pool.rs b/crates/xline/src/conflict/spec_pool.rs index 90e842cb68..f7358ba0d8 100644 --- a/crates/xline/src/conflict/spec_pool.rs +++ b/crates/xline/src/conflict/spec_pool.rs @@ -8,7 +8,7 @@ use xlineapi::{ interval::BytesAffine, }; -use super::{filter_kv, intervals, is_xor_cmd}; +use super::{filter_kv, intervals, is_exclusive_cmd}; /// Speculative pool for KV commands. #[derive(Debug, Default)] @@ -113,12 +113,12 @@ impl SpeculativePoolOp for LeaseSpecPool { /// Speculative pool for commands that conflict with all other commands. #[derive(Debug, Default)] -pub(crate) struct XorSpecPool { +pub(crate) struct ExclusiveSpecPool { /// Stores the command conflict: Option>, } -impl ConflictPoolOp for XorSpecPool { +impl ConflictPoolOp for ExclusiveSpecPool { type Entry = CommandEntry; fn is_empty(&self) -> bool { @@ -126,7 +126,7 @@ impl ConflictPoolOp for XorSpecPool { } fn remove(&mut self, entry: Self::Entry) { - if is_xor_cmd(&entry) { + if is_exclusive_cmd(&entry) { self.conflict = None; } } @@ -144,13 +144,13 @@ impl ConflictPoolOp for XorSpecPool { } } -impl SpeculativePoolOp for XorSpecPool { +impl SpeculativePoolOp for ExclusiveSpecPool { fn insert_if_not_conflict(&mut self, entry: Self::Entry) -> Option { if self.conflict.is_some() { return Some(entry); } - if is_xor_cmd(&entry) { + if is_exclusive_cmd(&entry) { self.conflict = Some(entry.clone()); // Always returns conflict when the command conflicts with all other commands return Some(entry); diff --git a/crates/xline/src/conflict/uncommitted_pool.rs b/crates/xline/src/conflict/uncommitted_pool.rs index 07680c6bc6..1aa32d0cd3 100644 --- a/crates/xline/src/conflict/uncommitted_pool.rs +++ b/crates/xline/src/conflict/uncommitted_pool.rs @@ -9,7 +9,7 @@ use xlineapi::{ interval::BytesAffine, }; -use super::{filter_kv, intervals, is_xor_cmd}; +use super::{filter_kv, intervals, is_exclusive_cmd}; /// Uncommitted pool for KV commands. #[derive(Debug, Default)] @@ -158,12 +158,12 @@ impl UncommittedPoolOp for LeaseUncomPool { /// Uncommitted pool for commands that conflict with all other commands. #[derive(Debug, Default)] -pub(crate) struct XorUncomPool { +pub(crate) struct ExclusiveUncomPool { /// All commands in the pool conflicts: Commands, } -impl ConflictPoolOp for XorUncomPool { +impl ConflictPoolOp for ExclusiveUncomPool { type Entry = CommandEntry; fn all(&self) -> Vec { @@ -175,7 +175,7 @@ impl ConflictPoolOp for XorUncomPool { } fn remove(&mut self, entry: Self::Entry) { - if is_xor_cmd(&entry) { + if is_exclusive_cmd(&entry) { let _ignore = self.conflicts.remove_cmd(&entry); } } @@ -189,10 +189,10 @@ impl ConflictPoolOp for XorUncomPool { } } -impl UncommittedPoolOp for XorUncomPool { +impl UncommittedPoolOp for ExclusiveUncomPool { fn insert(&mut self, entry: Self::Entry) -> bool { let mut conflict = !self.conflicts.is_empty(); - if is_xor_cmd(&entry) { + if is_exclusive_cmd(&entry) { self.conflicts.push_cmd(entry); // Always returns conflict when the command conflicts with all other commands conflict = true;