Trait coprocessor_plugin_api::CoprocessorPlugin[][src]

pub trait CoprocessorPlugin: Send + Sync {
    fn on_raw_coprocessor_request(
        &self,
        ranges: Vec<Range<Key>>,
        request: RawRequest,
        storage: &dyn RawStorage
    ) -> PluginResult<RawResponse>; }

A plugin that allows users to execute arbitrary code on TiKV nodes.

If you want to implement a custom coprocessor plugin for TiKV, your plugin needs to implement the CoprocessorPlugin trait.

Plugins can run setup code in their constructor and teardown code by implementing std::ops::Drop.

Required methods

fn on_raw_coprocessor_request(
    &self,
    ranges: Vec<Range<Key>>,
    request: RawRequest,
    storage: &dyn RawStorage
) -> PluginResult<RawResponse>
[src]

Handles a request to the coprocessor.

The data in the request parameter is exactly the same data that was passed with the RawCoprocessorRequest in the data field. Each plugin is responsible to properly decode the raw bytes by itself. The same is true for the return parameter of this function. Upon successful completion, the function should return a properly encoded result as raw bytes which is then sent back to the client.

Most of the time, it’s a good idea to use Protobuf for encoding/decoding, but in general you can also send raw bytes.

Plugins can read and write data from the underlying RawStorage via the storage parameter.

Loading content...

Implementors

Loading content...