prepor-protobuf 3.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +21 -0
- data/.rubocop.yml +51 -0
- data/.rubocop_todo.yml +89 -0
- data/.travis.yml +25 -0
- data/.yardopts +5 -0
- data/CHANGES.md +256 -0
- data/CONTRIBUTING.md +16 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +22 -0
- data/README.md +33 -0
- data/Rakefile +64 -0
- data/bin/protoc-gen-ruby +16 -0
- data/bin/rpc_server +5 -0
- data/install-protobuf.sh +28 -0
- data/lib/protobuf.rb +100 -0
- data/lib/protobuf/cli.rb +242 -0
- data/lib/protobuf/code_generator.rb +44 -0
- data/lib/protobuf/decoder.rb +73 -0
- data/lib/protobuf/deprecation.rb +112 -0
- data/lib/protobuf/descriptors.rb +3 -0
- data/lib/protobuf/descriptors/google/protobuf/compiler/plugin.pb.rb +48 -0
- data/lib/protobuf/descriptors/google/protobuf/descriptor.pb.rb +251 -0
- data/lib/protobuf/encoder.rb +67 -0
- data/lib/protobuf/enum.rb +303 -0
- data/lib/protobuf/exceptions.rb +9 -0
- data/lib/protobuf/field.rb +74 -0
- data/lib/protobuf/field/base_field.rb +267 -0
- data/lib/protobuf/field/bool_field.rb +59 -0
- data/lib/protobuf/field/bytes_field.rb +82 -0
- data/lib/protobuf/field/double_field.rb +25 -0
- data/lib/protobuf/field/enum_field.rb +68 -0
- data/lib/protobuf/field/field_array.rb +87 -0
- data/lib/protobuf/field/fixed32_field.rb +25 -0
- data/lib/protobuf/field/fixed64_field.rb +28 -0
- data/lib/protobuf/field/float_field.rb +41 -0
- data/lib/protobuf/field/int32_field.rb +21 -0
- data/lib/protobuf/field/int64_field.rb +21 -0
- data/lib/protobuf/field/integer_field.rb +23 -0
- data/lib/protobuf/field/message_field.rb +65 -0
- data/lib/protobuf/field/sfixed32_field.rb +27 -0
- data/lib/protobuf/field/sfixed64_field.rb +28 -0
- data/lib/protobuf/field/signed_integer_field.rb +29 -0
- data/lib/protobuf/field/sint32_field.rb +21 -0
- data/lib/protobuf/field/sint64_field.rb +21 -0
- data/lib/protobuf/field/string_field.rb +34 -0
- data/lib/protobuf/field/uint32_field.rb +21 -0
- data/lib/protobuf/field/uint64_field.rb +21 -0
- data/lib/protobuf/field/varint_field.rb +73 -0
- data/lib/protobuf/generators/base.rb +70 -0
- data/lib/protobuf/generators/enum_generator.rb +41 -0
- data/lib/protobuf/generators/extension_generator.rb +27 -0
- data/lib/protobuf/generators/field_generator.rb +131 -0
- data/lib/protobuf/generators/file_generator.rb +135 -0
- data/lib/protobuf/generators/group_generator.rb +112 -0
- data/lib/protobuf/generators/message_generator.rb +98 -0
- data/lib/protobuf/generators/printable.rb +160 -0
- data/lib/protobuf/generators/service_generator.rb +26 -0
- data/lib/protobuf/lifecycle.rb +33 -0
- data/lib/protobuf/logging.rb +39 -0
- data/lib/protobuf/message.rb +193 -0
- data/lib/protobuf/message/fields.rb +133 -0
- data/lib/protobuf/message/serialization.rb +89 -0
- data/lib/protobuf/optionable.rb +23 -0
- data/lib/protobuf/rpc/buffer.rb +77 -0
- data/lib/protobuf/rpc/client.rb +168 -0
- data/lib/protobuf/rpc/connector.rb +19 -0
- data/lib/protobuf/rpc/connectors/base.rb +55 -0
- data/lib/protobuf/rpc/connectors/common.rb +176 -0
- data/lib/protobuf/rpc/connectors/socket.rb +73 -0
- data/lib/protobuf/rpc/connectors/zmq.rb +322 -0
- data/lib/protobuf/rpc/dynamic_discovery.pb.rb +49 -0
- data/lib/protobuf/rpc/env.rb +58 -0
- data/lib/protobuf/rpc/error.rb +28 -0
- data/lib/protobuf/rpc/error/client_error.rb +31 -0
- data/lib/protobuf/rpc/error/server_error.rb +43 -0
- data/lib/protobuf/rpc/middleware.rb +25 -0
- data/lib/protobuf/rpc/middleware/exception_handler.rb +36 -0
- data/lib/protobuf/rpc/middleware/logger.rb +91 -0
- data/lib/protobuf/rpc/middleware/request_decoder.rb +83 -0
- data/lib/protobuf/rpc/middleware/response_encoder.rb +88 -0
- data/lib/protobuf/rpc/middleware/runner.rb +18 -0
- data/lib/protobuf/rpc/rpc.pb.rb +55 -0
- data/lib/protobuf/rpc/server.rb +39 -0
- data/lib/protobuf/rpc/servers/socket/server.rb +123 -0
- data/lib/protobuf/rpc/servers/socket/worker.rb +56 -0
- data/lib/protobuf/rpc/servers/socket_runner.rb +40 -0
- data/lib/protobuf/rpc/servers/zmq/broker.rb +193 -0
- data/lib/protobuf/rpc/servers/zmq/server.rb +320 -0
- data/lib/protobuf/rpc/servers/zmq/util.rb +48 -0
- data/lib/protobuf/rpc/servers/zmq/worker.rb +104 -0
- data/lib/protobuf/rpc/servers/zmq_runner.rb +62 -0
- data/lib/protobuf/rpc/service.rb +179 -0
- data/lib/protobuf/rpc/service_directory.rb +253 -0
- data/lib/protobuf/rpc/service_dispatcher.rb +46 -0
- data/lib/protobuf/rpc/service_filters.rb +272 -0
- data/lib/protobuf/rpc/stat.rb +97 -0
- data/lib/protobuf/socket.rb +21 -0
- data/lib/protobuf/tasks.rb +1 -0
- data/lib/protobuf/tasks/compile.rake +61 -0
- data/lib/protobuf/version.rb +3 -0
- data/lib/protobuf/wire_type.rb +10 -0
- data/lib/protobuf/zmq.rb +21 -0
- data/proto/dynamic_discovery.proto +44 -0
- data/proto/google/protobuf/compiler/plugin.proto +147 -0
- data/proto/google/protobuf/descriptor.proto +620 -0
- data/proto/rpc.proto +62 -0
- data/protobuf.gemspec +51 -0
- data/spec/benchmark/tasks.rb +139 -0
- data/spec/bin/protoc-gen-ruby_spec.rb +23 -0
- data/spec/data/data.bin +3 -0
- data/spec/data/types.bin +0 -0
- data/spec/encoding/all_types_spec.rb +105 -0
- data/spec/encoding/extreme_values_spec.rb +0 -0
- data/spec/functional/class_inheritance_spec.rb +52 -0
- data/spec/functional/socket_server_spec.rb +59 -0
- data/spec/functional/zmq_server_spec.rb +105 -0
- data/spec/lib/protobuf/cli_spec.rb +273 -0
- data/spec/lib/protobuf/code_generator_spec.rb +60 -0
- data/spec/lib/protobuf/enum_spec.rb +265 -0
- data/spec/lib/protobuf/field/bool_field_spec.rb +51 -0
- data/spec/lib/protobuf/field/field_array_spec.rb +69 -0
- data/spec/lib/protobuf/field/float_field_spec.rb +55 -0
- data/spec/lib/protobuf/field/int32_field_spec.rb +89 -0
- data/spec/lib/protobuf/field/string_field_spec.rb +45 -0
- data/spec/lib/protobuf/field_spec.rb +191 -0
- data/spec/lib/protobuf/generators/base_spec.rb +84 -0
- data/spec/lib/protobuf/generators/enum_generator_spec.rb +73 -0
- data/spec/lib/protobuf/generators/extension_generator_spec.rb +42 -0
- data/spec/lib/protobuf/generators/field_generator_spec.rb +102 -0
- data/spec/lib/protobuf/generators/file_generator_spec.rb +32 -0
- data/spec/lib/protobuf/generators/message_generator_spec.rb +0 -0
- data/spec/lib/protobuf/generators/service_generator_spec.rb +46 -0
- data/spec/lib/protobuf/lifecycle_spec.rb +94 -0
- data/spec/lib/protobuf/message_spec.rb +526 -0
- data/spec/lib/protobuf/optionable_spec.rb +46 -0
- data/spec/lib/protobuf/rpc/client_spec.rb +66 -0
- data/spec/lib/protobuf/rpc/connector_spec.rb +26 -0
- data/spec/lib/protobuf/rpc/connectors/base_spec.rb +50 -0
- data/spec/lib/protobuf/rpc/connectors/common_spec.rb +170 -0
- data/spec/lib/protobuf/rpc/connectors/socket_spec.rb +36 -0
- data/spec/lib/protobuf/rpc/connectors/zmq_spec.rb +117 -0
- data/spec/lib/protobuf/rpc/middleware/exception_handler_spec.rb +62 -0
- data/spec/lib/protobuf/rpc/middleware/logger_spec.rb +49 -0
- data/spec/lib/protobuf/rpc/middleware/request_decoder_spec.rb +115 -0
- data/spec/lib/protobuf/rpc/middleware/response_encoder_spec.rb +75 -0
- data/spec/lib/protobuf/rpc/servers/socket_server_spec.rb +38 -0
- data/spec/lib/protobuf/rpc/servers/zmq/server_spec.rb +43 -0
- data/spec/lib/protobuf/rpc/servers/zmq/util_spec.rb +55 -0
- data/spec/lib/protobuf/rpc/servers/zmq/worker_spec.rb +35 -0
- data/spec/lib/protobuf/rpc/service_directory_spec.rb +293 -0
- data/spec/lib/protobuf/rpc/service_dispatcher_spec.rb +52 -0
- data/spec/lib/protobuf/rpc/service_filters_spec.rb +517 -0
- data/spec/lib/protobuf/rpc/service_spec.rb +162 -0
- data/spec/lib/protobuf/rpc/stat_spec.rb +68 -0
- data/spec/lib/protobuf_spec.rb +98 -0
- data/spec/spec_helper.rb +44 -0
- data/spec/support/all.rb +6 -0
- data/spec/support/packed_field.rb +22 -0
- data/spec/support/server.rb +64 -0
- data/spec/support/test/all_types.data.bin +0 -0
- data/spec/support/test/all_types.data.txt +119 -0
- data/spec/support/test/defaults.pb.rb +27 -0
- data/spec/support/test/defaults.proto +9 -0
- data/spec/support/test/enum.pb.rb +55 -0
- data/spec/support/test/enum.proto +34 -0
- data/spec/support/test/extended.pb.rb +18 -0
- data/spec/support/test/extended.proto +10 -0
- data/spec/support/test/extreme_values.data.bin +0 -0
- data/spec/support/test/google_unittest.pb.rb +537 -0
- data/spec/support/test/google_unittest.proto +713 -0
- data/spec/support/test/google_unittest_import.pb.rb +39 -0
- data/spec/support/test/google_unittest_import.proto +64 -0
- data/spec/support/test/google_unittest_import_public.pb.rb +10 -0
- data/spec/support/test/google_unittest_import_public.proto +38 -0
- data/spec/support/test/multi_field_extensions.pb.rb +58 -0
- data/spec/support/test/multi_field_extensions.proto +33 -0
- data/spec/support/test/resource.pb.rb +119 -0
- data/spec/support/test/resource.proto +94 -0
- data/spec/support/test/resource_service.rb +23 -0
- data/spec/support/test_app_file.rb +2 -0
- metadata +502 -0
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'protobuf/generators/file_generator'
|
2
|
+
|
3
|
+
module Protobuf
|
4
|
+
class CodeGenerator
|
5
|
+
|
6
|
+
CodeGeneratorFatalError = Class.new(RuntimeError)
|
7
|
+
|
8
|
+
def self.fatal(message)
|
9
|
+
fail CodeGeneratorFatalError, message
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.print_tag_warning_suppress
|
13
|
+
STDERR.puts "Suppress tag warning output with PB_NO_TAG_WARNINGS=1."
|
14
|
+
def self.print_tag_warning_suppress; end
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.warn(message)
|
18
|
+
STDERR.puts("[WARN] #{message}")
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
attr_accessor :request
|
24
|
+
|
25
|
+
public
|
26
|
+
|
27
|
+
def initialize(request_bytes)
|
28
|
+
self.request = ::Google::Protobuf::Compiler::CodeGeneratorRequest.decode(request_bytes)
|
29
|
+
end
|
30
|
+
|
31
|
+
def generate_file(file_descriptor)
|
32
|
+
::Protobuf::Generators::FileGenerator.new(file_descriptor).generate_output_file
|
33
|
+
end
|
34
|
+
|
35
|
+
def response_bytes
|
36
|
+
generated_files = request.proto_file.map do |file_descriptor|
|
37
|
+
generate_file(file_descriptor)
|
38
|
+
end
|
39
|
+
|
40
|
+
::Google::Protobuf::Compiler::CodeGeneratorResponse.encode(:file => generated_files)
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'protobuf/wire_type'
|
2
|
+
require 'protobuf/exceptions'
|
3
|
+
|
4
|
+
module Protobuf
|
5
|
+
class Decoder
|
6
|
+
|
7
|
+
# Read bytes from +stream+ and pass to +message+ object.
|
8
|
+
def self.decode_each_field(stream, &block)
|
9
|
+
until stream.eof?
|
10
|
+
tag, bytes = read_field(stream)
|
11
|
+
block.call(tag, bytes)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.read_field(stream)
|
16
|
+
tag, wire_type = read_key(stream)
|
17
|
+
bytes = case wire_type
|
18
|
+
when ::Protobuf::WireType::VARINT then
|
19
|
+
read_varint(stream)
|
20
|
+
when ::Protobuf::WireType::FIXED64 then
|
21
|
+
read_fixed64(stream)
|
22
|
+
when ::Protobuf::WireType::LENGTH_DELIMITED then
|
23
|
+
read_length_delimited(stream)
|
24
|
+
when ::Protobuf::WireType::FIXED32 then
|
25
|
+
read_fixed32(stream)
|
26
|
+
when ::Protobuf::WireType::START_GROUP then
|
27
|
+
fail NotImplementedError, 'Group is deprecated.'
|
28
|
+
when ::Protobuf::WireType::END_GROUP then
|
29
|
+
fail NotImplementedError, 'Group is deprecated.'
|
30
|
+
else
|
31
|
+
fail InvalidWireType, wire_type
|
32
|
+
end
|
33
|
+
|
34
|
+
[tag, bytes]
|
35
|
+
end
|
36
|
+
|
37
|
+
# Read 32-bit string value from +stream+.
|
38
|
+
def self.read_fixed32(stream)
|
39
|
+
stream.read(4)
|
40
|
+
end
|
41
|
+
|
42
|
+
# Read 64-bit string value from +stream+.
|
43
|
+
def self.read_fixed64(stream)
|
44
|
+
stream.read(8)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Read key pair (tag and wire-type) from +stream+.
|
48
|
+
def self.read_key(stream)
|
49
|
+
bits = read_varint(stream)
|
50
|
+
wire_type = bits & 0x07
|
51
|
+
tag = bits >> 3
|
52
|
+
[tag, wire_type]
|
53
|
+
end
|
54
|
+
|
55
|
+
# Read length-delimited string value from +stream+.
|
56
|
+
def self.read_length_delimited(stream)
|
57
|
+
value_length = read_varint(stream)
|
58
|
+
stream.read(value_length)
|
59
|
+
end
|
60
|
+
|
61
|
+
# Read varint integer value from +stream+.
|
62
|
+
def self.read_varint(stream)
|
63
|
+
value = index = 0
|
64
|
+
begin
|
65
|
+
byte = stream.readbyte
|
66
|
+
value |= (byte & 0x7f) << (7 * index)
|
67
|
+
index += 1
|
68
|
+
end while (byte & 0x80).nonzero?
|
69
|
+
value
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
require 'active_support/deprecation'
|
2
|
+
|
3
|
+
module Protobuf
|
4
|
+
if ::ActiveSupport::Deprecation.is_a?(Class)
|
5
|
+
class DeprecationBase < ::ActiveSupport::Deprecation
|
6
|
+
def deprecate_methods(*args)
|
7
|
+
deprecation_options = { :deprecator => self }
|
8
|
+
|
9
|
+
if args.last.is_a?(Hash)
|
10
|
+
args.last.merge!(deprecation_options)
|
11
|
+
else
|
12
|
+
args.push(deprecation_options)
|
13
|
+
end
|
14
|
+
|
15
|
+
super
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class Deprecation < DeprecationBase
|
20
|
+
def define_deprecated_methods(target_module, method_hash)
|
21
|
+
target_module.module_eval do
|
22
|
+
method_hash.each do |old_method, new_method|
|
23
|
+
alias_method old_method, new_method
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
deprecate_methods(target_module, method_hash)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
class FieldDeprecation < DeprecationBase
|
32
|
+
# this is a convenience deprecator for deprecated proto fields
|
33
|
+
|
34
|
+
def deprecate_method(target_module, method_name)
|
35
|
+
deprecate_methods(target_module, method_name => target_module)
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def deprecated_method_warning(method_name, target_module)
|
41
|
+
"#{target_module.name}##{method_name} field usage is deprecated"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
else
|
45
|
+
# TODO: remove this clause when Rails < 4 support is no longer needed
|
46
|
+
deprecator = ::ActiveSupport::Deprecation.clone
|
47
|
+
deprecator.instance_eval do
|
48
|
+
def new(deprecation_horizon = nil, *)
|
49
|
+
self.deprecation_horizon = deprecation_horizon if deprecation_horizon
|
50
|
+
self
|
51
|
+
end
|
52
|
+
end
|
53
|
+
Deprecation = deprecator.clone
|
54
|
+
FieldDeprecation = deprecator.clone
|
55
|
+
|
56
|
+
Deprecation.instance_eval do
|
57
|
+
def define_deprecated_methods(target_module, method_hash)
|
58
|
+
target_module.module_eval do
|
59
|
+
method_hash.each do |old_method, new_method|
|
60
|
+
alias_method old_method, new_method
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
deprecate_methods(target_module, method_hash)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
FieldDeprecation.instance_eval do
|
69
|
+
def deprecate_method(target_module, method_name)
|
70
|
+
deprecate_methods(target_module, method_name => target_module)
|
71
|
+
end
|
72
|
+
|
73
|
+
private
|
74
|
+
|
75
|
+
def deprecated_method_warning(method_name, target_module)
|
76
|
+
"#{target_module.name}##{method_name} field usage is deprecated"
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def self.deprecator
|
82
|
+
@deprecator ||= Deprecation.new('4.0', to_s).tap do |deprecation|
|
83
|
+
deprecation.silenced = ENV.key?('PB_IGNORE_DEPRECATIONS')
|
84
|
+
deprecation.behavior = :stderr
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def self.field_deprecator
|
89
|
+
@field_deprecator ||= FieldDeprecation.new.tap do |deprecation|
|
90
|
+
deprecation.silenced = ENV.key?('PB_IGNORE_DEPRECATIONS')
|
91
|
+
deprecation.behavior = :stderr
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
# Print Deprecation Warnings
|
96
|
+
#
|
97
|
+
# Default: true
|
98
|
+
#
|
99
|
+
# Simple boolean to define whether we want field deprecation warnings to
|
100
|
+
# be printed to stderr or not. The rpc_server has an option to set this value
|
101
|
+
# explicitly, or you can turn this option off by setting
|
102
|
+
# ENV['PB_IGNORE_DEPRECATIONS'] to a non-empty value.
|
103
|
+
#
|
104
|
+
# The rpc_server option will override the ENV setting.
|
105
|
+
def self.print_deprecation_warnings?
|
106
|
+
!field_deprecator.silenced
|
107
|
+
end
|
108
|
+
|
109
|
+
def self.print_deprecation_warnings=(value)
|
110
|
+
field_deprecator.silenced = !value
|
111
|
+
end
|
112
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
##
|
4
|
+
# This file is auto-generated. DO NOT EDIT!
|
5
|
+
#
|
6
|
+
require 'protobuf/message'
|
7
|
+
|
8
|
+
module Google
|
9
|
+
module Protobuf
|
10
|
+
module Compiler
|
11
|
+
|
12
|
+
##
|
13
|
+
# Message Classes
|
14
|
+
#
|
15
|
+
class CodeGeneratorRequest < ::Protobuf::Message; end
|
16
|
+
class CodeGeneratorResponse < ::Protobuf::Message
|
17
|
+
class File < ::Protobuf::Message; end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
##
|
24
|
+
# Message Fields
|
25
|
+
#
|
26
|
+
class CodeGeneratorRequest
|
27
|
+
repeated :string, :file_to_generate, 1
|
28
|
+
optional :string, :parameter, 2
|
29
|
+
repeated ::Google::Protobuf::FileDescriptorProto, :proto_file, 15
|
30
|
+
end
|
31
|
+
|
32
|
+
class CodeGeneratorResponse
|
33
|
+
class File
|
34
|
+
optional :string, :name, 1
|
35
|
+
optional :string, :insertion_point, 2
|
36
|
+
optional :string, :content, 15
|
37
|
+
end
|
38
|
+
|
39
|
+
optional :string, :error, 1
|
40
|
+
repeated ::Google::Protobuf::Compiler::CodeGeneratorResponse::File, :file, 15
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
@@ -0,0 +1,251 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
##
|
4
|
+
# This file is auto-generated. DO NOT EDIT!
|
5
|
+
#
|
6
|
+
require 'protobuf/message'
|
7
|
+
|
8
|
+
module Google
|
9
|
+
module Protobuf
|
10
|
+
|
11
|
+
##
|
12
|
+
# Message Classes
|
13
|
+
#
|
14
|
+
class FileDescriptorSet < ::Protobuf::Message; end
|
15
|
+
class FileDescriptorProto < ::Protobuf::Message; end
|
16
|
+
class DescriptorProto < ::Protobuf::Message
|
17
|
+
class ExtensionRange < ::Protobuf::Message; end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
class FieldDescriptorProto < ::Protobuf::Message
|
22
|
+
class Type < ::Protobuf::Enum
|
23
|
+
define :TYPE_DOUBLE, 1
|
24
|
+
define :TYPE_FLOAT, 2
|
25
|
+
define :TYPE_INT64, 3
|
26
|
+
define :TYPE_UINT64, 4
|
27
|
+
define :TYPE_INT32, 5
|
28
|
+
define :TYPE_FIXED64, 6
|
29
|
+
define :TYPE_FIXED32, 7
|
30
|
+
define :TYPE_BOOL, 8
|
31
|
+
define :TYPE_STRING, 9
|
32
|
+
define :TYPE_GROUP, 10
|
33
|
+
define :TYPE_MESSAGE, 11
|
34
|
+
define :TYPE_BYTES, 12
|
35
|
+
define :TYPE_UINT32, 13
|
36
|
+
define :TYPE_ENUM, 14
|
37
|
+
define :TYPE_SFIXED32, 15
|
38
|
+
define :TYPE_SFIXED64, 16
|
39
|
+
define :TYPE_SINT32, 17
|
40
|
+
define :TYPE_SINT64, 18
|
41
|
+
end
|
42
|
+
|
43
|
+
class Label < ::Protobuf::Enum
|
44
|
+
define :LABEL_OPTIONAL, 1
|
45
|
+
define :LABEL_REQUIRED, 2
|
46
|
+
define :LABEL_REPEATED, 3
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
class EnumDescriptorProto < ::Protobuf::Message; end
|
52
|
+
class EnumValueDescriptorProto < ::Protobuf::Message; end
|
53
|
+
class ServiceDescriptorProto < ::Protobuf::Message; end
|
54
|
+
class MethodDescriptorProto < ::Protobuf::Message; end
|
55
|
+
class FileOptions < ::Protobuf::Message
|
56
|
+
class OptimizeMode < ::Protobuf::Enum
|
57
|
+
define :SPEED, 1
|
58
|
+
define :CODE_SIZE, 2
|
59
|
+
define :LITE_RUNTIME, 3
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
class MessageOptions < ::Protobuf::Message; end
|
65
|
+
class FieldOptions < ::Protobuf::Message
|
66
|
+
class CType < ::Protobuf::Enum
|
67
|
+
define :STRING, 0
|
68
|
+
define :CORD, 1
|
69
|
+
define :STRING_PIECE, 2
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
class EnumOptions < ::Protobuf::Message; end
|
75
|
+
class EnumValueOptions < ::Protobuf::Message; end
|
76
|
+
class ServiceOptions < ::Protobuf::Message; end
|
77
|
+
class MethodOptions < ::Protobuf::Message; end
|
78
|
+
class UninterpretedOption < ::Protobuf::Message
|
79
|
+
class NamePart < ::Protobuf::Message; end
|
80
|
+
|
81
|
+
end
|
82
|
+
|
83
|
+
class SourceCodeInfo < ::Protobuf::Message
|
84
|
+
class Location < ::Protobuf::Message; end
|
85
|
+
|
86
|
+
end
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
##
|
91
|
+
# Message Fields
|
92
|
+
#
|
93
|
+
class FileDescriptorSet
|
94
|
+
repeated ::Google::Protobuf::FileDescriptorProto, :file, 1
|
95
|
+
end
|
96
|
+
|
97
|
+
class FileDescriptorProto
|
98
|
+
optional :string, :name, 1
|
99
|
+
optional :string, :package, 2
|
100
|
+
repeated :string, :dependency, 3
|
101
|
+
repeated :int32, :public_dependency, 10
|
102
|
+
repeated :int32, :weak_dependency, 11
|
103
|
+
repeated ::Google::Protobuf::DescriptorProto, :message_type, 4
|
104
|
+
repeated ::Google::Protobuf::EnumDescriptorProto, :enum_type, 5
|
105
|
+
repeated ::Google::Protobuf::ServiceDescriptorProto, :service, 6
|
106
|
+
repeated ::Google::Protobuf::FieldDescriptorProto, :extension, 7
|
107
|
+
optional ::Google::Protobuf::FileOptions, :options, 8
|
108
|
+
optional ::Google::Protobuf::SourceCodeInfo, :source_code_info, 9
|
109
|
+
end
|
110
|
+
|
111
|
+
class DescriptorProto
|
112
|
+
class ExtensionRange
|
113
|
+
optional :int32, :start, 1
|
114
|
+
optional :int32, :end, 2
|
115
|
+
end
|
116
|
+
|
117
|
+
optional :string, :name, 1
|
118
|
+
repeated ::Google::Protobuf::FieldDescriptorProto, :field, 2
|
119
|
+
repeated ::Google::Protobuf::FieldDescriptorProto, :extension, 6
|
120
|
+
repeated ::Google::Protobuf::DescriptorProto, :nested_type, 3
|
121
|
+
repeated ::Google::Protobuf::EnumDescriptorProto, :enum_type, 4
|
122
|
+
repeated ::Google::Protobuf::DescriptorProto::ExtensionRange, :extension_range, 5
|
123
|
+
optional ::Google::Protobuf::MessageOptions, :options, 7
|
124
|
+
end
|
125
|
+
|
126
|
+
class FieldDescriptorProto
|
127
|
+
optional :string, :name, 1
|
128
|
+
optional :int32, :number, 3
|
129
|
+
optional ::Google::Protobuf::FieldDescriptorProto::Label, :label, 4
|
130
|
+
optional ::Google::Protobuf::FieldDescriptorProto::Type, :type, 5
|
131
|
+
optional :string, :type_name, 6
|
132
|
+
optional :string, :extendee, 2
|
133
|
+
optional :string, :default_value, 7
|
134
|
+
optional ::Google::Protobuf::FieldOptions, :options, 8
|
135
|
+
end
|
136
|
+
|
137
|
+
class EnumDescriptorProto
|
138
|
+
optional :string, :name, 1
|
139
|
+
repeated ::Google::Protobuf::EnumValueDescriptorProto, :value, 2
|
140
|
+
optional ::Google::Protobuf::EnumOptions, :options, 3
|
141
|
+
end
|
142
|
+
|
143
|
+
class EnumValueDescriptorProto
|
144
|
+
optional :string, :name, 1
|
145
|
+
optional :int32, :number, 2
|
146
|
+
optional ::Google::Protobuf::EnumValueOptions, :options, 3
|
147
|
+
end
|
148
|
+
|
149
|
+
class ServiceDescriptorProto
|
150
|
+
optional :string, :name, 1
|
151
|
+
repeated ::Google::Protobuf::MethodDescriptorProto, :method, 2
|
152
|
+
optional ::Google::Protobuf::ServiceOptions, :options, 3
|
153
|
+
end
|
154
|
+
|
155
|
+
class MethodDescriptorProto
|
156
|
+
optional :string, :name, 1
|
157
|
+
optional :string, :input_type, 2
|
158
|
+
optional :string, :output_type, 3
|
159
|
+
optional ::Google::Protobuf::MethodOptions, :options, 4
|
160
|
+
end
|
161
|
+
|
162
|
+
class FileOptions
|
163
|
+
optional :string, :java_package, 1
|
164
|
+
optional :string, :java_outer_classname, 8
|
165
|
+
optional :bool, :java_multiple_files, 10, :default => false
|
166
|
+
optional :bool, :java_generate_equals_and_hash, 20, :default => false
|
167
|
+
optional ::Google::Protobuf::FileOptions::OptimizeMode, :optimize_for, 9, :default => ::Google::Protobuf::FileOptions::OptimizeMode::SPEED
|
168
|
+
optional :string, :go_package, 11
|
169
|
+
optional :bool, :cc_generic_services, 16, :default => false
|
170
|
+
optional :bool, :java_generic_services, 17, :default => false
|
171
|
+
optional :bool, :py_generic_services, 18, :default => false
|
172
|
+
repeated ::Google::Protobuf::UninterpretedOption, :uninterpreted_option, 999
|
173
|
+
# Extension Fields
|
174
|
+
extensions 1000...536870912
|
175
|
+
end
|
176
|
+
|
177
|
+
class MessageOptions
|
178
|
+
optional :bool, :message_set_wire_format, 1, :default => false
|
179
|
+
optional :bool, :no_standard_descriptor_accessor, 2, :default => false
|
180
|
+
repeated ::Google::Protobuf::UninterpretedOption, :uninterpreted_option, 999
|
181
|
+
# Extension Fields
|
182
|
+
extensions 1000...536870912
|
183
|
+
end
|
184
|
+
|
185
|
+
class FieldOptions
|
186
|
+
optional ::Google::Protobuf::FieldOptions::CType, :ctype, 1, :default => ::Google::Protobuf::FieldOptions::CType::STRING
|
187
|
+
optional :bool, :packed, 2
|
188
|
+
optional :bool, :lazy, 5, :default => false
|
189
|
+
optional :bool, :deprecated, 3, :default => false
|
190
|
+
optional :string, :experimental_map_key, 9
|
191
|
+
optional :bool, :weak, 10, :default => false
|
192
|
+
repeated ::Google::Protobuf::UninterpretedOption, :uninterpreted_option, 999
|
193
|
+
# Extension Fields
|
194
|
+
extensions 1000...536870912
|
195
|
+
end
|
196
|
+
|
197
|
+
class EnumOptions
|
198
|
+
optional :bool, :allow_alias, 2, :default => true
|
199
|
+
repeated ::Google::Protobuf::UninterpretedOption, :uninterpreted_option, 999
|
200
|
+
# Extension Fields
|
201
|
+
extensions 1000...536870912
|
202
|
+
end
|
203
|
+
|
204
|
+
class EnumValueOptions
|
205
|
+
repeated ::Google::Protobuf::UninterpretedOption, :uninterpreted_option, 999
|
206
|
+
# Extension Fields
|
207
|
+
extensions 1000...536870912
|
208
|
+
end
|
209
|
+
|
210
|
+
class ServiceOptions
|
211
|
+
repeated ::Google::Protobuf::UninterpretedOption, :uninterpreted_option, 999
|
212
|
+
# Extension Fields
|
213
|
+
extensions 1000...536870912
|
214
|
+
end
|
215
|
+
|
216
|
+
class MethodOptions
|
217
|
+
repeated ::Google::Protobuf::UninterpretedOption, :uninterpreted_option, 999
|
218
|
+
# Extension Fields
|
219
|
+
extensions 1000...536870912
|
220
|
+
end
|
221
|
+
|
222
|
+
class UninterpretedOption
|
223
|
+
class NamePart
|
224
|
+
required :string, :name_part, 1
|
225
|
+
required :bool, :is_extension, 2
|
226
|
+
end
|
227
|
+
|
228
|
+
repeated ::Google::Protobuf::UninterpretedOption::NamePart, :name, 2
|
229
|
+
optional :string, :identifier_value, 3
|
230
|
+
optional :uint64, :positive_int_value, 4
|
231
|
+
optional :int64, :negative_int_value, 5
|
232
|
+
optional :double, :double_value, 6
|
233
|
+
optional :bytes, :string_value, 7
|
234
|
+
optional :string, :aggregate_value, 8
|
235
|
+
end
|
236
|
+
|
237
|
+
class SourceCodeInfo
|
238
|
+
class Location
|
239
|
+
repeated :int32, :path, 1, :packed => true
|
240
|
+
repeated :int32, :span, 2, :packed => true
|
241
|
+
optional :string, :leading_comments, 3
|
242
|
+
optional :string, :trailing_comments, 4
|
243
|
+
end
|
244
|
+
|
245
|
+
repeated ::Google::Protobuf::SourceCodeInfo::Location, :location, 1
|
246
|
+
end
|
247
|
+
|
248
|
+
end
|
249
|
+
|
250
|
+
end
|
251
|
+
|