Skip to content

Commit

Permalink
Merge pull request tikv#263 from gfreezy/coprocessor-v2-protocol
Browse files Browse the repository at this point in the history
add new protocol messages for coprocessor_v2
  • Loading branch information
nrc authored Apr 14, 2021
2 parents 1dbbb14 + 75d1719 commit 0ca4cae
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tikv-client-proto/proto/coprocessor_v2.proto
Original file line number Diff line number Diff line change
@@ -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;
}
8 changes: 8 additions & 0 deletions tikv-client-proto/proto/tikvpb.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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) {}
Expand Down Expand Up @@ -144,6 +148,8 @@ message BatchCommandsRequest {

kvrpcpb.CheckSecondaryLocksRequest CheckSecondaryLocks = 33;

coprocessor_v2.RawCoprocessorRequest CoprocessorV2 = 34;

// For some test cases.
BatchCommandsEmptyRequest Empty = 255;
}
Expand Down Expand Up @@ -197,6 +203,8 @@ message BatchCommandsResponse {

kvrpcpb.CheckSecondaryLocksResponse CheckSecondaryLocks = 33;

coprocessor_v2.RawCoprocessorResponse CoprocessorV2 = 34;

// For some test cases.
BatchCommandsEmptyResponse Empty = 255;
}
Expand Down

0 comments on commit 0ca4cae

Please sign in to comment.