Skip to content

Commit 6278726

Browse files
committed
add proto definitions
1 parent 968d3a4 commit 6278726

File tree

2 files changed

+91
-1
lines changed

2 files changed

+91
-1
lines changed

fluss-rpc/src/main/java/org/apache/fluss/rpc/protocol/ApiKeys.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ public enum ApiKeys {
7474
CONTROLLED_SHUTDOWN(1043, 0, 0, PRIVATE),
7575
ALTER_TABLE(1044, 0, 0, PUBLIC),
7676
DESCRIBE_CLUSTER_CONFIGS(1045, 0, 0, PUBLIC),
77-
ALTER_CLUSTER_CONFIGS(1046, 0, 0, PUBLIC);
77+
ALTER_CLUSTER_CONFIGS(1046, 0, 0, PUBLIC),
78+
KV_SCAN(1046, 0, 0, PUBLIC),
79+
KV_SCAN_HEARTBEAT(1046, 0, 0, PUBLIC);
7880

7981
private static final Map<Integer, ApiKeys> ID_TO_TYPE =
8082
Arrays.stream(ApiKeys.values())

fluss-rpc/src/main/proto/FlussApi.proto

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,94 @@ message LimitScanResponse{
269269
optional bytes records = 4;
270270
}
271271

272+
message NewScanRequestPB {
273+
// The tablet to scan.
274+
optional int64 partition_id = 1;
275+
required int32 bucket_id = 2;
276+
277+
// The maximum number of rows to scan with the new scanner.
278+
//
279+
// The scanner will automatically stop yielding results and close itself
280+
// after reaching this number of result rows.
281+
optional uint64 limit = 3;
282+
}
283+
284+
// A scan request. Initially, it should specify a scan. Later on, you
285+
// can use the scanner id returned to fetch result batches with a different
286+
// scan request.
287+
//
288+
// The scanner will remain open if there are more results, and it's not
289+
// asked to be closed explicitly.
290+
//
291+
// Clients may choose to retry scan requests that fail to complete (due to, for
292+
// example, a timeout or network error).
293+
//
294+
// You can fetch the results and ask the scanner to be closed to save
295+
// a trip if you are not interested in remaining results.
296+
message ScanRequest {
297+
// If continuing an existing scan, then you must set scanner_id.
298+
// Otherwise, you must set 'new_scan_request'.
299+
optional bytes scanner_id = 1;
300+
optional NewScanRequestPB new_scan_request = 2;
301+
302+
// The sequence ID of this call. It ensures that tablet server receives
303+
// scanner requests in the correct order and helps detect and prevent errors
304+
// caused by out-of-order or repeated requests.
305+
// The sequence ID should start at 0 with the request for a new scanner, and
306+
// after each successful request, the client should increment it by 1. When
307+
// retrying a request, the client should _not_ increment this value. If the server
308+
// detects that the client missed a chunk of rows from the middle of a scan, it will
309+
// respond with an error.
310+
optional uint32 call_seq_id = 3;
311+
312+
// The maximum number of bytes to send in the response.
313+
optional uint32 batch_size_bytes = 4;
314+
315+
// If set, the server will close the scanner after responding to
316+
// this request, regardless of whether all rows have been delivered.
317+
optional bool close_scanner = 5;
318+
319+
// Query id is used to trace the whole process of reading tablets.
320+
optional bytes query_id = 6;
321+
}
322+
323+
message ScanResponse {
324+
// The error, if an error occurred with this request.
325+
optional int32 error_code = 1;
326+
optional string error_message = 2;
327+
328+
// When a scanner is created, returns the scanner ID which may be used
329+
// to pull new rows from the scanner.
330+
optional bytes scanner_id = 3;
331+
332+
// Set to true to indicate that there may be further results to be fetched
333+
// from this scanner. If the scanner has no more results, then the scanner
334+
// ID will become invalid and cannot continue to be used.
335+
//
336+
// Note that if a scan returns no results, then the initial response from
337+
// the first RPC may return false in this flag, in which case there will
338+
// be no scanner ID assigned.
339+
optional bool has_more_results = 4;
340+
341+
// The block of returned rows.
342+
//
343+
// NOTE: the schema-related fields will not be present in this row block.
344+
// The schema will match the schema requested by the client when it created
345+
// the scanner.
346+
optional bytes records = 5;
347+
}
348+
349+
// A scanner keep-alive request.
350+
// Updates the scanner access time, increasing its time-to-live.
351+
message ScannerKeepAliveRequest {
352+
required bytes scanner_id = 1;
353+
}
354+
355+
message ScannerKeepAliveResponse {
356+
// The error, if an error occurred with this request.
357+
optional int32 error_code = 1;
358+
optional string error_message = 2;
359+
}
272360

273361
// notify bucket leader and isr request
274362
message NotifyLeaderAndIsrRequest {

0 commit comments

Comments
 (0)