Skip to content

Commit 2ebaaa5

Browse files
committed
Bump up API to support bulk write
1 parent 4cac592 commit 2ebaaa5

3 files changed

Lines changed: 46 additions & 6 deletions

File tree

src/main/proto/banyandb/v1/banyandb-measure.proto

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,31 @@ message TopNRequest {
156156
repeated string stages = 9;
157157
}
158158

159+
// TagFamilySpec defines the specification of a tag family.
160+
message TagFamilySpec {
161+
// name of the tag family
162+
string name = 1;
163+
// names of tags in the tag family
164+
repeated string tag_names = 2;
165+
}
166+
167+
// DataPointSpec defines the specification of a data point.
168+
message DataPointSpec {
169+
// the tag family specification
170+
repeated TagFamilySpec tag_family_spec = 1;
171+
// the field names
172+
repeated string field_names = 2;
173+
}
174+
159175
// DataPointValue is the data point for writing. It only contains values.
160176
message DataPointValue {
161177
// timestamp is in the timeunit of milliseconds.
162178
google.protobuf.Timestamp timestamp = 1 [(validate.rules).timestamp.required = true];
163179
// the order of tag_families' items match the measure schema
180+
// the order of tag_families' items match DataPointSpec
164181
repeated model.v1.TagFamilyForWrite tag_families = 2 [(validate.rules).repeated.min_items = 1];
165182
// the order of fields match the measure schema
183+
// the order of fields match DataPointSpec
166184
repeated model.v1.FieldValue fields = 3;
167185
// the version of the data point
168186
int64 version = 4;
@@ -172,10 +190,16 @@ message DataPointValue {
172190
message WriteRequest {
173191
// the metadata is required.
174192
common.v1.Metadata metadata = 1 [(validate.rules).message.required = true];
193+
// the metadata is required only for the first request of gRPC stream.
194+
common.v1.Metadata metadata = 1;
175195
// the data_point is required.
176196
DataPointValue data_point = 2 [(validate.rules).message.required = true];
177197
// the message_id is required.
178198
uint64 message_id = 3 [(validate.rules).uint64.gt = 0];
199+
// the data point specification.
200+
// If this is not set with the indicated metadata, use the schema definition.
201+
// If this is not set, use the existing spec declaration from previous requests in the current gRPC stream.
202+
DataPointSpec data_point_spec = 4;
179203
}
180204

181205
// WriteResponse is the response contract for write

src/main/proto/banyandb/v1/banyandb-stream.proto

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,24 +80,36 @@ message QueryRequest {
8080
repeated string stages = 10;
8181
}
8282

83+
// TagFamilySpec defines the specification of a tag family.
84+
message TagFamilySpec {
85+
// name of the tag family
86+
string name = 1;
87+
// names of tags in the tag family
88+
repeated string tag_names = 2;
89+
}
90+
8391
message ElementValue {
8492
// element_id could be span_id of a Span or segment_id of a Segment in the context of stream
8593
string element_id = 1;
8694
// timestamp is in the timeunit of milliseconds. It represents
8795
// 1) either the start time of a Span/Segment,
8896
// 2) or the timestamp of a log
8997
google.protobuf.Timestamp timestamp = 2;
90-
// the order of tag_families' items match the stream schema
98+
// the order of tag_families' items match TagFamilySpec
9199
repeated model.v1.TagFamilyForWrite tag_families = 3;
92100
}
93101

94102
message WriteRequest {
95-
// the metadata is required.
96-
common.v1.Metadata metadata = 1 [(validate.rules).message.required = true];
103+
// the metadata is required only for the first request of gRPC stream.
104+
common.v1.Metadata metadata = 1;
97105
// the element is required.
98106
ElementValue element = 2 [(validate.rules).message.required = true];
99107
// the message_id is required.
100108
uint64 message_id = 3 [(validate.rules).uint64.gt = 0];
109+
// the tag family specification.
110+
// If this is not set with the indicated metadata, use the schema definition.
111+
// If this is not set, use the existing spec declaration from previous requests in the current gRPC stream.
112+
repeated TagFamilySpec tag_family_spec = 4;
101113
}
102114

103115
message WriteResponse {

src/main/proto/banyandb/v1/banyandb-trace.proto

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,16 @@ import "banyandb/v1/banyandb-model.proto";
2525
option go_package = "github.com/apache/skywalking-banyandb/api/proto/banyandb/trace/v1";
2626
option java_package = "org.apache.skywalking.banyandb.trace.v1";
2727

28-
// Write messages
28+
message TagSpec {
29+
repeated string tag_names = 1;
30+
}
31+
2932
message WriteRequest {
3033
common.v1.Metadata metadata = 1;
31-
repeated model.v1.TagValue tags = 2;
34+
repeated model.v1.TagValue tags = 2 [(validate.rules).repeated.min_items = 1];
3235
bytes span = 3;
33-
uint64 version = 4;
36+
uint64 version = 4 [(validate.rules).uint64.gt = 0];
37+
TagSpec tag_spec = 5;
3438
}
3539

3640
message WriteResponse {

0 commit comments

Comments
 (0)