mirror of https://github.com/tikv/client-rust.git
refactor: rename PropagateError to ExtractError
Signed-off-by: ekexium <ekexium@gmail.com>
This commit is contained in:
parent
0e2284c10f
commit
212dfd1f2a
|
@ -179,7 +179,7 @@ impl Client {
|
|||
.await?
|
||||
.resolve_lock(OPTIMISTIC_BACKOFF)
|
||||
.retry_region(DEFAULT_REGION_BACKOFF)
|
||||
.propagate_error()
|
||||
.extract_error()
|
||||
.plan();
|
||||
plan.execute().await?;
|
||||
Ok(())
|
||||
|
@ -211,7 +211,7 @@ impl Client {
|
|||
.resolve_lock(OPTIMISTIC_BACKOFF)
|
||||
.multi_region()
|
||||
.retry_region(DEFAULT_REGION_BACKOFF)
|
||||
.propagate_error()
|
||||
.extract_error()
|
||||
.plan();
|
||||
plan.execute().await?;
|
||||
Ok(())
|
||||
|
@ -241,7 +241,7 @@ impl Client {
|
|||
.await?
|
||||
.resolve_lock(OPTIMISTIC_BACKOFF)
|
||||
.retry_region(DEFAULT_REGION_BACKOFF)
|
||||
.propagate_error()
|
||||
.extract_error()
|
||||
.plan();
|
||||
plan.execute().await?;
|
||||
Ok(())
|
||||
|
@ -271,7 +271,7 @@ impl Client {
|
|||
.resolve_lock(OPTIMISTIC_BACKOFF)
|
||||
.multi_region()
|
||||
.retry_region(DEFAULT_REGION_BACKOFF)
|
||||
.propagate_error()
|
||||
.extract_error()
|
||||
.plan();
|
||||
plan.execute().await?;
|
||||
Ok(())
|
||||
|
@ -298,7 +298,7 @@ impl Client {
|
|||
.resolve_lock(OPTIMISTIC_BACKOFF)
|
||||
.multi_region()
|
||||
.retry_region(DEFAULT_REGION_BACKOFF)
|
||||
.propagate_error()
|
||||
.extract_error()
|
||||
.plan();
|
||||
plan.execute().await?;
|
||||
Ok(())
|
||||
|
|
|
@ -10,8 +10,8 @@ use tikv_client_store::{HasError, Request};
|
|||
|
||||
pub use self::{
|
||||
plan::{
|
||||
Collect, CollectError, DefaultProcessor, Dispatch, Merge, MergeResponse, MultiRegion, Plan,
|
||||
Process, ProcessResponse, PropagateError, ResolveLock, RetryRegion,
|
||||
Collect, CollectError, DefaultProcessor, Dispatch, ExtractError, Merge, MergeResponse,
|
||||
MultiRegion, Plan, Process, ProcessResponse, ResolveLock, RetryRegion,
|
||||
},
|
||||
plan_builder::{PlanBuilder, SingleKey},
|
||||
shard::Shardable,
|
||||
|
@ -167,7 +167,7 @@ mod test {
|
|||
.resolve_lock(Backoff::no_jitter_backoff(1, 1, 3))
|
||||
.multi_region()
|
||||
.retry_region(Backoff::no_jitter_backoff(1, 1, 3))
|
||||
.propagate_error()
|
||||
.extract_error()
|
||||
.plan();
|
||||
let _ = executor::block_on(async { plan.execute().await });
|
||||
|
||||
|
|
|
@ -249,20 +249,20 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
pub struct PropagateError<P: Plan> {
|
||||
pub struct ExtractError<P: Plan> {
|
||||
pub inner: P,
|
||||
}
|
||||
|
||||
impl<P: Plan> Clone for PropagateError<P> {
|
||||
impl<P: Plan> Clone for ExtractError<P> {
|
||||
fn clone(&self) -> Self {
|
||||
PropagateError {
|
||||
ExtractError {
|
||||
inner: self.inner.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl<P: Plan> Plan for PropagateError<P>
|
||||
impl<P: Plan> Plan for ExtractError<P>
|
||||
where
|
||||
P::Result: HasError,
|
||||
{
|
||||
|
|
|
@ -4,8 +4,8 @@ use crate::{
|
|||
backoff::Backoff,
|
||||
pd::PdClient,
|
||||
request::{
|
||||
DefaultProcessor, Dispatch, KvRequest, Merge, MergeResponse, MultiRegion, Plan, Process,
|
||||
ProcessResponse, PropagateError, ResolveLock, RetryRegion, Shardable,
|
||||
DefaultProcessor, Dispatch, ExtractError, KvRequest, Merge, MergeResponse, MultiRegion,
|
||||
Plan, Process, ProcessResponse, ResolveLock, RetryRegion, Shardable,
|
||||
},
|
||||
store::Store,
|
||||
transaction::HasLocks,
|
||||
|
@ -165,10 +165,10 @@ impl<PdC: PdClient, P: Plan> PlanBuilder<PdC, P, Targetted>
|
|||
where
|
||||
P::Result: HasError,
|
||||
{
|
||||
pub fn propagate_error(self) -> PlanBuilder<PdC, PropagateError<P>, Targetted> {
|
||||
pub fn extract_error(self) -> PlanBuilder<PdC, ExtractError<P>, Targetted> {
|
||||
PlanBuilder {
|
||||
pd_client: self.pd_client,
|
||||
plan: PropagateError { inner: self.plan },
|
||||
plan: ExtractError { inner: self.plan },
|
||||
phantom: self.phantom,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ async fn resolve_lock_with_retry(
|
|||
.await?
|
||||
.resolve_lock(Backoff::no_backoff())
|
||||
.retry_region(Backoff::no_backoff())
|
||||
.propagate_error()
|
||||
.extract_error()
|
||||
.plan();
|
||||
match plan.execute().await {
|
||||
Ok(_) => {
|
||||
|
|
|
@ -901,7 +901,7 @@ impl Committer {
|
|||
.multi_region()
|
||||
.retry_region(self.options.retry_options.region_backoff.clone())
|
||||
.merge(CollectError)
|
||||
.propagate_error()
|
||||
.extract_error()
|
||||
.plan();
|
||||
let response = plan.execute().await?;
|
||||
|
||||
|
@ -940,7 +940,7 @@ impl Committer {
|
|||
.resolve_lock(self.options.retry_options.lock_backoff.clone())
|
||||
.multi_region()
|
||||
.retry_region(self.options.retry_options.region_backoff.clone())
|
||||
.propagate_error()
|
||||
.extract_error()
|
||||
.plan();
|
||||
plan.execute()
|
||||
.inspect_err(|e| {
|
||||
|
@ -977,7 +977,7 @@ impl Committer {
|
|||
.resolve_lock(self.options.retry_options.lock_backoff)
|
||||
.multi_region()
|
||||
.retry_region(self.options.retry_options.region_backoff)
|
||||
.propagate_error()
|
||||
.extract_error()
|
||||
.plan();
|
||||
plan.execute().await?;
|
||||
Ok(())
|
||||
|
@ -998,7 +998,7 @@ impl Committer {
|
|||
.resolve_lock(self.options.retry_options.lock_backoff)
|
||||
.multi_region()
|
||||
.retry_region(self.options.retry_options.region_backoff)
|
||||
.propagate_error()
|
||||
.extract_error()
|
||||
.plan();
|
||||
plan.execute().await?;
|
||||
}
|
||||
|
@ -1008,7 +1008,7 @@ impl Committer {
|
|||
.resolve_lock(self.options.retry_options.lock_backoff)
|
||||
.multi_region()
|
||||
.retry_region(self.options.retry_options.region_backoff)
|
||||
.propagate_error()
|
||||
.extract_error()
|
||||
.plan();
|
||||
plan.execute().await?;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue