add protobuf for coprocessor_v2

Signed-off-by: Alex.F <gfreezy@gmail.com>
This commit is contained in:
Alex.F 2021-04-15 15:01:48 +08:00
parent e259488559
commit c81115778e
4 changed files with 55 additions and 3 deletions

View File

@ -513,4 +513,13 @@ impl Tikv for MockTikv {
) {
todo!()
}
fn coprocessor_v2(
&mut self,
_: grpcio::RpcContext,
_: tikv_client_proto::coprocessor_v2::RawCoprocessorRequest,
_: grpcio::UnarySink<tikv_client_proto::coprocessor_v2::RawCoprocessorResponse>,
) {
todo!()
}
}

View File

@ -0,0 +1,33 @@
syntax = "proto3";
package coprocessor_v2;
import "errorpb.proto";
import "kvrpcpb.proto";
import "gogoproto/gogo.proto";
import "rustproto.proto";
option (gogoproto.marshaler_all) = true;
option (gogoproto.sizer_all) = true;
option (gogoproto.unmarshaler_all) = true;
option (rustproto.lite_runtime_all) = true;
option java_package = "org.tikv.kvproto";
message RawCoprocessorRequest {
kvrpcpb.Context context = 1;
string copr_name = 2;
string copr_version_constraint = 3;
bytes data = 4;
}
message RawCoprocessorResponse {
bytes data = 1;
errorpb.Error region_error = 2;
// Error message for cases like if no coprocessor with a matching name is found
// or on a version mismatch between plugin_api and the coprocessor.
string other_error = 4;
}

View File

@ -2,6 +2,7 @@ syntax = "proto3";
package tikvpb;
import "coprocessor.proto";
import "coprocessor_v2.proto";
import "kvrpcpb.proto";
import "mpp.proto";
import "raft_serverpb.proto";
@ -69,6 +70,9 @@ service Tikv {
rpc CoprocessorStream(coprocessor.Request) returns (stream coprocessor.Response) {}
rpc BatchCoprocessor(coprocessor.BatchRequest) returns (stream coprocessor.BatchResponse) {}
// Command for executing custom user requests in TiKV coprocessor_v2.
rpc CoprocessorV2(coprocessor_v2.RawCoprocessorRequest) returns (coprocessor_v2.RawCoprocessorResponse) {}
// Raft commands (sent between TiKV nodes).
rpc Raft(stream raft_serverpb.RaftMessage) returns (raft_serverpb.Done) {}
rpc BatchRaft(stream BatchRaftMessage) returns (raft_serverpb.Done) {}
@ -92,7 +96,7 @@ service Tikv {
rpc EstablishMPPConnection(mpp.EstablishMPPConnectionRequest) returns (stream mpp.MPPDataPacket) {}
/// CheckLeader sends all information (includes region term and epoch) to other stores.
/// Once a store receives a request, it checks term and epoch for each region, and sends the regions whose
/// Once a store receives a request, it checks term and epoch for each region, and sends the regions whose
/// term and epoch match with local information in the store.
/// After the client collected all responses from all stores, it checks if got a quorum of responses from
/// other stores for every region, and decides to advance resolved ts from these regions.
@ -144,6 +148,8 @@ message BatchCommandsRequest {
kvrpcpb.CheckSecondaryLocksRequest CheckSecondaryLocks = 33;
coprocessor_v2.RawCoprocessorRequest CoprocessorV2 = 34;
// For some test cases.
BatchCommandsEmptyRequest Empty = 255;
}
@ -197,6 +203,8 @@ message BatchCommandsResponse {
kvrpcpb.CheckSecondaryLocksResponse CheckSecondaryLocks = 33;
coprocessor_v2.RawCoprocessorResponse CoprocessorV2 = 34;
// For some test cases.
BatchCommandsEmptyResponse Empty = 255;
}
@ -217,4 +225,4 @@ message BatchCommandsEmptyRequest {
message BatchCommandsEmptyResponse {
// ID of the test request.
uint64 test_id = 1;
}
}

View File

@ -1,7 +1,9 @@
// Copyright 2020 TiKV Project Authors. Licensed under Apache-2.0.
use protos::*;
pub use protos::{coprocessor, errorpb, kvrpcpb, metapb, mpp, pdpb, raft_serverpb, tikvpb};
pub use protos::{
coprocessor, coprocessor_v2, errorpb, kvrpcpb, metapb, mpp, pdpb, raft_serverpb, tikvpb,
};
#[allow(dead_code)]
#[allow(clippy::all)]