Struct tikv::coprocessor::endpoint::Endpoint[][src]

pub struct Endpoint<E: Engine> {
    read_pool: ReadPoolHandle,
    semaphore: Option<Arc<Semaphore>>,
    concurrency_manager: ConcurrencyManager,
    perf_level: PerfLevel,
    recursion_limit: u32,
    batch_row_limit: usize,
    stream_batch_row_limit: usize,
    stream_channel_size: usize,
    max_handle_duration: Duration,
    slow_log_threshold: Duration,
    _phantom: PhantomData<E>,
}

A pool to build and run Coprocessor request handlers.

Fields

read_pool: ReadPoolHandle

The thread pool to run Coprocessor requests.

semaphore: Option<Arc<Semaphore>>

The concurrency limiter of the coprocessor.

concurrency_manager: ConcurrencyManagerperf_level: PerfLevelrecursion_limit: u32

The recursion limit when parsing Coprocessor Protobuf requests.

Note that this limit is ignored if we are using Prost.

batch_row_limit: usizestream_batch_row_limit: usizestream_channel_size: usizemax_handle_duration: Duration

The soft time limit of handling Coprocessor requests.

slow_log_threshold: Duration_phantom: PhantomData<E>

Implementations

impl<E: Engine> Endpoint<E>[src]

pub fn new(
    cfg: &Config,
    read_pool: ReadPoolHandle,
    concurrency_manager: ConcurrencyManager,
    perf_level: PerfLevel
) -> Self
[src]

fn check_memory_locks(&self, req_ctx: &ReqContext) -> Result<()>[src]

fn parse_request_and_check_memory_locks(
    &self,
    req: Request,
    peer: Option<String>,
    is_streaming: bool
) -> Result<(Box<dyn FnOnce(E::Snap, &ReqContext) -> Result<Box<dyn RequestHandler>> + Send>, ReqContext)>
[src]

Parse the raw Request to create RequestHandlerBuilder and ReqContext. Returns Err if fails.

It also checks if there are locks in memory blocking this read request.

fn get_batch_row_limit(&self, is_streaming: bool) -> usize[src]

Get the batch row limit configuration.

fn async_snapshot(
    engine: &E,
    ctx: &ReqContext
) -> impl Future<Output = Result<E::Snap>>
[src]

async fn handle_unary_request_impl(
    semaphore: Option<Arc<Semaphore>>,
    tracker: Box<Tracker>,
    handler_builder: Box<dyn FnOnce(E::Snap, &ReqContext) -> Result<Box<dyn RequestHandler>> + Send>
) -> Result<Response>
[src]

The real implementation of handling a unary request.

It first retrieves a snapshot, then builds the RequestHandler over the snapshot and the given handler_builder. Finally, it calls the unary request interface of the RequestHandler to process the request and produce a result.

fn handle_unary_request(
    &self,
    req_ctx: ReqContext,
    handler_builder: Box<dyn FnOnce(E::Snap, &ReqContext) -> Result<Box<dyn RequestHandler>> + Send>
) -> impl Future<Output = Result<Response>>
[src]

Handle a unary request and run on the read pool.

Returns Err(err) if the read pool is full. Returns Ok(future) in other cases. The future inside may be an error however.

pub fn parse_and_handle_unary_request(
    &self,
    req: Request,
    peer: Option<String>
) -> impl Future<Output = Response>
[src]

Parses and handles a unary request. Returns a future that will never fail. If there are errors during parsing or handling, they will be converted into a Response as the success result of the future.

fn handle_stream_request_impl(
    semaphore: Option<Arc<Semaphore>>,
    tracker: Box<Tracker>,
    handler_builder: Box<dyn FnOnce(E::Snap, &ReqContext) -> Result<Box<dyn RequestHandler>> + Send>
) -> impl Stream<Item = Result<Response>>
[src]

The real implementation of handling a stream request.

It first retrieves a snapshot, then builds the RequestHandler over the snapshot and the given handler_builder. Finally, it calls the stream request interface of the RequestHandler multiple times to process the request and produce multiple results.

fn handle_stream_request(
    &self,
    req_ctx: ReqContext,
    handler_builder: Box<dyn FnOnce(E::Snap, &ReqContext) -> Result<Box<dyn RequestHandler>> + Send>
) -> Result<impl Stream<Item = Result<Response>>>
[src]

Handle a stream request and run on the read pool.

Returns Err(err) if the read pool is full. Returns Ok(stream) in other cases. The stream inside may produce errors however.

pub fn parse_and_handle_stream_request(
    &self,
    req: Request,
    peer: Option<String>
) -> impl Stream<Item = Response>
[src]

Parses and handles a stream request. Returns a stream that produce each result in a Response and will never fail. If there are errors during parsing or handling, they will be converted into a Response as the only stream item.

Trait Implementations

impl<E: Engine> AssertSend for Endpoint<E>[src]

impl<E: Clone + Engine> Clone for Endpoint<E>[src]

Auto Trait Implementations

impl<E> !RefUnwindSafe for Endpoint<E>

impl<E> Send for Endpoint<E>

impl<E> Sync for Endpoint<E> where
    E: Sync

impl<E> Unpin for Endpoint<E> where
    E: Unpin

impl<E> !UnwindSafe for Endpoint<E>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<V, W> ConvertFrom<W> for V where
    W: ConvertTo<V>, 
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T[src]

type Init = T

The type for initializers.

impl<T> Pointable for T[src]

type Init = T

The type for initializers.

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T> Sealed<T> for T where
    T: ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]