diff options
author | Jon Skeet <skeet@pobox.com> | 2009-02-18 16:06:22 +0000 |
---|---|---|
committer | Jon Skeet <skeet@pobox.com> | 2009-02-18 16:06:22 +0000 |
commit | 25a28580a6f307cb8eb040367f5671e678e9896b (patch) | |
tree | 6ce918e09f644733ad514eac706208be2d5f7883 /protos | |
parent | 0ca3fecfafe6b2f7b6de4a5e1b978353fcaae83b (diff) | |
download | protobuf-25a28580a6f307cb8eb040367f5671e678e9896b.tar.gz protobuf-25a28580a6f307cb8eb040367f5671e678e9896b.tar.bz2 protobuf-25a28580a6f307cb8eb040367f5671e678e9896b.zip |
Support packed primitive types
Diffstat (limited to 'protos')
-rw-r--r-- | protos/google/protobuf/descriptor.proto | 7 | ||||
-rw-r--r-- | protos/google/protobuf/unittest.proto | 38 |
2 files changed, 45 insertions, 0 deletions
diff --git a/protos/google/protobuf/descriptor.proto b/protos/google/protobuf/descriptor.proto index 3f91c187..e0e6f7f2 100644 --- a/protos/google/protobuf/descriptor.proto +++ b/protos/google/protobuf/descriptor.proto @@ -252,6 +252,8 @@ message FileOptions { } optional OptimizeMode optimize_for = 9 [default=CODE_SIZE]; + + // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -298,6 +300,11 @@ message FieldOptions { STRING_PIECE = 2; } + // The packed option can be enabled for repeated primitive fields to enable + // a more efficient representation on the wire. Rather than repeatedly + // writing the tag and type for each element, the entire array is encoded as + // a single length-delimited blob. + optional bool packed = 2; // EXPERIMENTAL. DO NOT USE. // For "map" fields, the name of the field in the enclosed type that diff --git a/protos/google/protobuf/unittest.proto b/protos/google/protobuf/unittest.proto index 313a514d..dd583709 100644 --- a/protos/google/protobuf/unittest.proto +++ b/protos/google/protobuf/unittest.proto @@ -458,6 +458,44 @@ message TestExtremeDefaultValues { optional string utf8_string = 6 [default = "\341\210\264"]; } +message TestPackedTypes { + repeated int32 packed_int32 = 90 [packed = true]; + repeated int64 packed_int64 = 91 [packed = true]; + repeated uint32 packed_uint32 = 92 [packed = true]; + repeated uint64 packed_uint64 = 93 [packed = true]; + repeated sint32 packed_sint32 = 94 [packed = true]; + repeated sint64 packed_sint64 = 95 [packed = true]; + repeated fixed32 packed_fixed32 = 96 [packed = true]; + repeated fixed64 packed_fixed64 = 97 [packed = true]; + repeated sfixed32 packed_sfixed32 = 98 [packed = true]; + repeated sfixed64 packed_sfixed64 = 99 [packed = true]; + repeated float packed_float = 100 [packed = true]; + repeated double packed_double = 101 [packed = true]; + repeated bool packed_bool = 102 [packed = true]; + repeated ForeignEnum packed_enum = 103 [packed = true]; +} + +message TestPackedExtensions { + extensions 1 to max; +} + +extend TestPackedExtensions { + repeated int32 packed_int32_extension = 90 [packed = true]; + repeated int64 packed_int64_extension = 91 [packed = true]; + repeated uint32 packed_uint32_extension = 92 [packed = true]; + repeated uint64 packed_uint64_extension = 93 [packed = true]; + repeated sint32 packed_sint32_extension = 94 [packed = true]; + repeated sint64 packed_sint64_extension = 95 [packed = true]; + repeated fixed32 packed_fixed32_extension = 96 [packed = true]; + repeated fixed64 packed_fixed64_extension = 97 [packed = true]; + repeated sfixed32 packed_sfixed32_extension = 98 [packed = true]; + repeated sfixed64 packed_sfixed64_extension = 99 [packed = true]; + repeated float packed_float_extension = 100 [packed = true]; + repeated double packed_double_extension = 101 [packed = true]; + repeated bool packed_bool_extension = 102 [packed = true]; + repeated ForeignEnum packed_enum_extension = 103 [packed = true]; +} + // Test that RPC services work. message FooRequest {} message FooResponse {} |