google-protobuf 4.26.1 → 4.28.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of google-protobuf might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/ext/google/protobuf_c/convert.c +39 -14
- data/ext/google/protobuf_c/defs.c +327 -1
- data/ext/google/protobuf_c/glue.c +16 -0
- data/ext/google/protobuf_c/map.c +72 -20
- data/ext/google/protobuf_c/map.h +6 -2
- data/ext/google/protobuf_c/message.c +78 -50
- data/ext/google/protobuf_c/message.h +1 -5
- data/ext/google/protobuf_c/protobuf.c +11 -9
- data/ext/google/protobuf_c/protobuf.h +3 -7
- data/ext/google/protobuf_c/repeated_field.c +61 -17
- data/ext/google/protobuf_c/repeated_field.h +5 -1
- data/ext/google/protobuf_c/ruby-upb.c +1693 -475
- data/ext/google/protobuf_c/ruby-upb.h +2526 -1386
- data/ext/google/protobuf_c/shared_convert.c +5 -2
- data/ext/google/protobuf_c/shared_message.c +0 -30
- data/ext/google/protobuf_c/shared_message.h +0 -4
- data/lib/google/protobuf/descriptor_pb.rb +2 -1
- data/lib/google/protobuf/ffi/descriptor.rb +4 -3
- data/lib/google/protobuf/ffi/descriptor_pool.rb +3 -1
- data/lib/google/protobuf/ffi/enum_descriptor.rb +3 -1
- data/lib/google/protobuf/ffi/ffi.rb +0 -5
- data/lib/google/protobuf/ffi/field_descriptor.rb +4 -2
- data/lib/google/protobuf/ffi/file_descriptor.rb +3 -1
- data/lib/google/protobuf/ffi/internal/arena.rb +0 -6
- data/lib/google/protobuf/ffi/internal/convert.rb +14 -7
- data/lib/google/protobuf/ffi/map.rb +45 -21
- data/lib/google/protobuf/ffi/message.rb +182 -60
- data/lib/google/protobuf/ffi/method_descriptor.rb +114 -0
- data/lib/google/protobuf/ffi/oneof_descriptor.rb +3 -1
- data/lib/google/protobuf/ffi/repeated_field.rb +42 -16
- data/lib/google/protobuf/ffi/service_descriptor.rb +107 -0
- data/lib/google/protobuf/repeated_field.rb +3 -3
- data/lib/google/protobuf_ffi.rb +2 -0
- metadata +20 -4
@@ -0,0 +1,107 @@
|
|
1
|
+
# Protocol Buffers - Google's data interchange format
|
2
|
+
# Copyright 2024 Google Inc. All rights reserved.
|
3
|
+
#
|
4
|
+
# Use of this source code is governed by a BSD-style
|
5
|
+
# license that can be found in the LICENSE file or at
|
6
|
+
# https://developers.google.com/open-source/licenses/bsd
|
7
|
+
|
8
|
+
module Google
|
9
|
+
module Protobuf
|
10
|
+
class ServiceDescriptor
|
11
|
+
attr :service_def, :descriptor_pool
|
12
|
+
include Enumerable
|
13
|
+
|
14
|
+
include Google::Protobuf::Internal::Convert
|
15
|
+
|
16
|
+
# FFI Interface methods and setup
|
17
|
+
extend ::FFI::DataConverter
|
18
|
+
native_type ::FFI::Type::POINTER
|
19
|
+
|
20
|
+
class << self
|
21
|
+
prepend Google::Protobuf::Internal::TypeSafety
|
22
|
+
include Google::Protobuf::Internal::PointerHelper
|
23
|
+
|
24
|
+
# @param value [ServiceDescriptor] ServiceDescriptor to convert to an FFI native type
|
25
|
+
# @param _ [Object] Unused
|
26
|
+
def to_native(value, _)
|
27
|
+
service_def_ptr = value.nil? ? nil : value.instance_variable_get(:@service_def)
|
28
|
+
return ::FFI::Pointer::NULL if service_def_ptr.nil?
|
29
|
+
raise "Underlying service_def was null!" if service_def_ptr.null?
|
30
|
+
service_def_ptr
|
31
|
+
end
|
32
|
+
|
33
|
+
##
|
34
|
+
# @param service_def [::FFI::Pointer] ServiceDef pointer to be wrapped
|
35
|
+
# @param _ [Object] Unused
|
36
|
+
def from_native(service_def, _ = nil)
|
37
|
+
return nil if service_def.nil? or service_def.null?
|
38
|
+
file_def = Google::Protobuf::FFI.file_def_by_raw_service_def(service_def)
|
39
|
+
descriptor_from_file_def(file_def, service_def)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.new(*arguments, &block)
|
44
|
+
raise "Descriptor objects may not be created from Ruby."
|
45
|
+
end
|
46
|
+
|
47
|
+
def to_s
|
48
|
+
inspect
|
49
|
+
end
|
50
|
+
|
51
|
+
def inspect
|
52
|
+
"#{self.class.name}: #{name}"
|
53
|
+
end
|
54
|
+
|
55
|
+
def name
|
56
|
+
@name ||= Google::Protobuf::FFI.get_service_full_name(self)
|
57
|
+
end
|
58
|
+
|
59
|
+
def file_descriptor
|
60
|
+
@descriptor_pool.send(:get_file_descriptor, Google::Protobuf::FFI.file_def_by_raw_service_def(@service_def))
|
61
|
+
end
|
62
|
+
|
63
|
+
def each &block
|
64
|
+
n = Google::Protobuf::FFI.method_count(self)
|
65
|
+
0.upto(n-1) do |i|
|
66
|
+
yield(Google::Protobuf::FFI.get_method_by_index(self, i))
|
67
|
+
end
|
68
|
+
nil
|
69
|
+
end
|
70
|
+
|
71
|
+
def options
|
72
|
+
@options ||= begin
|
73
|
+
size_ptr = ::FFI::MemoryPointer.new(:size_t, 1)
|
74
|
+
temporary_arena = Google::Protobuf::FFI.create_arena
|
75
|
+
buffer = Google::Protobuf::FFI.service_options(self, size_ptr, temporary_arena)
|
76
|
+
Google::Protobuf::ServiceOptions.decode(buffer.read_string_length(size_ptr.read(:size_t)).force_encoding("ASCII-8BIT").freeze).freeze
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
private
|
81
|
+
|
82
|
+
def initialize(service_def, descriptor_pool)
|
83
|
+
@service_def = service_def
|
84
|
+
@descriptor_pool = descriptor_pool
|
85
|
+
end
|
86
|
+
|
87
|
+
def self.private_constructor(service_def, descriptor_pool)
|
88
|
+
instance = allocate
|
89
|
+
instance.send(:initialize, service_def, descriptor_pool)
|
90
|
+
instance
|
91
|
+
end
|
92
|
+
|
93
|
+
def c_type
|
94
|
+
@c_type ||= Google::Protobuf::FFI.get_c_type(self)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
class FFI
|
99
|
+
# ServiceDef
|
100
|
+
attach_function :file_def_by_raw_service_def, :upb_ServiceDef_File, [:pointer], :FileDef
|
101
|
+
attach_function :get_service_full_name, :upb_ServiceDef_FullName, [ServiceDescriptor], :string
|
102
|
+
attach_function :method_count, :upb_ServiceDef_MethodCount, [ServiceDescriptor], :int
|
103
|
+
attach_function :get_method_by_index, :upb_ServiceDef_Method, [ServiceDescriptor, :int], MethodDescriptor
|
104
|
+
attach_function :service_options, :ServiceDescriptor_serialized_options, [ServiceDescriptor, :pointer, Internal::Arena], :pointer
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
@@ -47,12 +47,12 @@ module Google
|
|
47
47
|
def_delegators :to_ary,
|
48
48
|
:&, :*, :-, :'<=>',
|
49
49
|
:assoc, :bsearch, :bsearch_index, :combination, :compact, :count,
|
50
|
-
:cycle, :dig, :drop, :drop_while, :eql?, :fetch, :find_index, :flatten,
|
51
|
-
:include?, :index, :inspect, :join,
|
50
|
+
:cycle, :difference, :dig, :drop, :drop_while, :eql?, :fetch, :find_index, :flatten,
|
51
|
+
:include?, :index, :inspect, :intersection, :join,
|
52
52
|
:pack, :permutation, :product, :pretty_print, :pretty_print_cycle,
|
53
53
|
:rassoc, :repeated_combination, :repeated_permutation, :reverse,
|
54
54
|
:rindex, :rotate, :sample, :shuffle, :shelljoin,
|
55
|
-
:to_s, :transpose, :uniq, :|
|
55
|
+
:to_s, :transpose, :union, :uniq, :|
|
56
56
|
|
57
57
|
|
58
58
|
def first(n=nil)
|
data/lib/google/protobuf_ffi.rb
CHANGED
@@ -15,6 +15,8 @@ require 'google/protobuf/ffi/descriptor'
|
|
15
15
|
require 'google/protobuf/ffi/enum_descriptor'
|
16
16
|
require 'google/protobuf/ffi/field_descriptor'
|
17
17
|
require 'google/protobuf/ffi/oneof_descriptor'
|
18
|
+
require 'google/protobuf/ffi/method_descriptor'
|
19
|
+
require 'google/protobuf/ffi/service_descriptor'
|
18
20
|
require 'google/protobuf/ffi/descriptor_pool'
|
19
21
|
require 'google/protobuf/ffi/file_descriptor'
|
20
22
|
require 'google/protobuf/ffi/map'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-protobuf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.28.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Protobuf Authors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler-dock
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 1.2.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bigdecimal
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rake
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -151,9 +165,11 @@ files:
|
|
151
165
|
- lib/google/protobuf/ffi/internal/type_safety.rb
|
152
166
|
- lib/google/protobuf/ffi/map.rb
|
153
167
|
- lib/google/protobuf/ffi/message.rb
|
168
|
+
- lib/google/protobuf/ffi/method_descriptor.rb
|
154
169
|
- lib/google/protobuf/ffi/object_cache.rb
|
155
170
|
- lib/google/protobuf/ffi/oneof_descriptor.rb
|
156
171
|
- lib/google/protobuf/ffi/repeated_field.rb
|
172
|
+
- lib/google/protobuf/ffi/service_descriptor.rb
|
157
173
|
- lib/google/protobuf/field_mask_pb.rb
|
158
174
|
- lib/google/protobuf/internal/object_cache.rb
|
159
175
|
- lib/google/protobuf/message_exts.rb
|
@@ -172,7 +188,7 @@ homepage: https://developers.google.com/protocol-buffers
|
|
172
188
|
licenses:
|
173
189
|
- BSD-3-Clause
|
174
190
|
metadata:
|
175
|
-
source_code_uri: https://github.com/protocolbuffers/protobuf/tree/v4.
|
191
|
+
source_code_uri: https://github.com/protocolbuffers/protobuf/tree/v4.28.0/ruby
|
176
192
|
post_install_message:
|
177
193
|
rdoc_options: []
|
178
194
|
require_paths:
|
@@ -181,7 +197,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
181
197
|
requirements:
|
182
198
|
- - ">="
|
183
199
|
- !ruby/object:Gem::Version
|
184
|
-
version: '
|
200
|
+
version: '3.0'
|
185
201
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
186
202
|
requirements:
|
187
203
|
- - ">="
|