-
Notifications
You must be signed in to change notification settings - Fork 2
/
bristle.proto
124 lines (99 loc) · 2.97 KB
/
bristle.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
syntax = "proto3";
package bristle;
option go_package = "proto/v1";
import "google/protobuf/descriptor.proto";
extend google.protobuf.MessageOptions { string bristle_table = 50001; }
extend google.protobuf.FieldOptions {
string bristle_column = 50001;
string bristle_clickhouse_type = 50002;
}
// A payload containing multiple proto bodies for the given descriptor type
message Payload {
string type = 1;
repeated bytes body = 2;
}
message Empty {}
message WriteBatchRequest {
string key = 1;
repeated Payload payloads = 2;
}
message WriteBatchResponse {
// The number of payloads that where acknowledged
uint64 acknowledged = 1;
// The number of payloads that where dropped
uint64 dropped = 2;
}
message StreamingClientMessageWriteBatch {
// Unique ID per-client that identifies this batch
uint32 id = 1;
// Either the full message type name or a per-session/per-client cached ID
oneof message_type {
string type_name = 2;
uint32 type_id = 3;
}
// The number of messages in this batc$i.
uint32 length = 4;
// The underlying varint-length-prefixed messages
bytes data = 5;
}
enum BatchResult {
OK = 0;
TOO_BIG = 1;
FULL = 2;
UNK_MESSAGE = 3;
DECODE_ERR = 4;
TRANSCODE_ERR = 5;
TOO_MANY_IN_FLIGHT_BATCHES = 6;
}
message StreamingClientMessageTypeInfo { string type = 1; }
message StreamingServerMessageTypeInfo {
string type = 1;
bytes descriptor = 2;
uint32 max_batch_size = 3;
}
message StreamingServerMessageWriteBatchResult {
uint32 id = 1;
BatchResult result = 2;
}
message StreamingClientMessageUpdateDefault {
string type = 1;
bytes default = 2;
}
// Registers a message type so that it can be sent using just a short uint32 id.
// This message also allows you to dynamically register types at runtime if the
// descriptor is provided.
message StreamingClientMessageRegisterMessageType {
string type = 1;
// Optional descriptor data, if none is provided this request will only
// produce a IdentifyMessageType if the message type is already registered.
bytes descriptor = 2;
}
message StreamingServerMessageIdentifyMessageType {
string type = 1;
uint32 id = 2;
}
message StreamingServerMessageBackoff {
uint64 until = 1;
repeated string types = 2;
}
message StreamingClientMessage {
oneof inner {
StreamingClientMessageWriteBatch write_batch = 1;
StreamingClientMessageUpdateDefault update_default = 2;
StreamingClientMessageRegisterMessageType register_message_type = 3;
}
}
message StreamingServerMessage {
oneof inner {
StreamingServerMessageWriteBatchResult write_batch_result = 1;
StreamingServerMessageBackoff backoff = 2;
StreamingServerMessageIdentifyMessageType identify_message_type = 3;
}
}
service BristleIngestService {
// Writes a single batch containing multiple payloads
rpc WriteBatch(WriteBatchRequest) returns (WriteBatchResponse);
// Bi-directional streaming API
rpc Streaming(stream StreamingClientMessage)
returns (stream StreamingServerMessage);
}