~bigbes/tarantool

tarantool-protobuf

ref: 5fa0fd00c4e2919fc979a18f16de259444445c07 tarantool-protobuf/test/proto/proto2_basic.proto -rw-r--r-- 1.1 KiB
5fa0fd00 — Eugene Blikh codec: proto2 groups (SGROUP/EGROUP wire format) 3 months ago
                                                                                
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
syntax = "proto2";

package proto2_basic;

message Defaults {
  optional int32 i = 1 [default = 17];
  optional string s = 2 [default = "hello"];
  optional bool b = 3 [default = true];
  optional float f = 4 [default = 3.5];
  optional double d = 5 [default = 1.5];
  optional int64 i64 = 6 [default = 1234567890123];
  optional uint64 u64 = 7 [default = 17];
  optional bytes by = 8 [default = "\x00\xff"];
  optional Color color = 9 [default = GREEN];

  enum Color {
    RED = 0;
    GREEN = 1;
    BLUE = 2;
  }
}

message Cardinality {
  required int32 r = 1;
  optional int32 o = 2;
  repeated int32 packed_default = 3;
  repeated int32 explicitly_packed = 4 [packed = true];
  repeated int32 explicitly_unpacked = 5 [packed = false];
}

message Nested {
  required Inner inner = 1;
  optional Inner inner_opt = 2;

  message Inner {
    required int32 x = 1;
  }
}

// Proto2 legacy groups. Wire format uses SGROUP (3) / EGROUP (4) tag
// pairs instead of a length-prefixed message body.
message WithGroup {
  optional group SingleGroup = 1 {
    optional int32 a = 2;
    optional string s = 3;
  }
  repeated group RepGroup = 4 {
    optional int32 n = 5;
  }
}