pub struct PlanBuilder<PdC: PdClient, P: Plan, Ph: PlanBuilderPhase> { /* private fields */ }
Expand description

Builder type for plans (see that module for more).

Implementations§

source§

impl<PdC: PdClient, Req: KvRequest> PlanBuilder<PdC, Dispatch<Req>, NoTarget>

source

pub fn new(pd_client: Arc<PdC>, encoded_request: EncodedRequest<Req>) -> Self

source§

impl<PdC: PdClient, P: Plan> PlanBuilder<PdC, P, Targetted>

source

pub fn plan(self) -> P

Return the built plan, note that this can only be called once the plan has a target.

source§

impl<PdC: PdClient, P: Plan, Ph: PlanBuilderPhase> PlanBuilder<PdC, P, Ph>

source

pub fn resolve_lock( self, backoff: Backoff ) -> PlanBuilder<PdC, ResolveLock<P, PdC>, Ph>where P::Result: HasLocks,

If there is a lock error, then resolve the lock and retry the request.

source

pub fn cleanup_locks( self, ctx: ResolveLocksContext, options: ResolveLocksOptions, backoff: Backoff ) -> PlanBuilder<PdC, CleanupLocks<P, PdC>, Ph>where P: Shardable + NextBatch, P::Result: HasLocks + HasNextBatch + HasRegionError + HasKeyErrors,

source

pub fn merge<In, M: Merge<In>>( self, merge: M ) -> PlanBuilder<PdC, MergeResponse<P, In, M>, Ph>where In: Clone + Send + Sync + 'static, P: Plan<Result = Vec<Result<In>>>,

Merge the results of a request. Usually used where a request is sent to multiple regions to combine the responses from each region.

source

pub fn post_process_default( self ) -> PlanBuilder<PdC, ProcessResponse<P, DefaultProcessor>, Ph>where P: Plan, DefaultProcessor: Process<P::Result>,

Apply the default processing step to a response (usually only needed if the request is sent to a single region because post-porcessing can be incorporated in the merge step for multi-region requests).

source§

impl<PdC: PdClient, P: Plan + Shardable> PlanBuilder<PdC, P, NoTarget>where P::Result: HasKeyErrors + HasRegionError,

source

pub fn retry_multi_region( self, backoff: Backoff ) -> PlanBuilder<PdC, RetryableMultiRegion<P, PdC>, Targetted>

Split the request into shards sending a request to the region of each shard.

source

pub fn retry_multi_region_preserve_results( self, backoff: Backoff ) -> PlanBuilder<PdC, RetryableMultiRegion<P, PdC>, Targetted>

Preserve all results, even some of them are Err. To pass all responses to merge, and handle partial successful results correctly.

source§

impl<PdC: PdClient, R: KvRequest> PlanBuilder<PdC, Dispatch<R>, NoTarget>

source

pub async fn single_region_with_store( self, store: RegionStore ) -> Result<PlanBuilder<PdC, Dispatch<R>, Targetted>>

Target the request at a single region; caller supplies the store to target.

source§

impl<PdC: PdClient, P: Plan + StoreRequest> PlanBuilder<PdC, P, NoTarget>where P::Result: HasKeyErrors + HasRegionError,

source

pub fn all_stores( self, backoff: Backoff ) -> PlanBuilder<PdC, RetryableAllStores<P, PdC>, Targetted>

source§

impl<PdC: PdClient, P: Plan + Shardable> PlanBuilder<PdC, P, NoTarget>where P::Result: HasKeyErrors,

source

pub fn preserve_shard(self) -> PlanBuilder<PdC, PreserveShard<P>, NoTarget>

source§

impl<PdC: PdClient, P: Plan> PlanBuilder<PdC, P, Targetted>where P::Result: HasKeyErrors + HasRegionErrors,

source

pub fn extract_error(self) -> PlanBuilder<PdC, ExtractError<P>, Targetted>

Auto Trait Implementations§

§

impl<PdC, P, Ph> RefUnwindSafe for PlanBuilder<PdC, P, Ph>where P: RefUnwindSafe, PdC: RefUnwindSafe, Ph: RefUnwindSafe,

§

impl<PdC, P, Ph> Send for PlanBuilder<PdC, P, Ph>where Ph: Send,

§

impl<PdC, P, Ph> Sync for PlanBuilder<PdC, P, Ph>where Ph: Sync,

§

impl<PdC, P, Ph> Unpin for PlanBuilder<PdC, P, Ph>where P: Unpin, Ph: Unpin,

§

impl<PdC, P, Ph> UnwindSafe for PlanBuilder<PdC, P, Ph>where P: UnwindSafe, PdC: RefUnwindSafe, Ph: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more