Files
orion_greptime_proto/proto/greptime/v1/flow/server.proto
T
fys 855dff1b87 chore: format proto file (#254)
* chore: proto file format using buf

* generate go file
2025-07-16 11:25:57 +08:00

110 lines
3.1 KiB
Protocol Buffer

// Copyright 2023 Greptime Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package greptime.v1.flow;
import "greptime/v1/common.proto";
import "greptime/v1/ddl.proto";
import "greptime/v1/row.proto";
option go_package = "github.com/GreptimeTeam/greptime-proto/go/greptime/v1/flow";
option java_outer_classname = "Server";
option java_package = "io.greptime.v1.flow";
service Flow {
// Handle the control plane request for creating or removing a flow.
rpc HandleCreateRemove(FlowRequest) returns (FlowResponse);
// Handle the data plane request for inserting or deleting rows
// only expect `RegionRequest` to be one of `InsertRequests` or
// `DeleteRequests` other types of `RegionRequest` will be ignored
rpc HandleMirrorRequest(InsertRequests) returns (FlowResponse);
rpc HandleMarkDirtyTimeWindow(DirtyWindowRequests) returns (FlowResponse);
}
message DirtyWindowRequests {
// The dirty time window requests.
// Each request contains a table_id and a list of dirty timestamps.
repeated DirtyWindowRequest requests = 1;
}
message DirtyWindowRequest {
uint32 table_id = 1;
// Dirty timestamps. Used to mark this point in time as dirty,
// so that the flow can be triggered to process the data.
repeated int64 timestamps = 2;
}
message FlowRequestHeader {
// Encoded trace_id & span_id, follow the w3c Trace Context
// https://www.w3.org/TR/trace-context/#header-name
map<string, string> tracing_context = 1;
// The contextual information of the query
QueryContext query_context = 2;
}
message InsertRequests {
repeated InsertRequest requests = 1;
}
message InsertRequest {
uint64 region_id = 1;
Rows rows = 2;
}
message FlowRequest {
FlowRequestHeader header = 64;
oneof body {
CreateRequest create = 1;
DropRequest drop = 2;
FlushFlow flush = 3;
}
}
message FlowResponse {
ResponseHeader header = 1;
uint64 affected_rows = 2;
// affected flow ids
repeated FlowId affected_flows = 3;
map<string, bytes> extensions = 4;
}
// Create a flow
//
// Very similar to `ddl.CreateTaskExpr`,
// replace `source_table_names` with `source_table_ids`
message CreateRequest {
FlowId flow_id = 1;
repeated TableId source_table_ids = 2;
TableName sink_table_name = 3;
bool create_if_not_exists = 4;
// Expire data older than the given duration seconds.
ExpireAfter expire_after = 5;
string comment = 6;
string sql = 7;
map<string, string> flow_options = 8;
// Set to true if the flow should be created or replaced.
bool or_replace = 9;
}
message DropRequest {
FlowId flow_id = 1;
}
message FlushFlow {
FlowId flow_id = 1;
}