github.com/matrixorigin/matrixone@v1.2.0/proto/logtail.proto (about) 1 /* 2 * Copyright 2021 Matrix Origin 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 syntax = "proto3"; 18 package logtail; 19 20 import "github.com/gogo/protobuf/gogoproto/gogo.proto"; 21 import "timestamp.proto"; 22 import "api.proto"; 23 24 option go_package = "github.com/matrixorigin/matrixone/pkg/pb/logtail"; 25 option (gogoproto.sizer_all) = false; 26 option (gogoproto.protosizer_all) = true; 27 28 // SubscribeRequest is the request for subscription. 29 message SubscribeRequest { 30 api.TableID table = 1; 31 } 32 33 // UnsubscribeRequest is the request for unsubscription. 34 message UnsubscribeRequest { 35 api.TableID table = 1; 36 } 37 38 // TableLogtail describes total or additional logtail for a table. 39 message TableLogtail { 40 string ckp_location = 1; 41 timestamp.Timestamp ts = 2; 42 api.TableID table = 3; 43 repeated api.Entry commands = 4 [(gogoproto.nullable) = false]; 44 } 45 46 // Status describes error details. 47 message Status { 48 // error code from moerr package 49 uint32 code = 1; 50 51 // error message 52 string message = 2; 53 } 54 55 // ErrorResponse is the response to notify CN with error. 56 message ErrorResponse { 57 Status status = 1 [(gogoproto.nullable) = false]; 58 api.TableID table = 2; 59 } 60 61 // SubscribeResponse is the response for subscription 62 // 63 // It contains total logtail for the newly subscribed table. 64 message SubscribeResponse { 65 TableLogtail logtail = 1 [(gogoproto.nullable) = false]; 66 } 67 68 // UpdateResponse is the response for additional logtail 69 // 70 // It contains additional logtail for all subscribed tables. 71 // The range of duration is (From, to]. 72 message UpdateResponse { 73 timestamp.Timestamp From = 1; 74 timestamp.Timestamp To = 2; 75 repeated TableLogtail logtail_list = 3 [(gogoproto.nullable) = false]; 76 } 77 78 // UnSubscribeResponse is the response for unsubscription 79 message UnSubscribeResponse { 80 api.TableID table = 1; 81 } 82 83 // logtail stream request 84 message LogtailRequest { 85 uint64 request_id = 1; 86 oneof request { 87 SubscribeRequest subscribe_table = 2; 88 UnsubscribeRequest unsubscribe_table = 3; 89 } 90 }; 91 92 // logtail stream response 93 message LogtailResponse { 94 uint64 response_id = 1; 95 oneof response { 96 SubscribeResponse subscribe_response = 2; 97 UnSubscribeResponse unsubscribe_response = 3; 98 UpdateResponse update_response = 4; 99 ErrorResponse error = 5; 100 } 101 }; 102 103 // message segment 104 message MessageSegment { 105 uint64 StreamID = 1; 106 int32 MessageSize = 2; 107 int32 Sequence = 3; 108 int32 MaxSequence = 4; 109 bytes Payload = 5; 110 } 111 112 service Logtail { 113 rpc Logtail(stream LogtailRequest) returns (stream LogtailResponse) {} 114 }