Skip to content

Commit 0c88003

Browse files
committed
do not release gvl on name check
1 parent 7a1397e commit 0c88003

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

lib/rdkafka/bindings.rb

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
module Rdkafka
44
# @private
5+
#
6+
# @note
7+
# There are two types of responses related to errors:
8+
# - rd_kafka_error_t - a C object that we need to remap into an error or null when no error
9+
# - rd_kafka_resp_err_t - response error code (numeric) that we can use directly
10+
#
11+
# It is critical to ensure, that we handle them correctly. The result type should be:
12+
# - rd_kafka_error_t - :pointer
13+
# - rd_kafka_resp_err_t - :int
514
module Bindings
615
extend FFI::Library
716

@@ -38,7 +47,7 @@ class SizePtr < FFI::Struct
3847

3948
# Metadata
4049

41-
attach_function :rd_kafka_name, [:pointer], :string, blocking: true
50+
attach_function :rd_kafka_name, [:pointer], :string
4251
attach_function :rd_kafka_memberid, [:pointer], :string, blocking: true
4352
attach_function :rd_kafka_clusterid, [:pointer], :string, blocking: true
4453
attach_function :rd_kafka_metadata, [:pointer, :int, :pointer, :pointer, :int], :int, blocking: true
@@ -84,7 +93,7 @@ class TopicPartitionList < FFI::Struct
8493
end
8594

8695
attach_function :rd_kafka_topic_partition_list_new, [:int32], :pointer
87-
attach_function :rd_kafka_topic_partition_list_add, [:pointer, :string, :int32], :void
96+
attach_function :rd_kafka_topic_partition_list_add, [:pointer, :string, :int32], :pointer
8897
attach_function :rd_kafka_topic_partition_list_set_offset, [:pointer, :string, :int32, :int64], :void
8998
attach_function :rd_kafka_topic_partition_list_destroy, [:pointer], :void
9099
attach_function :rd_kafka_topic_partition_list_copy, [:pointer], :pointer
@@ -140,6 +149,11 @@ class NativeErrorDesc < FFI::Struct
140149

141150
attach_function :rd_kafka_err2name, [:int], :string
142151
attach_function :rd_kafka_err2str, [:int], :string
152+
attach_function :rd_kafka_error_is_fatal, [:pointer], :int
153+
attach_function :rd_kafka_error_is_retriable, [:pointer], :int
154+
attach_function :rd_kafka_error_txn_requires_abort, [:pointer], :int
155+
attach_function :rd_kafka_error_destroy, [:pointer], :void
156+
attach_function :rd_kafka_error_code, [:pointer], :int
143157
attach_function :rd_kafka_get_err_descs, [:pointer, :pointer], :void
144158

145159
# Configuration
@@ -210,7 +224,7 @@ class NativeErrorDesc < FFI::Struct
210224
:void, [:pointer, :int, :string, :pointer]
211225
) do |_client_prr, err_code, reason, _opaque|
212226
if Rdkafka::Config.error_callback
213-
error = Rdkafka::RdkafkaError.new(err_code, broker_message: reason)
227+
error = Rdkafka::RdkafkaError.build(err_code, broker_message: reason)
214228
error.set_backtrace(caller)
215229
Rdkafka::Config.error_callback.call(error)
216230
end
@@ -347,6 +361,11 @@ class NativeErrorDesc < FFI::Struct
347361
attach_function :rd_kafka_purge, [:pointer, :int], :int, blocking: true
348362
callback :delivery_cb, [:pointer, :pointer, :pointer], :void
349363
attach_function :rd_kafka_conf_set_dr_msg_cb, [:pointer, :delivery_cb], :void
364+
attach_function :rd_kafka_init_transactions, [:pointer, :int], :pointer, blocking: true
365+
attach_function :rd_kafka_send_offsets_to_transaction, [:pointer, :pointer, :pointer, :int], :pointer, blocking: true
366+
attach_function :rd_kafka_begin_transaction, [:pointer], :pointer, blocking: true
367+
attach_function :rd_kafka_abort_transaction, [:pointer, :int], :pointer, blocking: true
368+
attach_function :rd_kafka_commit_transaction, [:pointer, :int], :pointer, blocking: true
350369

351370
# Partitioner
352371
PARTITIONERS = %w(random consistent consistent_random murmur2 murmur2_random fnv1a fnv1a_random).each_with_object({}) do |name, hsh|

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy