Skip to content

Releases: ruby-protobuf/protobuf

v3.0.0.rc2

25 Feb 02:38
Compare
Choose a tag to compare
v3.0.0.rc2 Pre-release
Pre-release

Please read the rc1 release for the greater changeset.

  • Add support for assigning a symbol to a string or bytes field. [#181, @abrandoned]
  • Add first_alive_load_balance option to rpc server if using ZMQ. Pass PB_FIRST_ALIVE_LOAD_BALANCE
    as an env variable to the client process to ensure the client asks the server
    if it is alive (able to server requests to clients). [#183, @abrandoned]

v3.0.0.rc1

19 Feb 18:35
Compare
Choose a tag to compare
v3.0.0.rc1 Pre-release
Pre-release

A lot has changed leading up to the release of 3.0. For all the relevant changes,
see the closed pull requests and issues list in github.
Below is a high-level list of fixes, deprecations, breaking changes, and new APIs.

EventMachine is dead, Long live EventMachine

The EventMachine client and server have been removed from this gem. They code was far
too error prone and flawed to feasibly support going forward. It's recommended
to switch to the socket implementation (using PB_CLIENT_TYPE and PB_SERVER_TYPE of socket)
for a painless switchover. The ZMQ implementation is much more performant but
does have a dependency on libzmq.

Server Middlewares

The server/dispatcher stack has been converted to the Middleware pattern!
Exception handling (#162, #164), Request decoding (#160, #166), Response encoding (#161, #167),
Logging and stats (#163), and Method dispatch (#159) have all been extracted into their
own Middlewares to greatly simplify testing and further development of the server
stack, furthering our preparations for removing the socket implementations (zmq, socket)
into their own gems in version 4.0. Major props to @liveh2o for tackling this beast.

Bug Fixes

  • Resolve DNS names (e.g. localhost) when using ZMQ server. [#46, reported by @reddshack]
  • Switched to hash based value storage for messages to fix large field tag memory issues. [#118, #165]
  • Enum.fetch used to return an enum of any type if that is the value passed in. [#168]

Deprecations

!! NOTE: These deprecated methods will be removed in v3.1. !!

  • Deprecated BaseField#type in favor of #type_class.
  • Deprecated Message.get_ext_field_by_name in favor of .get_extension_field or .get_field(name_or_tag, true).
  • Deprecated Message.get_ext_field_by_tag, in favor of .get_extension_field or .get_field(name_or_tag, true).
  • Deprecated Message.get_field_by_name, in favor of .get_field.
  • Deprecated Message.get_field_by_tag, in favor of .get_field.
  • Deprecated Enum.enum_by_value in favor of .enum_for_tag.
  • Deprecated Enum.name_by_value in favor of .name_for_tag.
  • Deprecated Enum.get_name_by_tag in favor of .name_for_tag.
  • Deprecated Enum.value_by_name in favor of .enum_for_name.
  • Deprecated Enum.values in favor of .enums. Beware that .enums returns an array where .values returns a hash.
    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.

Breaking Changes

  • Require Active Support 3.2+. [#177]
  • All files/classes relating to the EventMachine client and server are gone. Use PB_CLIENT_TYPE and PB_SERVER_TYPE of socket instead. [#116]
  • Cleaned up the Enum class, deprecating/renaming most methods. tl;dr, just use MyEnum.fetch.
    See #134 for more comprehensive documentation about which methods are going and away and which are being renamed. [#134]
  • Pulled EnumValue into Enum. The EnumValue class no longer exists. Use Enum for type-checking instead. [#168].
  • Removed previously deprecated bin/rprotoc executable. Use protoc --ruby_out=... instead. [13fbdb9]
  • Removed previously deprecated Service#rpc method. Use Service#env#method_name instead. [f391294]
  • Changed the Service#initialize to take an Env object instead of separate request, method, and client parameters. [6c61bf7]
  • Removed attribute readers for Service#method_name and Service#client_host. Use Service#env to get them instead.
  • Removed lib/protobuf/message/message.rb. Use lib/protobuf/message.rb instead.
  • Removed field getters from Message instances (e.g. Message#get_field_by_name).
    Use class-level getters instead (see Deprecations section).
  • Moved lib/protobuf/message/decoder.rb to lib/protobuf/decoder.rb. The module is still named Protobuf::Decoder.
  • Removed Protobuf::Field::ExtensionFields class.
  • Removed instance-level max and min methods from all relevant Field classes (e.g. Int32Field, Uint64Field, etc).
    Use class-level methods of the same names instead. [#176, 992eb05]
  • PbError#to_response no longer receives an argument, instead returning a new Socketrpc::Response object. [#147, @liveh2o]
  • The Server module has been stripped of almost all methods, now simply invokes the Middleware stack for each request. [#159, @liveh2o]
  • Removed Protobuf::PROTOC_VERSION constant now that the compiler supports any protoc version.

New APIs

  • Added support for enum allow_alias option. [#134]
  • Enum.all_tags returns an array of unique tags. Use it to replace Enum.values.values.map(&:to_i) (Enum.values is deprecated).
  • Enum.enums returns an array of all defined enums for that class (including any aliased Enums).
  • Reinstated support for symbol primitive field types in generated Message code. [#170]
  • Message.get_field accepts a second boolean parameter (default false) to return an extension field if found. [#169]
  • Mirror existing Decoder#decode_from(stream) with Encoder#encode_to(stream). [#169]
  • Server now invokes the middleware stack for request handling. [#159, @liveh2o]
  • 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]
  • Add Protobuf::Deprecator module to alias deprecated methods. [#165]

v2.8.12

11 Feb 18:30
Compare
Choose a tag to compare

v2.8.11

11 Feb 16:56
Compare
Choose a tag to compare
  • Default ZMQ server to use inproc protocol instead of tcp (zero-copy between server-broker-worker). [#145, @brianstien]
  • Add 'broadcast_busy' functionality that removes server from cluster if the workers are full. [#149, @abrandoned]
  • Add cli option for --no-zmq_inproc. [#149, @abrandoned]
  • Add cli option for --broadcast_busy. [#149, @abrandoned]

v2.8.10

06 Feb 21:33
Compare
Choose a tag to compare
  • Allow passing a file extension to compile/clean rake tasks. [#143, @localshred]

v2.8.9

06 Feb 20:32
Compare
Choose a tag to compare
  • Deprecated Protobuf::Lifecycle module in favor of using ActiveSupport::Notifications. [#139, @devin-c]
  • 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, @localshred]
  • Add protobuf:clean and protobuf:compile rake tasks for use in external libraries to compile source definitions to a destination. [#142, @localshred]

v2.8.8

14 Nov 22:08
Compare
Choose a tag to compare
  • ServiceDirectory beacons broadcast on same ip as listening clients. [#133, @devin-c]

v2.8.7

07 Oct 17:37
Compare
Choose a tag to compare
  • Fire ActiveSupport load hooks when RPC Server and Client classes are loaded. [#126, @liveh2o]
  • Prevent infinite loop when doing service lookup from directory. [#125, @brianstien]

v2.8.6

17 Sep 15:37
Compare
Choose a tag to compare

Fixes string/byte encoding issue when unicode characters present. Reported by @foxban. This was also backported to v2.7.12. [#120, 067a3e3]

Before this change, if a string or bytes field contained a unicode
character, that field was effectively corrupted from its source value
after the proto was encoded. Also, subsequent calls to encode returned null bytes.

resource = Test::Resource.new(:name => "\u20ac") # => {:name=>"€"}
resource.encode #=> valid encoding
resource.name # => "\xE2\x82\xAC"
resource.encode #=> "\n\u0000"
resource.name # => ""

It should be noted this behavior is not present when the string
contains characters that fall inside the normal ascii range.

v2.7.12

17 Sep 15:34
Compare
Choose a tag to compare
  • Backport string/byte encoding issue when unicode characters present. [code: #122, original issue: #120]