Merge pull request #263 from gfreezy/coprocessor-v2-protocol

add new protocol messages for coprocessor_v2
This commit is contained in:
Nick Cameron 2021-04-15 09:24:08 +12:00 committed by GitHub
commit 0ca4cae0c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 41 additions and 0 deletions

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) {}
@ -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;
}