protobuffy 3.1.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/.travis.yml +12 -0
- data/.yardopts +5 -0
- data/CHANGES.md +261 -0
- data/CONTRIBUTING.md +16 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +14 -0
- data/README.md +58 -0
- data/Rakefile +61 -0
- data/bin/protoc-gen-ruby +17 -0
- data/bin/rpc_server +4 -0
- data/examples/bin/reverse-client-http +4 -0
- data/examples/bin/reverse-client-socket +4 -0
- data/examples/bin/reverse-client-zmq +4 -0
- data/examples/config.ru +6 -0
- data/examples/definitions/example/reverse.proto +12 -0
- data/examples/lib/example/reverse-client.rb +23 -0
- data/examples/lib/example/reverse-service.rb +9 -0
- data/examples/lib/example/reverse.pb.rb +36 -0
- data/lib/protobuf.rb +106 -0
- data/lib/protobuf/cli.rb +249 -0
- data/lib/protobuf/code_generator.rb +41 -0
- data/lib/protobuf/decoder.rb +74 -0
- data/lib/protobuf/deprecator.rb +42 -0
- data/lib/protobuf/descriptors.rb +3 -0
- data/lib/protobuf/descriptors/google/protobuf/compiler/plugin.pb.rb +52 -0
- data/lib/protobuf/descriptors/google/protobuf/descriptor.pb.rb +249 -0
- data/lib/protobuf/encoder.rb +62 -0
- data/lib/protobuf/enum.rb +319 -0
- data/lib/protobuf/exceptions.rb +9 -0
- data/lib/protobuf/field.rb +74 -0
- data/lib/protobuf/field/base_field.rb +280 -0
- data/lib/protobuf/field/bool_field.rb +53 -0
- data/lib/protobuf/field/bytes_field.rb +81 -0
- data/lib/protobuf/field/double_field.rb +26 -0
- data/lib/protobuf/field/enum_field.rb +57 -0
- data/lib/protobuf/field/field_array.rb +86 -0
- data/lib/protobuf/field/fixed32_field.rb +25 -0
- data/lib/protobuf/field/fixed64_field.rb +29 -0
- data/lib/protobuf/field/float_field.rb +38 -0
- data/lib/protobuf/field/int32_field.rb +22 -0
- data/lib/protobuf/field/int64_field.rb +22 -0
- data/lib/protobuf/field/integer_field.rb +24 -0
- data/lib/protobuf/field/message_field.rb +66 -0
- data/lib/protobuf/field/sfixed32_field.rb +28 -0
- data/lib/protobuf/field/sfixed64_field.rb +29 -0
- data/lib/protobuf/field/signed_integer_field.rb +30 -0
- data/lib/protobuf/field/sint32_field.rb +22 -0
- data/lib/protobuf/field/sint64_field.rb +22 -0
- data/lib/protobuf/field/string_field.rb +35 -0
- data/lib/protobuf/field/uint32_field.rb +22 -0
- data/lib/protobuf/field/uint64_field.rb +22 -0
- data/lib/protobuf/field/varint_field.rb +68 -0
- data/lib/protobuf/generators/base.rb +71 -0
- data/lib/protobuf/generators/enum_generator.rb +42 -0
- data/lib/protobuf/generators/extension_generator.rb +28 -0
- data/lib/protobuf/generators/field_generator.rb +132 -0
- data/lib/protobuf/generators/file_generator.rb +140 -0
- data/lib/protobuf/generators/group_generator.rb +113 -0
- data/lib/protobuf/generators/message_generator.rb +99 -0
- data/lib/protobuf/generators/printable.rb +161 -0
- data/lib/protobuf/generators/service_generator.rb +27 -0
- data/lib/protobuf/http.rb +20 -0
- data/lib/protobuf/lifecycle.rb +46 -0
- data/lib/protobuf/logger.rb +86 -0
- data/lib/protobuf/message.rb +182 -0
- data/lib/protobuf/message/fields.rb +122 -0
- data/lib/protobuf/message/serialization.rb +84 -0
- data/lib/protobuf/optionable.rb +23 -0
- data/lib/protobuf/rpc/buffer.rb +79 -0
- data/lib/protobuf/rpc/client.rb +168 -0
- data/lib/protobuf/rpc/connector.rb +21 -0
- data/lib/protobuf/rpc/connectors/base.rb +54 -0
- data/lib/protobuf/rpc/connectors/common.rb +172 -0
- data/lib/protobuf/rpc/connectors/http.rb +90 -0
- data/lib/protobuf/rpc/connectors/socket.rb +73 -0
- data/lib/protobuf/rpc/connectors/zmq.rb +205 -0
- data/lib/protobuf/rpc/dynamic_discovery.pb.rb +47 -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 +53 -0
- data/lib/protobuf/rpc/server.rb +39 -0
- data/lib/protobuf/rpc/servers/http/server.rb +101 -0
- data/lib/protobuf/rpc/servers/http_runner.rb +34 -0
- data/lib/protobuf/rpc/servers/socket/server.rb +113 -0
- data/lib/protobuf/rpc/servers/socket/worker.rb +56 -0
- data/lib/protobuf/rpc/servers/socket_runner.rb +34 -0
- data/lib/protobuf/rpc/servers/zmq/broker.rb +155 -0
- data/lib/protobuf/rpc/servers/zmq/server.rb +313 -0
- data/lib/protobuf/rpc/servers/zmq/util.rb +47 -0
- data/lib/protobuf/rpc/servers/zmq/worker.rb +105 -0
- data/lib/protobuf/rpc/servers/zmq_runner.rb +51 -0
- data/lib/protobuf/rpc/service.rb +179 -0
- data/lib/protobuf/rpc/service_directory.rb +245 -0
- data/lib/protobuf/rpc/service_dispatcher.rb +46 -0
- data/lib/protobuf/rpc/service_filters.rb +273 -0
- data/lib/protobuf/rpc/stat.rb +148 -0
- data/lib/protobuf/socket.rb +22 -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/protobuffy.gemspec +37 -0
- data/spec/benchmark/tasks.rb +113 -0
- data/spec/bin/protoc-gen-ruby_spec.rb +18 -0
- data/spec/data/data.bin +3 -0
- data/spec/data/types.bin +0 -0
- data/spec/encoding/all_types_spec.rb +91 -0
- data/spec/encoding/extreme_values_spec.rb +0 -0
- data/spec/functional/socket_server_spec.rb +59 -0
- data/spec/functional/zmq_server_spec.rb +103 -0
- data/spec/lib/protobuf/cli_spec.rb +267 -0
- data/spec/lib/protobuf/code_generator_spec.rb +60 -0
- data/spec/lib/protobuf/enum_spec.rb +239 -0
- data/spec/lib/protobuf/field/int32_field_spec.rb +7 -0
- data/spec/lib/protobuf/field/string_field_spec.rb +46 -0
- data/spec/lib/protobuf/field_spec.rb +194 -0
- data/spec/lib/protobuf/generators/base_spec.rb +87 -0
- data/spec/lib/protobuf/generators/enum_generator_spec.rb +68 -0
- data/spec/lib/protobuf/generators/extension_generator_spec.rb +43 -0
- data/spec/lib/protobuf/generators/field_generator_spec.rb +99 -0
- data/spec/lib/protobuf/generators/file_generator_spec.rb +29 -0
- data/spec/lib/protobuf/generators/message_generator_spec.rb +0 -0
- data/spec/lib/protobuf/generators/service_generator_spec.rb +43 -0
- data/spec/lib/protobuf/lifecycle_spec.rb +89 -0
- data/spec/lib/protobuf/logger_spec.rb +136 -0
- data/spec/lib/protobuf/message_spec.rb +368 -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/connector_spec.rb +13 -0
- data/spec/lib/protobuf/rpc/connectors/http_spec.rb +61 -0
- data/spec/lib/protobuf/rpc/connectors/socket_spec.rb +24 -0
- data/spec/lib/protobuf/rpc/connectors/zmq_spec.rb +129 -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/http/server_spec.rb +104 -0
- data/spec/lib/protobuf/rpc/servers/socket_server_spec.rb +38 -0
- data/spec/lib/protobuf/rpc/servers/zmq/server_spec.rb +41 -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 +295 -0
- data/spec/lib/protobuf/rpc/service_dispatcher_spec.rb +52 -0
- data/spec/lib/protobuf/rpc/service_filters_spec.rb +484 -0
- data/spec/lib/protobuf/rpc/service_spec.rb +161 -0
- data/spec/lib/protobuf/rpc/stat_spec.rb +151 -0
- data/spec/lib/protobuf_spec.rb +78 -0
- data/spec/spec_helper.rb +57 -0
- data/spec/support/all.rb +7 -0
- data/spec/support/packed_field.rb +22 -0
- data/spec/support/server.rb +94 -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 +25 -0
- data/spec/support/test/defaults.proto +9 -0
- data/spec/support/test/enum.pb.rb +59 -0
- data/spec/support/test/enum.proto +34 -0
- data/spec/support/test/extended.pb.rb +22 -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 +543 -0
- data/spec/support/test/google_unittest.proto +713 -0
- data/spec/support/test/google_unittest_import.pb.rb +37 -0
- data/spec/support/test/google_unittest_import.proto +64 -0
- data/spec/support/test/google_unittest_import_public.pb.rb +8 -0
- data/spec/support/test/google_unittest_import_public.proto +38 -0
- data/spec/support/test/multi_field_extensions.pb.rb +56 -0
- data/spec/support/test/multi_field_extensions.proto +33 -0
- data/spec/support/test/resource.pb.rb +117 -0
- data/spec/support/test/resource.proto +94 -0
- data/spec/support/test/resource_service.rb +26 -0
- data/spec/support/test_app_file.rb +2 -0
- data/spec/support/tolerance_matcher.rb +40 -0
- metadata +367 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 999b239c093eb4031dacb08442959c7c30aa24ee
|
4
|
+
data.tar.gz: 3e8287f3fccbb2d9bef79df4dc92bdebe2f94ad6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3b305e8fd6659fe6ef2a7e8d18ec6962badc47217ddde2fbcd84bf6f18ab0ee0fafee6bb655773f6d59b53909d4e4269123a3505a178f1bcd600e78571699d97
|
7
|
+
data.tar.gz: 7c898d816504ac183035b16d41d16ad71910597efa5be4a634a4e69284c26a8881c1153110c15327f093dff527dfda42770b5e40fb9356fc9381afaf80782636
|
data/.gitignore
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
*.gem
|
2
|
+
*.swp
|
3
|
+
pkg/*
|
4
|
+
.bundle
|
5
|
+
.rvmrc
|
6
|
+
.rspec
|
7
|
+
*.log
|
8
|
+
coverage
|
9
|
+
doc
|
10
|
+
.yardoc
|
11
|
+
.DS_Store
|
12
|
+
*.so
|
13
|
+
Gemfile.lock
|
14
|
+
tmp/*
|
15
|
+
ext/defs
|
16
|
+
ext/out
|
17
|
+
ext/ruby_generator/protoc-ruby
|
18
|
+
.ruby-gemset
|
19
|
+
.ruby-version
|
20
|
+
ext/ruby_generator/gdb.run
|
21
|
+
ext/ruby_generator/protoc-ruby.dSYM
|
data/.travis.yml
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- "1.9.3"
|
4
|
+
- "2.0.0"
|
5
|
+
script: NO_COMPILE_TEST_PROTOS=1 bundle exec rake spec/lib
|
6
|
+
notifications:
|
7
|
+
webhooks:
|
8
|
+
urls:
|
9
|
+
- https://webhooks.gitter.im/e/51a956bcd2b1854d6756
|
10
|
+
on_success: change # options: [always|never|change] default: always
|
11
|
+
on_failure: always # options: [always|never|change] default: always
|
12
|
+
on_start: false # default: false
|
data/.yardopts
ADDED
data/CHANGES.md
ADDED
@@ -0,0 +1,261 @@
|
|
1
|
+
# Stable (3.x)
|
2
|
+
|
3
|
+
3.1.0
|
4
|
+
--------
|
5
|
+
|
6
|
+
- Add Protobuf::Rpc::Stats.statsd_client API to pass statistics on to Statsd. [@dgolombek]
|
7
|
+
|
8
|
+
3.0.4
|
9
|
+
--------
|
10
|
+
|
11
|
+
- Raise specific MethodNotFound when service class doesn't respond to (publicly implement)
|
12
|
+
the rpc method called from the client. Stop rescuing all NoMethodError's thrown
|
13
|
+
by service implementations. [#193, @liveh2o]
|
14
|
+
|
15
|
+
3.0.3
|
16
|
+
---------
|
17
|
+
|
18
|
+
- Fix recursive memory/cpu growth issue when calling class-level `Message.to_json`. [#190]
|
19
|
+
|
20
|
+
3.0.2
|
21
|
+
---------
|
22
|
+
|
23
|
+
- Queue requests at the broker when concurrent requests hit the ZMQ server, distribute to
|
24
|
+
worker threads on each turn of the read poll loop. [#189, @abrandoned, @liveh2o]
|
25
|
+
|
26
|
+
3.0.1
|
27
|
+
---------
|
28
|
+
|
29
|
+
- Fix NoMethodError that can occur when serializing a message with a missing required field. [#187, @abrandoned]
|
30
|
+
|
31
|
+
3.0.0
|
32
|
+
---------
|
33
|
+
|
34
|
+
A lot has changed since the last stable v2.8.12. For all the relevant changes,
|
35
|
+
see the closed [pull requests and issues list in github](https://github.com/localshred/protobuf/issues?milestone=1&state=closed).
|
36
|
+
Below is a high-level list of fixes, deprecations, breaking changes, and new APIs.
|
37
|
+
|
38
|
+
### EventMachine is dead, Long live EventMachine
|
39
|
+
|
40
|
+
The EventMachine client and server have been removed from this gem. They code was far
|
41
|
+
too error prone and flawed to feasibly support going forward. It's recommended
|
42
|
+
to switch to the socket implementation (using `PB_CLIENT_TYPE` and `PB_SERVER_TYPE` of `socket`)
|
43
|
+
for a painless switchover. The ZMQ implementation is much more performant but
|
44
|
+
does have a dependency on libzmq.
|
45
|
+
|
46
|
+
### Server Middlewares
|
47
|
+
|
48
|
+
The server/dispatcher stack has been converted to the Middleware pattern!
|
49
|
+
Exception handling (#162, #164), Request decoding (#160, #166), Response encoding (#161, #167),
|
50
|
+
Logging and stats (#163), and Method dispatch (#159) have all been extracted into their
|
51
|
+
own Middlewares to greatly simplify testing and further development of the server
|
52
|
+
stack, furthering our preparations for removing the socket implementations (zmq, socket)
|
53
|
+
into their own gems in version 4.0. Major props to @liveh2o for [tackling this beast](https://github.com/localshred/protobuf/tree/master/lib/protobuf/rpc/middleware).
|
54
|
+
|
55
|
+
#### Bug Fixes
|
56
|
+
|
57
|
+
- Resolve DNS names (e.g. localhost) when using ZMQ server. [#46, reported by @reddshack]
|
58
|
+
- Switched to hash based value storage for messages to fix large field tag memory issues. [#118, #165]
|
59
|
+
- `Enum.fetch` used to return an enum of any type if that is the value passed in. [#168]
|
60
|
+
|
61
|
+
#### Deprecations
|
62
|
+
|
63
|
+
__!! NOTE: These deprecated methods will be removed in v3.1. !!__
|
64
|
+
|
65
|
+
- Deprecated `BaseField#type` in favor of `#type_class`.
|
66
|
+
- Deprecated `Message.get_ext_field_by_name` in favor of `.get_extension_field` or `.get_field(name_or_tag, true)`.
|
67
|
+
- Deprecated `Message.get_ext_field_by_tag,` in favor of `.get_extension_field` or `.get_field(name_or_tag, true)`.
|
68
|
+
- Deprecated `Message.get_field_by_name,` in favor of `.get_field`.
|
69
|
+
- Deprecated `Message.get_field_by_tag,` in favor of `.get_field`.
|
70
|
+
- Deprecated `Enum.enum_by_value` in favor of `.enum_for_tag`.
|
71
|
+
- Deprecated `Enum.name_by_value` in favor of `.name_for_tag`.
|
72
|
+
- Deprecated `Enum.get_name_by_tag` in favor of `.name_for_tag`.
|
73
|
+
- Deprecated `Enum.value_by_name` in favor of `.enum_for_name`.
|
74
|
+
- Deprecated `Enum.values` in favor of `.enums`. Beware that `.enums` returns an array where `.values` returns a hash.
|
75
|
+
Use `.all_tags` if you just need all the valid tag numbers. In other words, don't do this anymore: `MyEnum.values.values.map(&:to_i).uniq`.
|
76
|
+
|
77
|
+
#### Breaking Changes
|
78
|
+
|
79
|
+
- Require Active Support 3.2+. [#177]
|
80
|
+
- All files/classes relating to the EventMachine client and server are gone. Use `PB_CLIENT_TYPE` and `PB_SERVER_TYPE` of `socket` instead. [#116]
|
81
|
+
- Cleaned up the `Enum` class, deprecating/renaming most methods. tl;dr, just use `MyEnum.fetch`.
|
82
|
+
See #134 for more comprehensive documentation about which methods are going and away and which are being renamed. [#134]
|
83
|
+
- Pulled `EnumValue` into `Enum`. The `EnumValue` class no longer exists. Use `Enum` for type-checking instead. [#168].
|
84
|
+
- Removed previously deprecated `bin/rprotoc` executable. Use `protoc --ruby_out=...` instead. [13fbdb9]
|
85
|
+
- Removed previously deprecated `Service#rpc` method. Use `Service#env#method_name` instead. [f391294]
|
86
|
+
- Changed the `Service#initialize` to take an `Env` object instead of separate request, method, and client parameters. [6c61bf72]
|
87
|
+
- Removed attribute readers for `Service#method_name` and `Service#client_host`. Use `Service#env` to get them instead.
|
88
|
+
- Removed `lib/protobuf/message/message.rb`. Use `lib/protobuf/message.rb` instead.
|
89
|
+
- Removed field getters from Message instances (e.g. `Message#get_field_by_name`).
|
90
|
+
Use class-level getters instead (see Deprecations section).
|
91
|
+
- Moved `lib/protobuf/message/decoder.rb` to `lib/protobuf/decoder.rb`. The module is still named `Protobuf::Decoder`.
|
92
|
+
- Removed `Protobuf::Field::ExtensionFields` class.
|
93
|
+
- Removed instance-level `max` and `min` methods from all relevant Field classes (e.g. Int32Field, Uint64Field, etc).
|
94
|
+
Use class-level methods of the same names instead. [#176, 992eb051]
|
95
|
+
- `PbError#to_response` no longer receives an argument, instead returning a new `Socketrpc::Response` object. [#147, @liveh2o]
|
96
|
+
- The Server module has been stripped of almost all methods, now simply invokes the Middleware stack for each request. [#159, @liveh2o]
|
97
|
+
- Removed `Protobuf::PROTOC_VERSION` constant now that the compiler supports any protoc version.
|
98
|
+
|
99
|
+
#### New APIs
|
100
|
+
|
101
|
+
- Added support for [enum `allow_alias` option](https://developers.google.com/protocol-buffers/docs/proto#enum). [#134]
|
102
|
+
- `Enum.all_tags` returns an array of unique tags. Use it to replace `Enum.values.values.map(&:to_i)` (`Enum.values` is deprecated).
|
103
|
+
- `Enum.enums` returns an array of all defined enums for that class (including any aliased Enums).
|
104
|
+
- Reinstated support for symbol primitive field types in generated Message code. [#170]
|
105
|
+
- `Message.get_field` accepts a second boolean parameter (default false) to return an extension field if found. [#169]
|
106
|
+
- Mirror existing `Decoder#decode_from(stream)` with `Encoder#encode_to(stream)`. [#169]
|
107
|
+
- `Server` now invokes the [middleware stack](https://github.com/localshred/protobuf/tree/master/lib/protobuf/rpc/middleware) for request handling. [#159, @liveh2o]
|
108
|
+
- Added `protobuf:compile` and `protobuf:clean` rake tasks. Simply `load 'protobuf/tasks/compile.rake'` in your Rakefile (see `compile.rake` for arguments and usage). [#142, #143]
|
109
|
+
- Add `Protobuf::Deprecator` module to alias deprecated methods. [#165]
|
110
|
+
- Add support for assigning a symbol to a string or bytes field. [#181, @abrandoned]
|
111
|
+
- Add `first_alive_load_balance` option to rpc server. Pass `PB_FIRST_ALIVE_LOAD_BALANCE`
|
112
|
+
as an env variable to the client process to ensure the client asks the server
|
113
|
+
if it is alive (able to server requests to clients). [#183, @abrandoned]
|
114
|
+
|
115
|
+
2.8.13
|
116
|
+
---------
|
117
|
+
|
118
|
+
- Backport #190 to 2.8 stable series. [#192]
|
119
|
+
|
120
|
+
2.8.12
|
121
|
+
---------
|
122
|
+
|
123
|
+
- Fix thread busy access in zmq server/worker. [#151, @abrandoned]
|
124
|
+
|
125
|
+
2.8.11
|
126
|
+
---------
|
127
|
+
|
128
|
+
- Default ZMQ server to use inproc protocol instead of tcp (zero-copy between server-broker-worker). [#145, @brianstien]
|
129
|
+
- Add `broadcast_busy` functionality that removes server from cluster if the workers are full. [#149, @abrandoned]
|
130
|
+
- Add cli option for `--no-zmq_inproc`. [#149, @abrandoned]
|
131
|
+
- Add cli option for `--broadcast_busy`. [#149, @abrandoned]
|
132
|
+
|
133
|
+
2.8.10
|
134
|
+
---------
|
135
|
+
|
136
|
+
- Allow passing a file extension to compile/clean rake tasks. [#143]
|
137
|
+
|
138
|
+
2.8.9
|
139
|
+
---------
|
140
|
+
|
141
|
+
- Deprecated Protobuf::Lifecycle module in favor of using ActiveSupport::Notifications. [#139, @devin-c]
|
142
|
+
- Modify `$LOAD_PATH` inside descriptors.rb to make it easier for other libraries to write their own compiler plugins using our pre-compiled descriptors. [#141]
|
143
|
+
- Add protobuf:clean and protobuf:compile rake tasks for use in external libraries to compile source definitions to a destination. [#142]
|
144
|
+
|
145
|
+
2.8.8
|
146
|
+
---------
|
147
|
+
|
148
|
+
- ServiceDirectory beacons broadcast on same ip as listening clients. [#133, @devin-c]
|
149
|
+
|
150
|
+
2.8.7
|
151
|
+
---------
|
152
|
+
|
153
|
+
- Fire ActiveSupport load hooks when RPC Server and Client classes are loaded. [#126, @liveh2o]
|
154
|
+
- Prevent infinite loop when doing service lookup from directory. [#125, @brianstien]
|
155
|
+
|
156
|
+
2.8.6
|
157
|
+
---------
|
158
|
+
|
159
|
+
- Fix string/byte encoding issue when unicode characters present. Reported by @foxban. This was also backported to v2.7.12. [#120]
|
160
|
+
|
161
|
+
2.8.5
|
162
|
+
----------
|
163
|
+
|
164
|
+
- Fix issue where ServiceDirectory lookups were failing when given a class name, breaking the directory load balancing. (#119)
|
165
|
+
|
166
|
+
2.8.4
|
167
|
+
----------
|
168
|
+
|
169
|
+
- Fix issue where frozen strings assigned in a repeated field would cause encoding runtime errors. (#117)
|
170
|
+
|
171
|
+
2.8.3
|
172
|
+
----------
|
173
|
+
|
174
|
+
- Add Deprecation warning when requiring `protobuf/evented`. Version 3.x will not support the eventmachine transport layer for client or server.
|
175
|
+
|
176
|
+
2.8.2
|
177
|
+
----------
|
178
|
+
|
179
|
+
- Remove the <4.0 version constraint on ActiveSupport.
|
180
|
+
|
181
|
+
2.8.1
|
182
|
+
----------
|
183
|
+
|
184
|
+
- Improve `ServiceDirectory` lookup speed ~10x, lookups now done in constant time (devin-c).
|
185
|
+
- Add Timestamp to end of rpc stat log (represents ending time of request processing).
|
186
|
+
- Set `request_size` in the rpc stat within ZMQ Worker (previously missing).
|
187
|
+
- Ensure `request_size` and `response_size` are set on rpc stat for client requests.
|
188
|
+
|
189
|
+
2.8.0
|
190
|
+
-----------
|
191
|
+
|
192
|
+
- New compiler supports protobuf compilation/runtime with protoc <= v2.5.0 (c++ compiler removed). [#109]
|
193
|
+
- Deprecated rprotoc in favor of protoc. [0bc9674]
|
194
|
+
- Added service dynamic discovery to the ZMQ connector and server. [#91, @devin-c]
|
195
|
+
- No longer creating `-java` platform gem due to removal of c++ compiler.
|
196
|
+
- Added WTFPL license.
|
197
|
+
|
198
|
+
2.7.12
|
199
|
+
-----------
|
200
|
+
|
201
|
+
- Backport string/byte encoding issue when unicode characters present. [code: #122, original issue: #120]
|
202
|
+
|
203
|
+
2.0.0
|
204
|
+
-----------
|
205
|
+
|
206
|
+
#### `rprotoc` changes
|
207
|
+
|
208
|
+
* New option `--ruby_out` to specify the output directory to place generated ruby files. If not provided, ruby code will not be generated.
|
209
|
+
* Extends `libprotoc` to hook in directly to google's provided compiler mechanism.
|
210
|
+
* Removed all previous compiler code including the racc parser, node visitors, etc.
|
211
|
+
* See `protoc --help` for default options.
|
212
|
+
|
213
|
+
#### `rprotoc` generated files changes
|
214
|
+
|
215
|
+
* Import `require`s now occur outside of any module or class declaration which solves ruby vm warnings previously seen.
|
216
|
+
* Empty inherited Message and Enum classes are pre-defined in the file, then reopened and their fields applied. This solves the issue of recursive field dependencies of two or more types in the same file.
|
217
|
+
* Generated DSL lines for message fields include the fully qualified name of the type (e.g. `optional ::Protobuf::Field::StringField, :name, 1`)
|
218
|
+
* Support for any combination of `packed`, `deprecated`, and `default` as options to pass to a field definition.
|
219
|
+
* Services are now generated in the corresponding `.pb.rb` file instead of their own `*_service.rb` files as before.
|
220
|
+
|
221
|
+
#### `rpc_server` changes
|
222
|
+
|
223
|
+
* Removed `--env` option. The running application or program is solely in charge of ensuring it's environment is properly loaded.
|
224
|
+
* Removed reading of `PB_CLIENT_TYPE`, `PB_SERVER_TYPE` environment variables. Should use mode switches or custom requires (see below) instead.
|
225
|
+
* Removed `--client_socket` in favor of using mode switches. This also means client calls made by the `rpc_server` will run as the same connector type as the given mode (socket, zmq, or evented).
|
226
|
+
* Removed `--pre-cache-definitions` switch in favor of always pre-caching for performance.
|
227
|
+
* Removed `--gc-pause-serialization` since using `--gc-pause-request` in conjunction was redundant.
|
228
|
+
* Removed `--client-type` in favor of mode switches.
|
229
|
+
* Removed `--server-type` in favor of mode switches.
|
230
|
+
* Added mode switch `--evented`.
|
231
|
+
* Added `--threads` to specify number of ZMQ Worker threads to use. Ignored if mode is not zmq.
|
232
|
+
* Added `--print-deprecation-warnings` switch to tell the server whether or not to print deprecation warnings on field usage. Enabled by default.
|
233
|
+
* See `rpc_server help start` for all options and usage. Note: the `start` task is the default and not necessary when running the `rpc_server`.
|
234
|
+
|
235
|
+
#### Message changes
|
236
|
+
|
237
|
+
* `Message#get_field` usage should now specify either `Message#get_field_by_name` or `Message#get_field_by_tag`, depending on your lookup criteria.
|
238
|
+
* Support for STDERR output when accessing a message field which has been defined as `[deprecated=true]`. Deprecated warnings can be skipped by running your application or program with `PB_IGNORE_DEPRECATIONS=1`.
|
239
|
+
* Significant internal refactoring which provides huge boosts in speed and efficiency both in accessing/writing Message field values, as well as serialization and deserialization routines.
|
240
|
+
* Refactor `Message#to_hash` to delegate hash representations to the field values, simply collecting the display values and returning a hash of fields that are set. This also affects `to_json` output.
|
241
|
+
|
242
|
+
#### Enum changes
|
243
|
+
|
244
|
+
* Add `Enum.fetch` class method to polymorphically retrieve an `EnumValue` object.
|
245
|
+
* Add `Enum.value_by_name` to retrieve the corresponding `EnumValue` to the given symbol name.
|
246
|
+
* Add `Enum.enum_by_value` to retrieve the corresponding `EnumValue` to the given integer value.
|
247
|
+
|
248
|
+
#### RPC Service changes
|
249
|
+
|
250
|
+
* `async_responder` paradigm is no longer supported.
|
251
|
+
* `self.response=` paradigm should be converted to using `respond_with(object)`.
|
252
|
+
* Significant internal changes that should not bleed beyond the API but which make maintaining the code much easier.
|
253
|
+
|
254
|
+
#### RPC Client changes
|
255
|
+
|
256
|
+
* In the absence of `PB_CLIENT_TYPE` environment var, you should be requiring the specific connector type specifically. For instance, if you wish to run in zmq mode for client requests, update your Gemfile: `gem 'protobuf', :require => 'protobuf/zmq'`.
|
257
|
+
* `:async` option on client calls is no longer recognized.
|
258
|
+
|
259
|
+
#### Other changes
|
260
|
+
|
261
|
+
* Moved files out of `lib/protobuf/common` folder into `lib/protobuf`. Files affected are logger, wire\_type, util. The only update would need to be the require path to these files since the modules were always `Protobuf::{TYPE}`.
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# Contributing
|
2
|
+
|
3
|
+
I love accepting issues and pull requests. I only ask for a few guidelines to
|
4
|
+
be followed that will make it much easier for me to solve your issue or get
|
5
|
+
your code merged.
|
6
|
+
|
7
|
+
1. Use GitHub Issues or Pull Requests over sending an email. It's much easier for me to keep track of your issue through GitHub.
|
8
|
+
2. For __compiler issues__, please provide both a gist for the __source definition(s)__ as well as the __generated output__ (if any).
|
9
|
+
3. For __existing issues or functionality__, please use __`2-8-stable`__ as the base branch for the pull request. This helps us maintain a stable gem release strategy. All commits merged to `2-8-stable` will also be merged down to `master`.
|
10
|
+
4. For __new functionality__, please use __`master`__ as the base branch for the pull request. The `master` branch is used to stage all "next iteration" work.
|
11
|
+
5. Be patient with me as I work on your issue.
|
12
|
+
|
13
|
+
Following these simple guidelines really will help me help you. And really,
|
14
|
+
that's what we're here for. I'm on @localshred on twitter, let's be friends. :)
|
15
|
+
|
16
|
+
## Happy Contributing!
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
2
|
+
Version 2, December 2004
|
3
|
+
|
4
|
+
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
5
|
+
|
6
|
+
Everyone is permitted to copy and distribute verbatim or modified
|
7
|
+
copies of this license document, and changing it is allowed as long
|
8
|
+
as the name is changed.
|
9
|
+
|
10
|
+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
11
|
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
12
|
+
|
13
|
+
0. You just DO WHAT THE FUCK YOU WANT TO.
|
14
|
+
|
data/README.md
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# Protobuffy
|
2
|
+
|
3
|
+
(the JSON slayer)
|
4
|
+
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/protobuf.png)](http://badge.fury.io/rb/protobuf)
|
6
|
+
[![Build Status](https://secure.travis-ci.org/localshred/protobuf.png?branch=master)](https://travis-ci.org/localshred/protobuf)
|
7
|
+
[![Gitter chat](https://badges.gitter.im/localshred/protobuf.png)](https://gitter.im/localshred/protobuf)
|
8
|
+
|
9
|
+
Protobuffy is an implementation of [Google's protocol buffers][google-pb] in
|
10
|
+
ruby, version 2.5.0 is currently supported.
|
11
|
+
|
12
|
+
## Install
|
13
|
+
|
14
|
+
See our [Installation Guide][] on the [wiki][].
|
15
|
+
|
16
|
+
## Usage
|
17
|
+
|
18
|
+
The [wiki][] contains in-depth guides on the various ways to use this gem
|
19
|
+
including [compiling definitions][], [object APIs][], [services][], [clients][], and even
|
20
|
+
an [API roadmap][].
|
21
|
+
|
22
|
+
## Examples
|
23
|
+
|
24
|
+
In two different terminals run the follow pairs of commands:
|
25
|
+
|
26
|
+
Socket:
|
27
|
+
|
28
|
+
bundle exec bin/rpc_server start --socket ./examples/lib/example/reverse-service.rb
|
29
|
+
bundle exec examples/bin/reverse-client-socket '!skrow tekcos'
|
30
|
+
|
31
|
+
ZeroMQ:
|
32
|
+
|
33
|
+
bundle exec bin/rpc_server start --zmq ./examples/lib/example/reverse-service.rb
|
34
|
+
bundle exec examples/bin/reverse-client-zmq '!skrow qmorez'
|
35
|
+
|
36
|
+
HTTP:
|
37
|
+
|
38
|
+
bundle exec bin/rpc_server start --http ./examples/lib/example/reverse-service.rb
|
39
|
+
bundle exec examples/bin/reverse-client-http '!skrow ptth'
|
40
|
+
|
41
|
+
Alternatively, start the server as a Rack app using a `rackup` and a standard `config.ru`:
|
42
|
+
|
43
|
+
bundle exec rackup examples/config.ru -p 9399
|
44
|
+
|
45
|
+
## Changelog
|
46
|
+
|
47
|
+
See recent changes in the [release notes][] or the [changelog][].
|
48
|
+
|
49
|
+
[google-pb]: http://code.google.com/p/protobuf "Google Protocol Buffers"
|
50
|
+
[wiki]: https://github.com/localshred/protobuf/wiki "Wiki home page"
|
51
|
+
[Installation Guide]: https://github.com/localshred/protobuf/wiki/Installation "Installation guide"
|
52
|
+
[compiling definitions]: https://github.com/localshred/protobuf/wiki/Compiling-Definitions "Compiling guide"
|
53
|
+
[object APIs]: https://github.com/localshred/protobuf/wiki/Messages-&-Enums "Message & Enum object APIs guide"
|
54
|
+
[services]: https://github.com/localshred/protobuf/wiki/Services "Services object API guide"
|
55
|
+
[clients]: https://github.com/localshred/protobuf/wiki/Clients "Client object API guide"
|
56
|
+
[API roadmap]: https://github.com/localshred/protobuf/wiki/API-Roadmap "API Roadmap guide"
|
57
|
+
[release notes]: https://github.com/localshred/protobuf/releases "Release notes"
|
58
|
+
[changelog]: https://github.com/localshred/protobuf/blob/master/CHANGES.md "CHANGES.md"
|
data/Rakefile
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
$: << ::File.expand_path('../', __FILE__)
|
2
|
+
$: << ::File.expand_path('../spec', __FILE__)
|
3
|
+
|
4
|
+
require 'fileutils'
|
5
|
+
require 'rubygems'
|
6
|
+
require 'rubygems/package_task'
|
7
|
+
require 'bundler/gem_tasks'
|
8
|
+
require 'benchmark/tasks'
|
9
|
+
|
10
|
+
require 'rspec/core/rake_task'
|
11
|
+
|
12
|
+
desc 'Default: run specs.'
|
13
|
+
task :default => :spec
|
14
|
+
|
15
|
+
RSpec::Core::RakeTask.new(:spec)
|
16
|
+
|
17
|
+
desc 'Run specs'
|
18
|
+
namespace :compile do
|
19
|
+
|
20
|
+
desc 'Compile spec protos in spec/supprt/ directory'
|
21
|
+
task :spec do |task, args|
|
22
|
+
proto_path = ::File.expand_path('../spec/support/', __FILE__)
|
23
|
+
cmd = %Q{protoc --plugin=./bin/protoc-gen-ruby --ruby_out=#{proto_path} -I #{proto_path} #{File.join(proto_path, '**', '*.proto')}}
|
24
|
+
|
25
|
+
puts cmd
|
26
|
+
exec(cmd)
|
27
|
+
end
|
28
|
+
|
29
|
+
desc 'Compile rpc protos in protos/ directory'
|
30
|
+
task :rpc do |task, args|
|
31
|
+
proto_path = ::File.expand_path('../proto', __FILE__)
|
32
|
+
output_dir = ::File.expand_path('../tmp/rpc', __FILE__)
|
33
|
+
::FileUtils.mkdir_p(output_dir)
|
34
|
+
|
35
|
+
cmd = %Q{protoc --plugin=./bin/protoc-gen-ruby --ruby_out=#{output_dir} -I #{proto_path} #{File.join(proto_path, '**', '*.proto')}}
|
36
|
+
|
37
|
+
puts cmd
|
38
|
+
system(cmd)
|
39
|
+
|
40
|
+
files = {
|
41
|
+
'tmp/rpc/dynamic_discovery.pb.rb' => 'lib/protobuf/rpc',
|
42
|
+
'tmp/rpc/rpc.pb.rb' => 'lib/protobuf/rpc',
|
43
|
+
'tmp/rpc/google/protobuf/descriptor.pb.rb' => 'lib/protobuf/descriptors/google/protobuf',
|
44
|
+
'tmp/rpc/google/protobuf/compiler/plugin.pb.rb' => 'lib/protobuf/descriptors/google/protobuf/compiler'
|
45
|
+
}
|
46
|
+
|
47
|
+
files.each_pair do |source_file, destination_dir|
|
48
|
+
source_file = ::File.expand_path("../#{source_file}", __FILE__)
|
49
|
+
destination_dir = ::File.expand_path("../#{destination_dir}", __FILE__)
|
50
|
+
::FileUtils::Verbose.cp(source_file, destination_dir)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
task :console do
|
57
|
+
require 'pry'
|
58
|
+
require 'protobuf'
|
59
|
+
ARGV.clear
|
60
|
+
::Pry.start
|
61
|
+
end
|