@platformatic/rdkafka 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (767) hide show
  1. package/.editorconfig +5 -0
  2. package/.jshintignore +1 -0
  3. package/.jshintrc +23 -0
  4. package/CONTRIBUTING.md +237 -0
  5. package/LICENSE.txt +21 -0
  6. package/Makefile +94 -0
  7. package/README.md +630 -0
  8. package/bench/consumer-raw-rdkafka.js +76 -0
  9. package/bench/consumer-subscribe.js +77 -0
  10. package/bench/kafka-consumer-stream.js +100 -0
  11. package/bench/producer-raw-rdkafka.js +125 -0
  12. package/bench/producer-rdkafka.js +117 -0
  13. package/bench/seed.sh +38 -0
  14. package/binding.gyp +155 -0
  15. package/ci/checks/librdkafka-correct-version.js +67 -0
  16. package/ci/checks/librdkafka-exists.js +13 -0
  17. package/ci/librdkafka-defs-generator.js +193 -0
  18. package/ci/prepublish.js +3 -0
  19. package/config.d.ts +1132 -0
  20. package/configure +15 -0
  21. package/cpplint.py +6325 -0
  22. package/deploy.enc +0 -0
  23. package/deps/librdkafka/.clang-format +136 -0
  24. package/deps/librdkafka/.clang-format-cpp +103 -0
  25. package/deps/librdkafka/.dir-locals.el +10 -0
  26. package/deps/librdkafka/.formatignore +33 -0
  27. package/deps/librdkafka/.gdbmacros +19 -0
  28. package/deps/librdkafka/.semaphore/project.yml +43 -0
  29. package/deps/librdkafka/.semaphore/project_public.yml +20 -0
  30. package/deps/librdkafka/.semaphore/semaphore.yml +355 -0
  31. package/deps/librdkafka/CHANGELOG.md +1738 -0
  32. package/deps/librdkafka/CMakeLists.txt +291 -0
  33. package/deps/librdkafka/CODE_OF_CONDUCT.md +46 -0
  34. package/deps/librdkafka/CONFIGURATION.md +189 -0
  35. package/deps/librdkafka/CONTRIBUTING.md +431 -0
  36. package/deps/librdkafka/Doxyfile +2375 -0
  37. package/deps/librdkafka/INTRODUCTION.md +2173 -0
  38. package/deps/librdkafka/LICENSE +26 -0
  39. package/deps/librdkafka/LICENSE.cjson +22 -0
  40. package/deps/librdkafka/LICENSE.crc32c +28 -0
  41. package/deps/librdkafka/LICENSE.fnv1a +18 -0
  42. package/deps/librdkafka/LICENSE.hdrhistogram +27 -0
  43. package/deps/librdkafka/LICENSE.lz4 +26 -0
  44. package/deps/librdkafka/LICENSE.murmur2 +25 -0
  45. package/deps/librdkafka/LICENSE.nanopb +22 -0
  46. package/deps/librdkafka/LICENSE.opentelemetry +203 -0
  47. package/deps/librdkafka/LICENSE.pycrc +23 -0
  48. package/deps/librdkafka/LICENSE.queue +31 -0
  49. package/deps/librdkafka/LICENSE.regexp +5 -0
  50. package/deps/librdkafka/LICENSE.snappy +36 -0
  51. package/deps/librdkafka/LICENSE.tinycthread +26 -0
  52. package/deps/librdkafka/LICENSE.wingetopt +49 -0
  53. package/deps/librdkafka/LICENSES.txt +625 -0
  54. package/deps/librdkafka/Makefile +124 -0
  55. package/deps/librdkafka/README.md +199 -0
  56. package/deps/librdkafka/README.win32 +26 -0
  57. package/deps/librdkafka/STATISTICS.md +624 -0
  58. package/deps/librdkafka/configure +214 -0
  59. package/deps/librdkafka/configure.self +331 -0
  60. package/deps/librdkafka/debian/changelog +111 -0
  61. package/deps/librdkafka/debian/compat +1 -0
  62. package/deps/librdkafka/debian/control +71 -0
  63. package/deps/librdkafka/debian/copyright +99 -0
  64. package/deps/librdkafka/debian/gbp.conf +9 -0
  65. package/deps/librdkafka/debian/librdkafka++1.install +1 -0
  66. package/deps/librdkafka/debian/librdkafka-dev.examples +2 -0
  67. package/deps/librdkafka/debian/librdkafka-dev.install +9 -0
  68. package/deps/librdkafka/debian/librdkafka1.docs +5 -0
  69. package/deps/librdkafka/debian/librdkafka1.install +1 -0
  70. package/deps/librdkafka/debian/librdkafka1.symbols +135 -0
  71. package/deps/librdkafka/debian/rules +19 -0
  72. package/deps/librdkafka/debian/source/format +1 -0
  73. package/deps/librdkafka/debian/watch +2 -0
  74. package/deps/librdkafka/dev-conf.sh +123 -0
  75. package/deps/librdkafka/examples/CMakeLists.txt +79 -0
  76. package/deps/librdkafka/examples/Makefile +167 -0
  77. package/deps/librdkafka/examples/README.md +42 -0
  78. package/deps/librdkafka/examples/alter_consumer_group_offsets.c +338 -0
  79. package/deps/librdkafka/examples/consumer.c +261 -0
  80. package/deps/librdkafka/examples/delete_records.c +233 -0
  81. package/deps/librdkafka/examples/describe_cluster.c +322 -0
  82. package/deps/librdkafka/examples/describe_consumer_groups.c +436 -0
  83. package/deps/librdkafka/examples/describe_topics.c +427 -0
  84. package/deps/librdkafka/examples/elect_leaders.c +317 -0
  85. package/deps/librdkafka/examples/globals.json +11 -0
  86. package/deps/librdkafka/examples/idempotent_producer.c +344 -0
  87. package/deps/librdkafka/examples/incremental_alter_configs.c +348 -0
  88. package/deps/librdkafka/examples/kafkatest_verifiable_client.cpp +961 -0
  89. package/deps/librdkafka/examples/list_consumer_group_offsets.c +359 -0
  90. package/deps/librdkafka/examples/list_consumer_groups.c +365 -0
  91. package/deps/librdkafka/examples/list_offsets.c +327 -0
  92. package/deps/librdkafka/examples/misc.c +287 -0
  93. package/deps/librdkafka/examples/openssl_engine_example.cpp +249 -0
  94. package/deps/librdkafka/examples/producer.c +251 -0
  95. package/deps/librdkafka/examples/producer.cpp +228 -0
  96. package/deps/librdkafka/examples/rdkafka_complex_consumer_example.c +617 -0
  97. package/deps/librdkafka/examples/rdkafka_complex_consumer_example.cpp +467 -0
  98. package/deps/librdkafka/examples/rdkafka_consume_batch.cpp +264 -0
  99. package/deps/librdkafka/examples/rdkafka_example.c +853 -0
  100. package/deps/librdkafka/examples/rdkafka_example.cpp +679 -0
  101. package/deps/librdkafka/examples/rdkafka_performance.c +1781 -0
  102. package/deps/librdkafka/examples/transactions-older-broker.c +668 -0
  103. package/deps/librdkafka/examples/transactions.c +665 -0
  104. package/deps/librdkafka/examples/user_scram.c +492 -0
  105. package/deps/librdkafka/examples/win_ssl_cert_store.cpp +395 -0
  106. package/deps/librdkafka/lds-gen.py +73 -0
  107. package/deps/librdkafka/mainpage.doxy +40 -0
  108. package/deps/librdkafka/mklove/Makefile.base +329 -0
  109. package/deps/librdkafka/mklove/modules/configure.atomics +144 -0
  110. package/deps/librdkafka/mklove/modules/configure.base +2484 -0
  111. package/deps/librdkafka/mklove/modules/configure.builtin +70 -0
  112. package/deps/librdkafka/mklove/modules/configure.cc +186 -0
  113. package/deps/librdkafka/mklove/modules/configure.cxx +8 -0
  114. package/deps/librdkafka/mklove/modules/configure.fileversion +65 -0
  115. package/deps/librdkafka/mklove/modules/configure.gitversion +29 -0
  116. package/deps/librdkafka/mklove/modules/configure.good_cflags +18 -0
  117. package/deps/librdkafka/mklove/modules/configure.host +132 -0
  118. package/deps/librdkafka/mklove/modules/configure.lib +49 -0
  119. package/deps/librdkafka/mklove/modules/configure.libcurl +99 -0
  120. package/deps/librdkafka/mklove/modules/configure.libsasl2 +36 -0
  121. package/deps/librdkafka/mklove/modules/configure.libssl +147 -0
  122. package/deps/librdkafka/mklove/modules/configure.libzstd +58 -0
  123. package/deps/librdkafka/mklove/modules/configure.parseversion +95 -0
  124. package/deps/librdkafka/mklove/modules/configure.pic +16 -0
  125. package/deps/librdkafka/mklove/modules/configure.socket +20 -0
  126. package/deps/librdkafka/mklove/modules/configure.zlib +61 -0
  127. package/deps/librdkafka/mklove/modules/patches/README.md +8 -0
  128. package/deps/librdkafka/mklove/modules/patches/libcurl.0000-no-runtime-linking-check.patch +11 -0
  129. package/deps/librdkafka/mklove/modules/patches/libssl.0000-osx-rand-include-fix-OpenSSL-PR16409.patch +56 -0
  130. package/deps/librdkafka/packaging/RELEASE.md +311 -0
  131. package/deps/librdkafka/packaging/alpine/build-alpine.sh +38 -0
  132. package/deps/librdkafka/packaging/archlinux/PKGBUILD +30 -0
  133. package/deps/librdkafka/packaging/cmake/Config.cmake.in +37 -0
  134. package/deps/librdkafka/packaging/cmake/Modules/FindLZ4.cmake +38 -0
  135. package/deps/librdkafka/packaging/cmake/Modules/FindZSTD.cmake +27 -0
  136. package/deps/librdkafka/packaging/cmake/Modules/LICENSE.FindZstd +178 -0
  137. package/deps/librdkafka/packaging/cmake/README.md +38 -0
  138. package/deps/librdkafka/packaging/cmake/config.h.in +52 -0
  139. package/deps/librdkafka/packaging/cmake/parseversion.cmake +60 -0
  140. package/deps/librdkafka/packaging/cmake/rdkafka.pc.in +12 -0
  141. package/deps/librdkafka/packaging/cmake/try_compile/atomic_32_test.c +8 -0
  142. package/deps/librdkafka/packaging/cmake/try_compile/atomic_64_test.c +8 -0
  143. package/deps/librdkafka/packaging/cmake/try_compile/c11threads_test.c +14 -0
  144. package/deps/librdkafka/packaging/cmake/try_compile/crc32c_hw_test.c +27 -0
  145. package/deps/librdkafka/packaging/cmake/try_compile/dlopen_test.c +11 -0
  146. package/deps/librdkafka/packaging/cmake/try_compile/libsasl2_test.c +7 -0
  147. package/deps/librdkafka/packaging/cmake/try_compile/pthread_setname_darwin_test.c +6 -0
  148. package/deps/librdkafka/packaging/cmake/try_compile/pthread_setname_freebsd_test.c +7 -0
  149. package/deps/librdkafka/packaging/cmake/try_compile/pthread_setname_gnu_test.c +5 -0
  150. package/deps/librdkafka/packaging/cmake/try_compile/rand_r_test.c +7 -0
  151. package/deps/librdkafka/packaging/cmake/try_compile/rdkafka_setup.cmake +122 -0
  152. package/deps/librdkafka/packaging/cmake/try_compile/regex_test.c +10 -0
  153. package/deps/librdkafka/packaging/cmake/try_compile/strndup_test.c +5 -0
  154. package/deps/librdkafka/packaging/cmake/try_compile/sync_32_test.c +8 -0
  155. package/deps/librdkafka/packaging/cmake/try_compile/sync_64_test.c +8 -0
  156. package/deps/librdkafka/packaging/cp/README.md +13 -0
  157. package/deps/librdkafka/packaging/cp/check_features.c +64 -0
  158. package/deps/librdkafka/packaging/cp/verify-deb.sh +33 -0
  159. package/deps/librdkafka/packaging/cp/verify-packages.sh +48 -0
  160. package/deps/librdkafka/packaging/cp/verify-rpm.sh +39 -0
  161. package/deps/librdkafka/packaging/debian/changelog +66 -0
  162. package/deps/librdkafka/packaging/debian/compat +1 -0
  163. package/deps/librdkafka/packaging/debian/control +49 -0
  164. package/deps/librdkafka/packaging/debian/copyright +84 -0
  165. package/deps/librdkafka/packaging/debian/gbp.conf +9 -0
  166. package/deps/librdkafka/packaging/debian/librdkafka-dev.dirs +2 -0
  167. package/deps/librdkafka/packaging/debian/librdkafka-dev.examples +2 -0
  168. package/deps/librdkafka/packaging/debian/librdkafka-dev.install +6 -0
  169. package/deps/librdkafka/packaging/debian/librdkafka-dev.substvars +1 -0
  170. package/deps/librdkafka/packaging/debian/librdkafka.dsc +16 -0
  171. package/deps/librdkafka/packaging/debian/librdkafka1-dbg.substvars +1 -0
  172. package/deps/librdkafka/packaging/debian/librdkafka1.dirs +1 -0
  173. package/deps/librdkafka/packaging/debian/librdkafka1.install +2 -0
  174. package/deps/librdkafka/packaging/debian/librdkafka1.postinst.debhelper +5 -0
  175. package/deps/librdkafka/packaging/debian/librdkafka1.postrm.debhelper +5 -0
  176. package/deps/librdkafka/packaging/debian/librdkafka1.symbols +64 -0
  177. package/deps/librdkafka/packaging/debian/rules +19 -0
  178. package/deps/librdkafka/packaging/debian/source/format +1 -0
  179. package/deps/librdkafka/packaging/debian/watch +2 -0
  180. package/deps/librdkafka/packaging/get_version.py +21 -0
  181. package/deps/librdkafka/packaging/homebrew/README.md +15 -0
  182. package/deps/librdkafka/packaging/homebrew/brew-update-pr.sh +31 -0
  183. package/deps/librdkafka/packaging/mingw-w64/configure-build-msys2-mingw-static.sh +52 -0
  184. package/deps/librdkafka/packaging/mingw-w64/configure-build-msys2-mingw.sh +21 -0
  185. package/deps/librdkafka/packaging/mingw-w64/run-tests.sh +6 -0
  186. package/deps/librdkafka/packaging/mingw-w64/semaphoreci-build.sh +38 -0
  187. package/deps/librdkafka/packaging/mingw-w64/travis-before-install.sh +20 -0
  188. package/deps/librdkafka/packaging/nuget/README.md +84 -0
  189. package/deps/librdkafka/packaging/nuget/artifact.py +177 -0
  190. package/deps/librdkafka/packaging/nuget/cleanup-s3.py +143 -0
  191. package/deps/librdkafka/packaging/nuget/common/p-common__plat-windows__arch-win32__bldtype-Release/msvcr120.zip +0 -0
  192. package/deps/librdkafka/packaging/nuget/common/p-common__plat-windows__arch-win32__bldtype-Release/msvcr140.zip +0 -0
  193. package/deps/librdkafka/packaging/nuget/common/p-common__plat-windows__arch-x64__bldtype-Release/msvcr120.zip +0 -0
  194. package/deps/librdkafka/packaging/nuget/common/p-common__plat-windows__arch-x64__bldtype-Release/msvcr140.zip +0 -0
  195. package/deps/librdkafka/packaging/nuget/nuget.sh +21 -0
  196. package/deps/librdkafka/packaging/nuget/nugetpackage.py +278 -0
  197. package/deps/librdkafka/packaging/nuget/packaging.py +448 -0
  198. package/deps/librdkafka/packaging/nuget/push-to-nuget.sh +21 -0
  199. package/deps/librdkafka/packaging/nuget/release.py +167 -0
  200. package/deps/librdkafka/packaging/nuget/requirements.txt +3 -0
  201. package/deps/librdkafka/packaging/nuget/staticpackage.py +178 -0
  202. package/deps/librdkafka/packaging/nuget/templates/librdkafka.redist.nuspec +21 -0
  203. package/deps/librdkafka/packaging/nuget/templates/librdkafka.redist.props +18 -0
  204. package/deps/librdkafka/packaging/nuget/templates/librdkafka.redist.targets +19 -0
  205. package/deps/librdkafka/packaging/nuget/zfile/__init__.py +0 -0
  206. package/deps/librdkafka/packaging/nuget/zfile/zfile.py +98 -0
  207. package/deps/librdkafka/packaging/rpm/Makefile +92 -0
  208. package/deps/librdkafka/packaging/rpm/README.md +23 -0
  209. package/deps/librdkafka/packaging/rpm/el7-x86_64.cfg +40 -0
  210. package/deps/librdkafka/packaging/rpm/librdkafka.spec +118 -0
  211. package/deps/librdkafka/packaging/rpm/mock-on-docker.sh +96 -0
  212. package/deps/librdkafka/packaging/rpm/tests/Makefile +25 -0
  213. package/deps/librdkafka/packaging/rpm/tests/README.md +8 -0
  214. package/deps/librdkafka/packaging/rpm/tests/run-test.sh +42 -0
  215. package/deps/librdkafka/packaging/rpm/tests/test-on-docker.sh +56 -0
  216. package/deps/librdkafka/packaging/rpm/tests/test.c +77 -0
  217. package/deps/librdkafka/packaging/rpm/tests/test.cpp +34 -0
  218. package/deps/librdkafka/packaging/tools/build-configurations-checks.sh +10 -0
  219. package/deps/librdkafka/packaging/tools/build-deb-package.sh +64 -0
  220. package/deps/librdkafka/packaging/tools/build-debian.sh +65 -0
  221. package/deps/librdkafka/packaging/tools/build-manylinux.sh +68 -0
  222. package/deps/librdkafka/packaging/tools/build-release-artifacts.sh +139 -0
  223. package/deps/librdkafka/packaging/tools/distro-build.sh +38 -0
  224. package/deps/librdkafka/packaging/tools/gh-release-checksums.py +39 -0
  225. package/deps/librdkafka/packaging/tools/rdutcoverage.sh +25 -0
  226. package/deps/librdkafka/packaging/tools/requirements.txt +2 -0
  227. package/deps/librdkafka/packaging/tools/style-format.sh +148 -0
  228. package/deps/librdkafka/service.yml +18 -0
  229. package/deps/librdkafka/src/CMakeLists.txt +374 -0
  230. package/deps/librdkafka/src/Makefile +103 -0
  231. package/deps/librdkafka/src/README.lz4.md +30 -0
  232. package/deps/librdkafka/src/cJSON.c +2834 -0
  233. package/deps/librdkafka/src/cJSON.h +398 -0
  234. package/deps/librdkafka/src/crc32c.c +430 -0
  235. package/deps/librdkafka/src/crc32c.h +38 -0
  236. package/deps/librdkafka/src/generate_proto.sh +66 -0
  237. package/deps/librdkafka/src/librdkafka_cgrp_synch.png +0 -0
  238. package/deps/librdkafka/src/lz4.c +2727 -0
  239. package/deps/librdkafka/src/lz4.h +842 -0
  240. package/deps/librdkafka/src/lz4frame.c +2078 -0
  241. package/deps/librdkafka/src/lz4frame.h +692 -0
  242. package/deps/librdkafka/src/lz4frame_static.h +47 -0
  243. package/deps/librdkafka/src/lz4hc.c +1631 -0
  244. package/deps/librdkafka/src/lz4hc.h +413 -0
  245. package/deps/librdkafka/src/nanopb/pb.h +917 -0
  246. package/deps/librdkafka/src/nanopb/pb_common.c +388 -0
  247. package/deps/librdkafka/src/nanopb/pb_common.h +49 -0
  248. package/deps/librdkafka/src/nanopb/pb_decode.c +1727 -0
  249. package/deps/librdkafka/src/nanopb/pb_decode.h +193 -0
  250. package/deps/librdkafka/src/nanopb/pb_encode.c +1000 -0
  251. package/deps/librdkafka/src/nanopb/pb_encode.h +185 -0
  252. package/deps/librdkafka/src/opentelemetry/common.pb.c +32 -0
  253. package/deps/librdkafka/src/opentelemetry/common.pb.h +170 -0
  254. package/deps/librdkafka/src/opentelemetry/metrics.options +2 -0
  255. package/deps/librdkafka/src/opentelemetry/metrics.pb.c +67 -0
  256. package/deps/librdkafka/src/opentelemetry/metrics.pb.h +966 -0
  257. package/deps/librdkafka/src/opentelemetry/resource.pb.c +12 -0
  258. package/deps/librdkafka/src/opentelemetry/resource.pb.h +58 -0
  259. package/deps/librdkafka/src/queue.h +850 -0
  260. package/deps/librdkafka/src/rd.h +441 -0
  261. package/deps/librdkafka/src/rdaddr.c +255 -0
  262. package/deps/librdkafka/src/rdaddr.h +203 -0
  263. package/deps/librdkafka/src/rdatomic.h +226 -0
  264. package/deps/librdkafka/src/rdavg.h +259 -0
  265. package/deps/librdkafka/src/rdavl.c +210 -0
  266. package/deps/librdkafka/src/rdavl.h +250 -0
  267. package/deps/librdkafka/src/rdbase64.c +169 -0
  268. package/deps/librdkafka/src/rdbase64.h +41 -0
  269. package/deps/librdkafka/src/rdbuf.c +1884 -0
  270. package/deps/librdkafka/src/rdbuf.h +375 -0
  271. package/deps/librdkafka/src/rdcrc32.c +114 -0
  272. package/deps/librdkafka/src/rdcrc32.h +170 -0
  273. package/deps/librdkafka/src/rddl.c +179 -0
  274. package/deps/librdkafka/src/rddl.h +43 -0
  275. package/deps/librdkafka/src/rdendian.h +174 -0
  276. package/deps/librdkafka/src/rdfloat.h +67 -0
  277. package/deps/librdkafka/src/rdfnv1a.c +113 -0
  278. package/deps/librdkafka/src/rdfnv1a.h +35 -0
  279. package/deps/librdkafka/src/rdgz.c +120 -0
  280. package/deps/librdkafka/src/rdgz.h +46 -0
  281. package/deps/librdkafka/src/rdhdrhistogram.c +721 -0
  282. package/deps/librdkafka/src/rdhdrhistogram.h +87 -0
  283. package/deps/librdkafka/src/rdhttp.c +512 -0
  284. package/deps/librdkafka/src/rdhttp.h +83 -0
  285. package/deps/librdkafka/src/rdinterval.h +177 -0
  286. package/deps/librdkafka/src/rdkafka.c +5351 -0
  287. package/deps/librdkafka/src/rdkafka.h +10603 -0
  288. package/deps/librdkafka/src/rdkafka_admin.c +9417 -0
  289. package/deps/librdkafka/src/rdkafka_admin.h +619 -0
  290. package/deps/librdkafka/src/rdkafka_assignment.c +1010 -0
  291. package/deps/librdkafka/src/rdkafka_assignment.h +73 -0
  292. package/deps/librdkafka/src/rdkafka_assignor.c +1786 -0
  293. package/deps/librdkafka/src/rdkafka_assignor.h +402 -0
  294. package/deps/librdkafka/src/rdkafka_aux.c +409 -0
  295. package/deps/librdkafka/src/rdkafka_aux.h +174 -0
  296. package/deps/librdkafka/src/rdkafka_background.c +221 -0
  297. package/deps/librdkafka/src/rdkafka_broker.c +6186 -0
  298. package/deps/librdkafka/src/rdkafka_broker.h +686 -0
  299. package/deps/librdkafka/src/rdkafka_buf.c +540 -0
  300. package/deps/librdkafka/src/rdkafka_buf.h +1524 -0
  301. package/deps/librdkafka/src/rdkafka_cert.c +552 -0
  302. package/deps/librdkafka/src/rdkafka_cert.h +61 -0
  303. package/deps/librdkafka/src/rdkafka_cgrp.c +7262 -0
  304. package/deps/librdkafka/src/rdkafka_cgrp.h +443 -0
  305. package/deps/librdkafka/src/rdkafka_conf.c +4456 -0
  306. package/deps/librdkafka/src/rdkafka_conf.h +668 -0
  307. package/deps/librdkafka/src/rdkafka_confval.h +97 -0
  308. package/deps/librdkafka/src/rdkafka_coord.c +623 -0
  309. package/deps/librdkafka/src/rdkafka_coord.h +132 -0
  310. package/deps/librdkafka/src/rdkafka_error.c +228 -0
  311. package/deps/librdkafka/src/rdkafka_error.h +80 -0
  312. package/deps/librdkafka/src/rdkafka_event.c +502 -0
  313. package/deps/librdkafka/src/rdkafka_event.h +126 -0
  314. package/deps/librdkafka/src/rdkafka_feature.c +461 -0
  315. package/deps/librdkafka/src/rdkafka_feature.h +102 -0
  316. package/deps/librdkafka/src/rdkafka_fetcher.c +1402 -0
  317. package/deps/librdkafka/src/rdkafka_fetcher.h +44 -0
  318. package/deps/librdkafka/src/rdkafka_header.c +220 -0
  319. package/deps/librdkafka/src/rdkafka_header.h +76 -0
  320. package/deps/librdkafka/src/rdkafka_idempotence.c +807 -0
  321. package/deps/librdkafka/src/rdkafka_idempotence.h +144 -0
  322. package/deps/librdkafka/src/rdkafka_int.h +1222 -0
  323. package/deps/librdkafka/src/rdkafka_interceptor.c +819 -0
  324. package/deps/librdkafka/src/rdkafka_interceptor.h +104 -0
  325. package/deps/librdkafka/src/rdkafka_lz4.c +450 -0
  326. package/deps/librdkafka/src/rdkafka_lz4.h +49 -0
  327. package/deps/librdkafka/src/rdkafka_metadata.c +2124 -0
  328. package/deps/librdkafka/src/rdkafka_metadata.h +341 -0
  329. package/deps/librdkafka/src/rdkafka_metadata_cache.c +977 -0
  330. package/deps/librdkafka/src/rdkafka_mock.c +2885 -0
  331. package/deps/librdkafka/src/rdkafka_mock.h +491 -0
  332. package/deps/librdkafka/src/rdkafka_mock_cgrp.c +710 -0
  333. package/deps/librdkafka/src/rdkafka_mock_handlers.c +2817 -0
  334. package/deps/librdkafka/src/rdkafka_mock_int.h +591 -0
  335. package/deps/librdkafka/src/rdkafka_msg.c +2573 -0
  336. package/deps/librdkafka/src/rdkafka_msg.h +614 -0
  337. package/deps/librdkafka/src/rdkafka_msgbatch.h +62 -0
  338. package/deps/librdkafka/src/rdkafka_msgset.h +98 -0
  339. package/deps/librdkafka/src/rdkafka_msgset_reader.c +1806 -0
  340. package/deps/librdkafka/src/rdkafka_msgset_writer.c +1470 -0
  341. package/deps/librdkafka/src/rdkafka_offset.c +1537 -0
  342. package/deps/librdkafka/src/rdkafka_offset.h +150 -0
  343. package/deps/librdkafka/src/rdkafka_op.c +997 -0
  344. package/deps/librdkafka/src/rdkafka_op.h +834 -0
  345. package/deps/librdkafka/src/rdkafka_partition.c +4801 -0
  346. package/deps/librdkafka/src/rdkafka_partition.h +1173 -0
  347. package/deps/librdkafka/src/rdkafka_pattern.c +228 -0
  348. package/deps/librdkafka/src/rdkafka_pattern.h +70 -0
  349. package/deps/librdkafka/src/rdkafka_plugin.c +213 -0
  350. package/deps/librdkafka/src/rdkafka_plugin.h +41 -0
  351. package/deps/librdkafka/src/rdkafka_proto.h +733 -0
  352. package/deps/librdkafka/src/rdkafka_protocol.h +127 -0
  353. package/deps/librdkafka/src/rdkafka_queue.c +1153 -0
  354. package/deps/librdkafka/src/rdkafka_queue.h +1201 -0
  355. package/deps/librdkafka/src/rdkafka_range_assignor.c +1748 -0
  356. package/deps/librdkafka/src/rdkafka_request.c +6817 -0
  357. package/deps/librdkafka/src/rdkafka_request.h +709 -0
  358. package/deps/librdkafka/src/rdkafka_roundrobin_assignor.c +123 -0
  359. package/deps/librdkafka/src/rdkafka_sasl.c +528 -0
  360. package/deps/librdkafka/src/rdkafka_sasl.h +63 -0
  361. package/deps/librdkafka/src/rdkafka_sasl_cyrus.c +722 -0
  362. package/deps/librdkafka/src/rdkafka_sasl_int.h +89 -0
  363. package/deps/librdkafka/src/rdkafka_sasl_oauthbearer.c +1829 -0
  364. package/deps/librdkafka/src/rdkafka_sasl_oauthbearer.h +52 -0
  365. package/deps/librdkafka/src/rdkafka_sasl_oauthbearer_oidc.c +589 -0
  366. package/deps/librdkafka/src/rdkafka_sasl_oauthbearer_oidc.h +37 -0
  367. package/deps/librdkafka/src/rdkafka_sasl_plain.c +142 -0
  368. package/deps/librdkafka/src/rdkafka_sasl_scram.c +857 -0
  369. package/deps/librdkafka/src/rdkafka_sasl_win32.c +550 -0
  370. package/deps/librdkafka/src/rdkafka_ssl.c +1904 -0
  371. package/deps/librdkafka/src/rdkafka_ssl.h +64 -0
  372. package/deps/librdkafka/src/rdkafka_sticky_assignor.c +4781 -0
  373. package/deps/librdkafka/src/rdkafka_subscription.c +278 -0
  374. package/deps/librdkafka/src/rdkafka_telemetry.c +703 -0
  375. package/deps/librdkafka/src/rdkafka_telemetry.h +52 -0
  376. package/deps/librdkafka/src/rdkafka_telemetry_decode.c +1053 -0
  377. package/deps/librdkafka/src/rdkafka_telemetry_decode.h +59 -0
  378. package/deps/librdkafka/src/rdkafka_telemetry_encode.c +993 -0
  379. package/deps/librdkafka/src/rdkafka_telemetry_encode.h +301 -0
  380. package/deps/librdkafka/src/rdkafka_timer.c +402 -0
  381. package/deps/librdkafka/src/rdkafka_timer.h +117 -0
  382. package/deps/librdkafka/src/rdkafka_topic.c +2078 -0
  383. package/deps/librdkafka/src/rdkafka_topic.h +328 -0
  384. package/deps/librdkafka/src/rdkafka_transport.c +1297 -0
  385. package/deps/librdkafka/src/rdkafka_transport.h +94 -0
  386. package/deps/librdkafka/src/rdkafka_transport_int.h +100 -0
  387. package/deps/librdkafka/src/rdkafka_txnmgr.c +3251 -0
  388. package/deps/librdkafka/src/rdkafka_txnmgr.h +171 -0
  389. package/deps/librdkafka/src/rdkafka_zstd.c +226 -0
  390. package/deps/librdkafka/src/rdkafka_zstd.h +57 -0
  391. package/deps/librdkafka/src/rdlist.c +576 -0
  392. package/deps/librdkafka/src/rdlist.h +434 -0
  393. package/deps/librdkafka/src/rdlog.c +89 -0
  394. package/deps/librdkafka/src/rdlog.h +41 -0
  395. package/deps/librdkafka/src/rdmap.c +503 -0
  396. package/deps/librdkafka/src/rdmap.h +492 -0
  397. package/deps/librdkafka/src/rdmurmur2.c +167 -0
  398. package/deps/librdkafka/src/rdmurmur2.h +35 -0
  399. package/deps/librdkafka/src/rdports.c +61 -0
  400. package/deps/librdkafka/src/rdports.h +38 -0
  401. package/deps/librdkafka/src/rdposix.h +250 -0
  402. package/deps/librdkafka/src/rdrand.c +70 -0
  403. package/deps/librdkafka/src/rdrand.h +43 -0
  404. package/deps/librdkafka/src/rdregex.c +156 -0
  405. package/deps/librdkafka/src/rdregex.h +43 -0
  406. package/deps/librdkafka/src/rdsignal.h +57 -0
  407. package/deps/librdkafka/src/rdstring.c +645 -0
  408. package/deps/librdkafka/src/rdstring.h +98 -0
  409. package/deps/librdkafka/src/rdsysqueue.h +404 -0
  410. package/deps/librdkafka/src/rdtime.h +325 -0
  411. package/deps/librdkafka/src/rdtypes.h +86 -0
  412. package/deps/librdkafka/src/rdunittest.c +532 -0
  413. package/deps/librdkafka/src/rdunittest.h +230 -0
  414. package/deps/librdkafka/src/rdvarint.c +134 -0
  415. package/deps/librdkafka/src/rdvarint.h +165 -0
  416. package/deps/librdkafka/src/rdwin32.h +382 -0
  417. package/deps/librdkafka/src/rdxxhash.c +1030 -0
  418. package/deps/librdkafka/src/rdxxhash.h +328 -0
  419. package/deps/librdkafka/src/regexp.c +1347 -0
  420. package/deps/librdkafka/src/regexp.h +41 -0
  421. package/deps/librdkafka/src/snappy.c +1866 -0
  422. package/deps/librdkafka/src/snappy.h +62 -0
  423. package/deps/librdkafka/src/snappy_compat.h +138 -0
  424. package/deps/librdkafka/src/statistics_schema.json +444 -0
  425. package/deps/librdkafka/src/tinycthread.c +932 -0
  426. package/deps/librdkafka/src/tinycthread.h +503 -0
  427. package/deps/librdkafka/src/tinycthread_extra.c +175 -0
  428. package/deps/librdkafka/src/tinycthread_extra.h +208 -0
  429. package/deps/librdkafka/src/win32_config.h +58 -0
  430. package/deps/librdkafka/src-cpp/CMakeLists.txt +90 -0
  431. package/deps/librdkafka/src-cpp/ConfImpl.cpp +84 -0
  432. package/deps/librdkafka/src-cpp/ConsumerImpl.cpp +244 -0
  433. package/deps/librdkafka/src-cpp/HandleImpl.cpp +436 -0
  434. package/deps/librdkafka/src-cpp/HeadersImpl.cpp +48 -0
  435. package/deps/librdkafka/src-cpp/KafkaConsumerImpl.cpp +296 -0
  436. package/deps/librdkafka/src-cpp/Makefile +55 -0
  437. package/deps/librdkafka/src-cpp/MessageImpl.cpp +38 -0
  438. package/deps/librdkafka/src-cpp/MetadataImpl.cpp +170 -0
  439. package/deps/librdkafka/src-cpp/ProducerImpl.cpp +197 -0
  440. package/deps/librdkafka/src-cpp/QueueImpl.cpp +70 -0
  441. package/deps/librdkafka/src-cpp/README.md +16 -0
  442. package/deps/librdkafka/src-cpp/RdKafka.cpp +59 -0
  443. package/deps/librdkafka/src-cpp/TopicImpl.cpp +124 -0
  444. package/deps/librdkafka/src-cpp/TopicPartitionImpl.cpp +57 -0
  445. package/deps/librdkafka/src-cpp/rdkafkacpp.h +3771 -0
  446. package/deps/librdkafka/src-cpp/rdkafkacpp_int.h +1641 -0
  447. package/deps/librdkafka/tests/0000-unittests.c +72 -0
  448. package/deps/librdkafka/tests/0001-multiobj.c +98 -0
  449. package/deps/librdkafka/tests/0002-unkpart.c +244 -0
  450. package/deps/librdkafka/tests/0003-msgmaxsize.c +173 -0
  451. package/deps/librdkafka/tests/0004-conf.c +867 -0
  452. package/deps/librdkafka/tests/0005-order.c +133 -0
  453. package/deps/librdkafka/tests/0006-symbols.c +163 -0
  454. package/deps/librdkafka/tests/0007-autotopic.c +136 -0
  455. package/deps/librdkafka/tests/0008-reqacks.c +179 -0
  456. package/deps/librdkafka/tests/0009-mock_cluster.c +96 -0
  457. package/deps/librdkafka/tests/0011-produce_batch.c +752 -0
  458. package/deps/librdkafka/tests/0012-produce_consume.c +537 -0
  459. package/deps/librdkafka/tests/0013-null-msgs.c +473 -0
  460. package/deps/librdkafka/tests/0014-reconsume-191.c +512 -0
  461. package/deps/librdkafka/tests/0015-offset_seeks.c +172 -0
  462. package/deps/librdkafka/tests/0016-client_swname.c +166 -0
  463. package/deps/librdkafka/tests/0017-compression.c +142 -0
  464. package/deps/librdkafka/tests/0018-cgrp_term.c +333 -0
  465. package/deps/librdkafka/tests/0019-list_groups.c +289 -0
  466. package/deps/librdkafka/tests/0020-destroy_hang.c +162 -0
  467. package/deps/librdkafka/tests/0021-rkt_destroy.c +71 -0
  468. package/deps/librdkafka/tests/0022-consume_batch.c +276 -0
  469. package/deps/librdkafka/tests/0025-timers.c +147 -0
  470. package/deps/librdkafka/tests/0026-consume_pause.c +549 -0
  471. package/deps/librdkafka/tests/0028-long_topicnames.c +79 -0
  472. package/deps/librdkafka/tests/0029-assign_offset.c +204 -0
  473. package/deps/librdkafka/tests/0030-offset_commit.c +589 -0
  474. package/deps/librdkafka/tests/0031-get_offsets.c +235 -0
  475. package/deps/librdkafka/tests/0033-regex_subscribe.c +520 -0
  476. package/deps/librdkafka/tests/0034-offset_reset.c +377 -0
  477. package/deps/librdkafka/tests/0035-api_version.c +73 -0
  478. package/deps/librdkafka/tests/0036-partial_fetch.c +86 -0
  479. package/deps/librdkafka/tests/0037-destroy_hang_local.c +85 -0
  480. package/deps/librdkafka/tests/0038-performance.c +120 -0
  481. package/deps/librdkafka/tests/0039-event.c +284 -0
  482. package/deps/librdkafka/tests/0040-io_event.c +251 -0
  483. package/deps/librdkafka/tests/0041-fetch_max_bytes.c +96 -0
  484. package/deps/librdkafka/tests/0042-many_topics.c +252 -0
  485. package/deps/librdkafka/tests/0043-no_connection.c +77 -0
  486. package/deps/librdkafka/tests/0044-partition_cnt.c +93 -0
  487. package/deps/librdkafka/tests/0045-subscribe_update.c +746 -0
  488. package/deps/librdkafka/tests/0046-rkt_cache.c +65 -0
  489. package/deps/librdkafka/tests/0047-partial_buf_tmout.c +97 -0
  490. package/deps/librdkafka/tests/0048-partitioner.c +283 -0
  491. package/deps/librdkafka/tests/0049-consume_conn_close.c +162 -0
  492. package/deps/librdkafka/tests/0050-subscribe_adds.c +144 -0
  493. package/deps/librdkafka/tests/0051-assign_adds.c +125 -0
  494. package/deps/librdkafka/tests/0052-msg_timestamps.c +220 -0
  495. package/deps/librdkafka/tests/0053-stats_cb.cpp +535 -0
  496. package/deps/librdkafka/tests/0054-offset_time.cpp +236 -0
  497. package/deps/librdkafka/tests/0055-producer_latency.c +366 -0
  498. package/deps/librdkafka/tests/0056-balanced_group_mt.c +311 -0
  499. package/deps/librdkafka/tests/0057-invalid_topic.cpp +112 -0
  500. package/deps/librdkafka/tests/0058-log.cpp +123 -0
  501. package/deps/librdkafka/tests/0059-bsearch.cpp +237 -0
  502. package/deps/librdkafka/tests/0060-op_prio.cpp +163 -0
  503. package/deps/librdkafka/tests/0061-consumer_lag.cpp +275 -0
  504. package/deps/librdkafka/tests/0062-stats_event.c +126 -0
  505. package/deps/librdkafka/tests/0063-clusterid.cpp +180 -0
  506. package/deps/librdkafka/tests/0064-interceptors.c +481 -0
  507. package/deps/librdkafka/tests/0065-yield.cpp +140 -0
  508. package/deps/librdkafka/tests/0066-plugins.cpp +129 -0
  509. package/deps/librdkafka/tests/0067-empty_topic.cpp +148 -0
  510. package/deps/librdkafka/tests/0068-produce_timeout.c +138 -0
  511. package/deps/librdkafka/tests/0069-consumer_add_parts.c +123 -0
  512. package/deps/librdkafka/tests/0070-null_empty.cpp +197 -0
  513. package/deps/librdkafka/tests/0072-headers_ut.c +448 -0
  514. package/deps/librdkafka/tests/0073-headers.c +381 -0
  515. package/deps/librdkafka/tests/0074-producev.c +87 -0
  516. package/deps/librdkafka/tests/0075-retry.c +253 -0
  517. package/deps/librdkafka/tests/0076-produce_retry.c +450 -0
  518. package/deps/librdkafka/tests/0077-compaction.c +357 -0
  519. package/deps/librdkafka/tests/0078-c_from_cpp.cpp +96 -0
  520. package/deps/librdkafka/tests/0079-fork.c +93 -0
  521. package/deps/librdkafka/tests/0080-admin_ut.c +3065 -0
  522. package/deps/librdkafka/tests/0081-admin.c +5333 -0
  523. package/deps/librdkafka/tests/0082-fetch_max_bytes.cpp +133 -0
  524. package/deps/librdkafka/tests/0083-cb_event.c +228 -0
  525. package/deps/librdkafka/tests/0084-destroy_flags.c +212 -0
  526. package/deps/librdkafka/tests/0085-headers.cpp +388 -0
  527. package/deps/librdkafka/tests/0086-purge.c +335 -0
  528. package/deps/librdkafka/tests/0088-produce_metadata_timeout.c +162 -0
  529. package/deps/librdkafka/tests/0089-max_poll_interval.c +506 -0
  530. package/deps/librdkafka/tests/0090-idempotence.c +172 -0
  531. package/deps/librdkafka/tests/0091-max_poll_interval_timeout.c +297 -0
  532. package/deps/librdkafka/tests/0092-mixed_msgver.c +97 -0
  533. package/deps/librdkafka/tests/0093-holb.c +197 -0
  534. package/deps/librdkafka/tests/0094-idempotence_msg_timeout.c +230 -0
  535. package/deps/librdkafka/tests/0095-all_brokers_down.cpp +122 -0
  536. package/deps/librdkafka/tests/0097-ssl_verify.cpp +466 -0
  537. package/deps/librdkafka/tests/0098-consumer-txn.cpp +1218 -0
  538. package/deps/librdkafka/tests/0099-commit_metadata.c +194 -0
  539. package/deps/librdkafka/tests/0100-thread_interceptors.cpp +195 -0
  540. package/deps/librdkafka/tests/0101-fetch-from-follower.cpp +446 -0
  541. package/deps/librdkafka/tests/0102-static_group_rebalance.c +535 -0
  542. package/deps/librdkafka/tests/0103-transactions.c +1383 -0
  543. package/deps/librdkafka/tests/0104-fetch_from_follower_mock.c +624 -0
  544. package/deps/librdkafka/tests/0105-transactions_mock.c +3923 -0
  545. package/deps/librdkafka/tests/0106-cgrp_sess_timeout.c +297 -0
  546. package/deps/librdkafka/tests/0107-topic_recreate.c +259 -0
  547. package/deps/librdkafka/tests/0109-auto_create_topics.cpp +218 -0
  548. package/deps/librdkafka/tests/0110-batch_size.cpp +183 -0
  549. package/deps/librdkafka/tests/0111-delay_create_topics.cpp +127 -0
  550. package/deps/librdkafka/tests/0112-assign_unknown_part.c +98 -0
  551. package/deps/librdkafka/tests/0113-cooperative_rebalance.cpp +3329 -0
  552. package/deps/librdkafka/tests/0114-sticky_partitioning.cpp +176 -0
  553. package/deps/librdkafka/tests/0115-producer_auth.cpp +179 -0
  554. package/deps/librdkafka/tests/0116-kafkaconsumer_close.cpp +214 -0
  555. package/deps/librdkafka/tests/0117-mock_errors.c +321 -0
  556. package/deps/librdkafka/tests/0118-commit_rebalance.c +121 -0
  557. package/deps/librdkafka/tests/0119-consumer_auth.cpp +148 -0
  558. package/deps/librdkafka/tests/0120-asymmetric_subscription.c +180 -0
  559. package/deps/librdkafka/tests/0121-clusterid.c +115 -0
  560. package/deps/librdkafka/tests/0122-buffer_cleaning_after_rebalance.c +227 -0
  561. package/deps/librdkafka/tests/0123-connections_max_idle.c +98 -0
  562. package/deps/librdkafka/tests/0124-openssl_invalid_engine.c +69 -0
  563. package/deps/librdkafka/tests/0125-immediate_flush.c +144 -0
  564. package/deps/librdkafka/tests/0126-oauthbearer_oidc.c +213 -0
  565. package/deps/librdkafka/tests/0127-fetch_queue_backoff.cpp +165 -0
  566. package/deps/librdkafka/tests/0128-sasl_callback_queue.cpp +125 -0
  567. package/deps/librdkafka/tests/0129-fetch_aborted_msgs.c +78 -0
  568. package/deps/librdkafka/tests/0130-store_offsets.c +178 -0
  569. package/deps/librdkafka/tests/0131-connect_timeout.c +81 -0
  570. package/deps/librdkafka/tests/0132-strategy_ordering.c +171 -0
  571. package/deps/librdkafka/tests/0133-ssl_keys.c +128 -0
  572. package/deps/librdkafka/tests/0134-ssl_provider.c +92 -0
  573. package/deps/librdkafka/tests/0135-sasl_credentials.cpp +143 -0
  574. package/deps/librdkafka/tests/0136-resolve_cb.c +181 -0
  575. package/deps/librdkafka/tests/0137-barrier_batch_consume.c +609 -0
  576. package/deps/librdkafka/tests/0138-admin_mock.c +281 -0
  577. package/deps/librdkafka/tests/0139-offset_validation_mock.c +442 -0
  578. package/deps/librdkafka/tests/0140-commit_metadata.cpp +108 -0
  579. package/deps/librdkafka/tests/0142-reauthentication.c +495 -0
  580. package/deps/librdkafka/tests/0143-exponential_backoff_mock.c +553 -0
  581. package/deps/librdkafka/tests/0144-idempotence_mock.c +373 -0
  582. package/deps/librdkafka/tests/0145-pause_resume_mock.c +119 -0
  583. package/deps/librdkafka/tests/0146-metadata_mock.c +444 -0
  584. package/deps/librdkafka/tests/0150-telemetry_mock.c +648 -0
  585. package/deps/librdkafka/tests/1000-unktopic.c +164 -0
  586. package/deps/librdkafka/tests/8000-idle.cpp +60 -0
  587. package/deps/librdkafka/tests/8001-fetch_from_follower_mock_manual.c +113 -0
  588. package/deps/librdkafka/tests/CMakeLists.txt +164 -0
  589. package/deps/librdkafka/tests/LibrdkafkaTestApp.py +266 -0
  590. package/deps/librdkafka/tests/Makefile +182 -0
  591. package/deps/librdkafka/tests/README.md +509 -0
  592. package/deps/librdkafka/tests/autotest.sh +33 -0
  593. package/deps/librdkafka/tests/backtrace.gdb +30 -0
  594. package/deps/librdkafka/tests/broker_version_tests.py +315 -0
  595. package/deps/librdkafka/tests/buildbox.sh +17 -0
  596. package/deps/librdkafka/tests/cleanup-checker-tests.sh +20 -0
  597. package/deps/librdkafka/tests/cluster_testing.py +191 -0
  598. package/deps/librdkafka/tests/delete-test-topics.sh +56 -0
  599. package/deps/librdkafka/tests/fixtures/ssl/Makefile +8 -0
  600. package/deps/librdkafka/tests/fixtures/ssl/README.md +13 -0
  601. package/deps/librdkafka/tests/fixtures/ssl/client.keystore.p12 +0 -0
  602. package/deps/librdkafka/tests/fixtures/ssl/client2.certificate.pem +109 -0
  603. package/deps/librdkafka/tests/fixtures/ssl/client2.key +34 -0
  604. package/deps/librdkafka/tests/fixtures/ssl/create_keys.sh +93 -0
  605. package/deps/librdkafka/tests/fuzzers/Makefile +12 -0
  606. package/deps/librdkafka/tests/fuzzers/README.md +31 -0
  607. package/deps/librdkafka/tests/fuzzers/fuzz_regex.c +74 -0
  608. package/deps/librdkafka/tests/fuzzers/helpers.h +90 -0
  609. package/deps/librdkafka/tests/gen-ssl-certs.sh +165 -0
  610. package/deps/librdkafka/tests/interactive_broker_version.py +170 -0
  611. package/deps/librdkafka/tests/interceptor_test/CMakeLists.txt +16 -0
  612. package/deps/librdkafka/tests/interceptor_test/Makefile +22 -0
  613. package/deps/librdkafka/tests/interceptor_test/interceptor_test.c +314 -0
  614. package/deps/librdkafka/tests/interceptor_test/interceptor_test.h +54 -0
  615. package/deps/librdkafka/tests/java/IncrementalRebalanceCli.java +97 -0
  616. package/deps/librdkafka/tests/java/Makefile +12 -0
  617. package/deps/librdkafka/tests/java/Murmur2Cli.java +46 -0
  618. package/deps/librdkafka/tests/java/README.md +14 -0
  619. package/deps/librdkafka/tests/java/TransactionProducerCli.java +162 -0
  620. package/deps/librdkafka/tests/java/run-class.sh +11 -0
  621. package/deps/librdkafka/tests/librdkafka.suppressions +483 -0
  622. package/deps/librdkafka/tests/lz4_manual_test.sh +59 -0
  623. package/deps/librdkafka/tests/multi-broker-version-test.sh +50 -0
  624. package/deps/librdkafka/tests/parse-refcnt.sh +43 -0
  625. package/deps/librdkafka/tests/performance_plot.py +115 -0
  626. package/deps/librdkafka/tests/plugin_test/Makefile +19 -0
  627. package/deps/librdkafka/tests/plugin_test/plugin_test.c +58 -0
  628. package/deps/librdkafka/tests/requirements.txt +2 -0
  629. package/deps/librdkafka/tests/run-consumer-tests.sh +16 -0
  630. package/deps/librdkafka/tests/run-producer-tests.sh +16 -0
  631. package/deps/librdkafka/tests/run-test.sh +140 -0
  632. package/deps/librdkafka/tests/rusage.c +249 -0
  633. package/deps/librdkafka/tests/sasl_test.py +289 -0
  634. package/deps/librdkafka/tests/scenarios/README.md +6 -0
  635. package/deps/librdkafka/tests/scenarios/ak23.json +6 -0
  636. package/deps/librdkafka/tests/scenarios/default.json +5 -0
  637. package/deps/librdkafka/tests/scenarios/noautocreate.json +5 -0
  638. package/deps/librdkafka/tests/sockem.c +801 -0
  639. package/deps/librdkafka/tests/sockem.h +85 -0
  640. package/deps/librdkafka/tests/sockem_ctrl.c +145 -0
  641. package/deps/librdkafka/tests/sockem_ctrl.h +61 -0
  642. package/deps/librdkafka/tests/test.c +7318 -0
  643. package/deps/librdkafka/tests/test.conf.example +27 -0
  644. package/deps/librdkafka/tests/test.h +979 -0
  645. package/deps/librdkafka/tests/testcpp.cpp +126 -0
  646. package/deps/librdkafka/tests/testcpp.h +360 -0
  647. package/deps/librdkafka/tests/testshared.h +402 -0
  648. package/deps/librdkafka/tests/tools/README.md +4 -0
  649. package/deps/librdkafka/tests/tools/stats/README.md +21 -0
  650. package/deps/librdkafka/tests/tools/stats/filter.jq +42 -0
  651. package/deps/librdkafka/tests/tools/stats/graph.py +150 -0
  652. package/deps/librdkafka/tests/tools/stats/requirements.txt +3 -0
  653. package/deps/librdkafka/tests/tools/stats/to_csv.py +124 -0
  654. package/deps/librdkafka/tests/until-fail.sh +87 -0
  655. package/deps/librdkafka/tests/xxxx-assign_partition.c +122 -0
  656. package/deps/librdkafka/tests/xxxx-metadata.cpp +159 -0
  657. package/deps/librdkafka/vcpkg.json +23 -0
  658. package/deps/librdkafka/win32/README.md +5 -0
  659. package/deps/librdkafka/win32/build-package.bat +3 -0
  660. package/deps/librdkafka/win32/build.bat +19 -0
  661. package/deps/librdkafka/win32/common.vcxproj +84 -0
  662. package/deps/librdkafka/win32/install-openssl.ps1 +33 -0
  663. package/deps/librdkafka/win32/interceptor_test/interceptor_test.vcxproj +87 -0
  664. package/deps/librdkafka/win32/librdkafka.autopkg.template +54 -0
  665. package/deps/librdkafka/win32/librdkafka.master.testing.targets +13 -0
  666. package/deps/librdkafka/win32/librdkafka.sln +226 -0
  667. package/deps/librdkafka/win32/librdkafka.vcxproj +276 -0
  668. package/deps/librdkafka/win32/librdkafkacpp/librdkafkacpp.vcxproj +104 -0
  669. package/deps/librdkafka/win32/msbuild.ps1 +15 -0
  670. package/deps/librdkafka/win32/openssl_engine_example/openssl_engine_example.vcxproj +132 -0
  671. package/deps/librdkafka/win32/package-zip.ps1 +46 -0
  672. package/deps/librdkafka/win32/packages/repositories.config +4 -0
  673. package/deps/librdkafka/win32/push-package.bat +4 -0
  674. package/deps/librdkafka/win32/rdkafka_complex_consumer_example_cpp/rdkafka_complex_consumer_example_cpp.vcxproj +67 -0
  675. package/deps/librdkafka/win32/rdkafka_example/rdkafka_example.vcxproj +97 -0
  676. package/deps/librdkafka/win32/rdkafka_performance/rdkafka_performance.vcxproj +97 -0
  677. package/deps/librdkafka/win32/setup-msys2.ps1 +31 -0
  678. package/deps/librdkafka/win32/setup-vcpkg.ps1 +12 -0
  679. package/deps/librdkafka/win32/tests/test.conf.example +25 -0
  680. package/deps/librdkafka/win32/tests/tests.vcxproj +247 -0
  681. package/deps/librdkafka/win32/win_ssl_cert_store/win_ssl_cert_store.vcxproj +132 -0
  682. package/deps/librdkafka/win32/wingetopt.c +564 -0
  683. package/deps/librdkafka/win32/wingetopt.h +100 -0
  684. package/deps/librdkafka/win32/wintime.h +33 -0
  685. package/deps/librdkafka.gyp +62 -0
  686. package/deps/windows-install.py +73 -0
  687. package/docker-compose.yml +23 -0
  688. package/e2e/admin.spec.js +187 -0
  689. package/e2e/both.spec.js +726 -0
  690. package/e2e/consumer.spec.js +386 -0
  691. package/e2e/groups.spec.js +132 -0
  692. package/e2e/listener.js +51 -0
  693. package/e2e/producer-transaction.spec.js +333 -0
  694. package/e2e/producer.spec.js +283 -0
  695. package/errors.d.ts +347 -0
  696. package/examples/consumer-flow.md +76 -0
  697. package/examples/consumer.md +45 -0
  698. package/examples/docker-alpine.md +30 -0
  699. package/examples/high-level-producer.md +32 -0
  700. package/examples/metadata.md +27 -0
  701. package/examples/oauthbearer-default-flow.md +80 -0
  702. package/examples/producer-cluster.md +103 -0
  703. package/examples/producer.md +73 -0
  704. package/index.d.ts +357 -0
  705. package/lib/admin.js +233 -0
  706. package/lib/client.js +578 -0
  707. package/lib/error.js +472 -0
  708. package/lib/index.js +34 -0
  709. package/lib/kafka-consumer-stream.js +397 -0
  710. package/lib/kafka-consumer.js +698 -0
  711. package/lib/producer/high-level-producer.js +323 -0
  712. package/lib/producer-stream.js +307 -0
  713. package/lib/producer.js +375 -0
  714. package/lib/tools/ref-counter.js +52 -0
  715. package/lib/topic-partition.js +88 -0
  716. package/lib/topic.js +42 -0
  717. package/lib/util.js +29 -0
  718. package/librdkafka.js +12 -0
  719. package/make_docs.sh +59 -0
  720. package/package.json +53 -0
  721. package/renovate.json +30 -0
  722. package/run_docker.sh +42 -0
  723. package/src/admin.cc +624 -0
  724. package/src/admin.h +78 -0
  725. package/src/binding.cc +73 -0
  726. package/src/binding.h +25 -0
  727. package/src/callbacks.cc +614 -0
  728. package/src/callbacks.h +265 -0
  729. package/src/common.cc +582 -0
  730. package/src/common.h +134 -0
  731. package/src/config.cc +167 -0
  732. package/src/config.h +45 -0
  733. package/src/connection.cc +482 -0
  734. package/src/connection.h +108 -0
  735. package/src/errors.cc +96 -0
  736. package/src/errors.h +53 -0
  737. package/src/kafka-consumer.cc +1457 -0
  738. package/src/kafka-consumer.h +136 -0
  739. package/src/per-isolate-data.cc +57 -0
  740. package/src/per-isolate-data.h +39 -0
  741. package/src/producer.cc +873 -0
  742. package/src/producer.h +125 -0
  743. package/src/topic.cc +180 -0
  744. package/src/topic.h +56 -0
  745. package/src/workers.cc +1245 -0
  746. package/src/workers.h +511 -0
  747. package/test/binding.spec.js +66 -0
  748. package/test/consumer.spec.js +91 -0
  749. package/test/error.spec.js +8 -0
  750. package/test/index.spec.js +8 -0
  751. package/test/kafka-consumer-stream.spec.js +298 -0
  752. package/test/kafka-consumer-worker.js +51 -0
  753. package/test/kafka-consumer.spec.js +86 -0
  754. package/test/mocha.opts +1 -0
  755. package/test/mock.js +55 -0
  756. package/test/producer/high-level-producer.spec.js +496 -0
  757. package/test/producer-stream.spec.js +723 -0
  758. package/test/producer-worker.js +53 -0
  759. package/test/producer.spec.js +120 -0
  760. package/test/tools/ref-counter.spec.js +53 -0
  761. package/test/topic-partition.spec.js +104 -0
  762. package/test/util.spec.js +46 -0
  763. package/util/configure.js +30 -0
  764. package/util/get-env.js +6 -0
  765. package/util/test-compile.js +11 -0
  766. package/util/test-producer-delivery.js +100 -0
  767. package/win_install.ps1 +2 -0
@@ -0,0 +1,932 @@
1
+ /* -*- mode: c; tab-width: 2; indent-tabs-mode: nil; -*-
2
+ Copyright (c) 2012 Marcus Geelnard
3
+ Copyright (c) 2013-2014 Evan Nemerson
4
+
5
+ This software is provided 'as-is', without any express or implied
6
+ warranty. In no event will the authors be held liable for any damages
7
+ arising from the use of this software.
8
+
9
+ Permission is granted to anyone to use this software for any purpose,
10
+ including commercial applications, and to alter it and redistribute it
11
+ freely, subject to the following restrictions:
12
+
13
+ 1. The origin of this software must not be misrepresented; you must not
14
+ claim that you wrote the original software. If you use this software
15
+ in a product, an acknowledgment in the product documentation would be
16
+ appreciated but is not required.
17
+
18
+ 2. Altered source versions must be plainly marked as such, and must not be
19
+ misrepresented as being the original software.
20
+
21
+ 3. This notice may not be removed or altered from any source
22
+ distribution.
23
+ */
24
+
25
+ #include "rd.h"
26
+ #include <stdlib.h>
27
+
28
+ #if !WITH_C11THREADS
29
+
30
+ /* Platform specific includes */
31
+ #if defined(_TTHREAD_POSIX_)
32
+ #include <signal.h>
33
+ #include <sched.h>
34
+ #include <unistd.h>
35
+ #include <sys/time.h>
36
+ #include <errno.h>
37
+ #elif defined(_TTHREAD_WIN32_)
38
+ #include <process.h>
39
+ #include <sys/timeb.h>
40
+ #endif
41
+
42
+
43
+ /* Standard, good-to-have defines */
44
+ #ifndef NULL
45
+ #define NULL (void*)0
46
+ #endif
47
+ #ifndef TRUE
48
+ #define TRUE 1
49
+ #endif
50
+ #ifndef FALSE
51
+ #define FALSE 0
52
+ #endif
53
+
54
+ #ifdef __cplusplus
55
+ extern "C" {
56
+ #endif
57
+
58
+ static RD_TLS int thrd_is_detached;
59
+
60
+
61
+ int mtx_init(mtx_t *mtx, int type)
62
+ {
63
+ #if defined(_TTHREAD_WIN32_)
64
+ mtx->mAlreadyLocked = FALSE;
65
+ mtx->mRecursive = type & mtx_recursive;
66
+ mtx->mTimed = type & mtx_timed;
67
+ if (!mtx->mTimed)
68
+ {
69
+ InitializeCriticalSection(&(mtx->mHandle.cs));
70
+ }
71
+ else
72
+ {
73
+ mtx->mHandle.mut = CreateMutex(NULL, FALSE, NULL);
74
+ if (mtx->mHandle.mut == NULL)
75
+ {
76
+ return thrd_error;
77
+ }
78
+ }
79
+ return thrd_success;
80
+ #else
81
+ int ret;
82
+ pthread_mutexattr_t attr;
83
+ pthread_mutexattr_init(&attr);
84
+ if (type & mtx_recursive)
85
+ {
86
+ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
87
+ }
88
+ ret = pthread_mutex_init(mtx, &attr);
89
+ pthread_mutexattr_destroy(&attr);
90
+ return ret == 0 ? thrd_success : thrd_error;
91
+ #endif
92
+ }
93
+
94
+ void mtx_destroy(mtx_t *mtx)
95
+ {
96
+ #if defined(_TTHREAD_WIN32_)
97
+ if (!mtx->mTimed)
98
+ {
99
+ DeleteCriticalSection(&(mtx->mHandle.cs));
100
+ }
101
+ else
102
+ {
103
+ CloseHandle(mtx->mHandle.mut);
104
+ }
105
+ #else
106
+ pthread_mutex_destroy(mtx);
107
+ #endif
108
+ }
109
+
110
+ int mtx_lock(mtx_t *mtx)
111
+ {
112
+ #if defined(_TTHREAD_WIN32_)
113
+ if (!mtx->mTimed)
114
+ {
115
+ EnterCriticalSection(&(mtx->mHandle.cs));
116
+ }
117
+ else
118
+ {
119
+ switch (WaitForSingleObject(mtx->mHandle.mut, INFINITE))
120
+ {
121
+ case WAIT_OBJECT_0:
122
+ break;
123
+ case WAIT_ABANDONED:
124
+ default:
125
+ return thrd_error;
126
+ }
127
+ }
128
+
129
+ if (!mtx->mRecursive)
130
+ {
131
+ rd_assert(!mtx->mAlreadyLocked); /* Would deadlock */
132
+ mtx->mAlreadyLocked = TRUE;
133
+ }
134
+ return thrd_success;
135
+ #else
136
+ return pthread_mutex_lock(mtx) == 0 ? thrd_success : thrd_error;
137
+ #endif
138
+ }
139
+
140
+ int mtx_timedlock(mtx_t *mtx, const struct timespec *ts)
141
+ {
142
+ #if defined(_TTHREAD_WIN32_)
143
+ struct timespec current_ts;
144
+ DWORD timeoutMs;
145
+
146
+ if (!mtx->mTimed)
147
+ {
148
+ return thrd_error;
149
+ }
150
+
151
+ timespec_get(&current_ts, TIME_UTC);
152
+
153
+ if ((current_ts.tv_sec > ts->tv_sec) || ((current_ts.tv_sec == ts->tv_sec) && (current_ts.tv_nsec >= ts->tv_nsec)))
154
+ {
155
+ timeoutMs = 0;
156
+ }
157
+ else
158
+ {
159
+ timeoutMs = (DWORD)(ts->tv_sec - current_ts.tv_sec) * 1000;
160
+ timeoutMs += (ts->tv_nsec - current_ts.tv_nsec) / 1000000;
161
+ timeoutMs += 1;
162
+ }
163
+
164
+ /* TODO: the timeout for WaitForSingleObject doesn't include time
165
+ while the computer is asleep. */
166
+ switch (WaitForSingleObject(mtx->mHandle.mut, timeoutMs))
167
+ {
168
+ case WAIT_OBJECT_0:
169
+ break;
170
+ case WAIT_TIMEOUT:
171
+ return thrd_timedout;
172
+ case WAIT_ABANDONED:
173
+ default:
174
+ return thrd_error;
175
+ }
176
+
177
+ if (!mtx->mRecursive)
178
+ {
179
+ rd_assert(!mtx->mAlreadyLocked); /* Would deadlock */
180
+ mtx->mAlreadyLocked = TRUE;
181
+ }
182
+
183
+ return thrd_success;
184
+ #elif defined(_POSIX_TIMEOUTS) && (_POSIX_TIMEOUTS >= 200112L) && defined(_POSIX_THREADS) && (_POSIX_THREADS >= 200112L)
185
+ switch (pthread_mutex_timedlock(mtx, ts)) {
186
+ case 0:
187
+ return thrd_success;
188
+ case ETIMEDOUT:
189
+ return thrd_timedout;
190
+ default:
191
+ return thrd_error;
192
+ }
193
+ #else
194
+ int rc;
195
+ struct timespec cur, dur;
196
+
197
+ /* Try to acquire the lock and, if we fail, sleep for 5ms. */
198
+ while ((rc = pthread_mutex_trylock (mtx)) == EBUSY) {
199
+ timespec_get(&cur, TIME_UTC);
200
+
201
+ if ((cur.tv_sec > ts->tv_sec) || ((cur.tv_sec == ts->tv_sec) && (cur.tv_nsec >= ts->tv_nsec)))
202
+ {
203
+ break;
204
+ }
205
+
206
+ dur.tv_sec = ts->tv_sec - cur.tv_sec;
207
+ dur.tv_nsec = ts->tv_nsec - cur.tv_nsec;
208
+ if (dur.tv_nsec < 0)
209
+ {
210
+ dur.tv_sec--;
211
+ dur.tv_nsec += 1000000000;
212
+ }
213
+
214
+ if ((dur.tv_sec != 0) || (dur.tv_nsec > 5000000))
215
+ {
216
+ dur.tv_sec = 0;
217
+ dur.tv_nsec = 5000000;
218
+ }
219
+
220
+ nanosleep(&dur, NULL);
221
+ }
222
+
223
+ switch (rc) {
224
+ case 0:
225
+ return thrd_success;
226
+ case ETIMEDOUT:
227
+ case EBUSY:
228
+ return thrd_timedout;
229
+ default:
230
+ return thrd_error;
231
+ }
232
+ #endif
233
+ }
234
+
235
+ int mtx_trylock(mtx_t *mtx)
236
+ {
237
+ #if defined(_TTHREAD_WIN32_)
238
+ int ret;
239
+
240
+ if (!mtx->mTimed)
241
+ {
242
+ ret = TryEnterCriticalSection(&(mtx->mHandle.cs)) ? thrd_success : thrd_busy;
243
+ }
244
+ else
245
+ {
246
+ ret = (WaitForSingleObject(mtx->mHandle.mut, 0) == WAIT_OBJECT_0) ? thrd_success : thrd_busy;
247
+ }
248
+
249
+ if ((!mtx->mRecursive) && (ret == thrd_success))
250
+ {
251
+ if (mtx->mAlreadyLocked)
252
+ {
253
+ LeaveCriticalSection(&(mtx->mHandle.cs));
254
+ ret = thrd_busy;
255
+ }
256
+ else
257
+ {
258
+ mtx->mAlreadyLocked = TRUE;
259
+ }
260
+ }
261
+ return ret;
262
+ #else
263
+ return (pthread_mutex_trylock(mtx) == 0) ? thrd_success : thrd_busy;
264
+ #endif
265
+ }
266
+
267
+ int mtx_unlock(mtx_t *mtx)
268
+ {
269
+ #if defined(_TTHREAD_WIN32_)
270
+ mtx->mAlreadyLocked = FALSE;
271
+ if (!mtx->mTimed)
272
+ {
273
+ LeaveCriticalSection(&(mtx->mHandle.cs));
274
+ }
275
+ else
276
+ {
277
+ if (!ReleaseMutex(mtx->mHandle.mut))
278
+ {
279
+ return thrd_error;
280
+ }
281
+ }
282
+ return thrd_success;
283
+ #else
284
+ return pthread_mutex_unlock(mtx) == 0 ? thrd_success : thrd_error;;
285
+ #endif
286
+ }
287
+
288
+ #if defined(_TTHREAD_WIN32_)
289
+ #define _CONDITION_EVENT_ONE 0
290
+ #define _CONDITION_EVENT_ALL 1
291
+ #endif
292
+
293
+ int cnd_init(cnd_t *cond)
294
+ {
295
+ #if defined(_TTHREAD_WIN32_)
296
+ cond->mWaitersCount = 0;
297
+
298
+ /* Init critical section */
299
+ InitializeCriticalSection(&cond->mWaitersCountLock);
300
+
301
+ /* Init events */
302
+ cond->mEvents[_CONDITION_EVENT_ONE] = CreateEvent(NULL, FALSE, FALSE, NULL);
303
+ if (cond->mEvents[_CONDITION_EVENT_ONE] == NULL)
304
+ {
305
+ cond->mEvents[_CONDITION_EVENT_ALL] = NULL;
306
+ return thrd_error;
307
+ }
308
+ cond->mEvents[_CONDITION_EVENT_ALL] = CreateEvent(NULL, TRUE, FALSE, NULL);
309
+ if (cond->mEvents[_CONDITION_EVENT_ALL] == NULL)
310
+ {
311
+ CloseHandle(cond->mEvents[_CONDITION_EVENT_ONE]);
312
+ cond->mEvents[_CONDITION_EVENT_ONE] = NULL;
313
+ return thrd_error;
314
+ }
315
+
316
+ return thrd_success;
317
+ #else
318
+ return pthread_cond_init(cond, NULL) == 0 ? thrd_success : thrd_error;
319
+ #endif
320
+ }
321
+
322
+ void cnd_destroy(cnd_t *cond)
323
+ {
324
+ #if defined(_TTHREAD_WIN32_)
325
+ if (cond->mEvents[_CONDITION_EVENT_ONE] != NULL)
326
+ {
327
+ CloseHandle(cond->mEvents[_CONDITION_EVENT_ONE]);
328
+ }
329
+ if (cond->mEvents[_CONDITION_EVENT_ALL] != NULL)
330
+ {
331
+ CloseHandle(cond->mEvents[_CONDITION_EVENT_ALL]);
332
+ }
333
+ DeleteCriticalSection(&cond->mWaitersCountLock);
334
+ #else
335
+ pthread_cond_destroy(cond);
336
+ #endif
337
+ }
338
+
339
+ int cnd_signal(cnd_t *cond)
340
+ {
341
+ #if defined(_TTHREAD_WIN32_)
342
+ int haveWaiters;
343
+
344
+ /* Are there any waiters? */
345
+ EnterCriticalSection(&cond->mWaitersCountLock);
346
+ haveWaiters = (cond->mWaitersCount > 0);
347
+ LeaveCriticalSection(&cond->mWaitersCountLock);
348
+
349
+ /* If we have any waiting threads, send them a signal */
350
+ if(haveWaiters)
351
+ {
352
+ if (SetEvent(cond->mEvents[_CONDITION_EVENT_ONE]) == 0)
353
+ {
354
+ return thrd_error;
355
+ }
356
+ }
357
+
358
+ return thrd_success;
359
+ #else
360
+ return pthread_cond_signal(cond) == 0 ? thrd_success : thrd_error;
361
+ #endif
362
+ }
363
+
364
+ int cnd_broadcast(cnd_t *cond)
365
+ {
366
+ #if defined(_TTHREAD_WIN32_)
367
+ int haveWaiters;
368
+
369
+ /* Are there any waiters? */
370
+ EnterCriticalSection(&cond->mWaitersCountLock);
371
+ haveWaiters = (cond->mWaitersCount > 0);
372
+ LeaveCriticalSection(&cond->mWaitersCountLock);
373
+
374
+ /* If we have any waiting threads, send them a signal */
375
+ if(haveWaiters)
376
+ {
377
+ if (SetEvent(cond->mEvents[_CONDITION_EVENT_ALL]) == 0)
378
+ {
379
+ return thrd_error;
380
+ }
381
+ }
382
+
383
+ return thrd_success;
384
+ #else
385
+ return pthread_cond_broadcast(cond) == 0 ? thrd_success : thrd_error;
386
+ #endif
387
+ }
388
+
389
+ #if defined(_TTHREAD_WIN32_)
390
+ int _cnd_timedwait_win32(cnd_t *cond, mtx_t *mtx, DWORD timeout)
391
+ {
392
+ int result, lastWaiter;
393
+
394
+ /* Increment number of waiters */
395
+ EnterCriticalSection(&cond->mWaitersCountLock);
396
+ ++ cond->mWaitersCount;
397
+ LeaveCriticalSection(&cond->mWaitersCountLock);
398
+
399
+ /* Release the mutex while waiting for the condition (will decrease
400
+ the number of waiters when done)... */
401
+ mtx_unlock(mtx);
402
+
403
+ /* Wait for either event to become signaled due to cnd_signal() or
404
+ cnd_broadcast() being called */
405
+ result = WaitForMultipleObjects(2, cond->mEvents, FALSE, timeout);
406
+
407
+ /* Check if we are the last waiter */
408
+ EnterCriticalSection(&cond->mWaitersCountLock);
409
+ -- cond->mWaitersCount;
410
+ lastWaiter = (result == (WAIT_OBJECT_0 + _CONDITION_EVENT_ALL)) &&
411
+ (cond->mWaitersCount == 0);
412
+ LeaveCriticalSection(&cond->mWaitersCountLock);
413
+
414
+ /* If we are the last waiter to be notified to stop waiting, reset the event */
415
+ if (lastWaiter)
416
+ {
417
+ if (ResetEvent(cond->mEvents[_CONDITION_EVENT_ALL]) == 0)
418
+ {
419
+ /* The mutex is locked again before the function returns, even if an error occurred */
420
+ mtx_lock(mtx);
421
+ return thrd_error;
422
+ }
423
+ }
424
+
425
+ /* The mutex is locked again before the function returns, even if an error occurred */
426
+ mtx_lock(mtx);
427
+
428
+ if (result == WAIT_TIMEOUT)
429
+ return thrd_timedout;
430
+ else if (result == (int)WAIT_FAILED)
431
+ return thrd_error;
432
+
433
+ return thrd_success;
434
+ }
435
+ #endif
436
+
437
+ int cnd_wait(cnd_t *cond, mtx_t *mtx)
438
+ {
439
+ #if defined(_TTHREAD_WIN32_)
440
+ return _cnd_timedwait_win32(cond, mtx, INFINITE);
441
+ #else
442
+ return pthread_cond_wait(cond, mtx) == 0 ? thrd_success : thrd_error;
443
+ #endif
444
+ }
445
+
446
+ int cnd_timedwait(cnd_t *cond, mtx_t *mtx, const struct timespec *ts)
447
+ {
448
+ #if defined(_TTHREAD_WIN32_)
449
+ struct timespec now;
450
+ if (timespec_get(&now, TIME_UTC) == TIME_UTC)
451
+ {
452
+ unsigned long long nowInMilliseconds = now.tv_sec * 1000 + now.tv_nsec / 1000000;
453
+ unsigned long long tsInMilliseconds = ts->tv_sec * 1000 + ts->tv_nsec / 1000000;
454
+ DWORD delta = (tsInMilliseconds > nowInMilliseconds) ?
455
+ (DWORD)(tsInMilliseconds - nowInMilliseconds) : 0;
456
+ return _cnd_timedwait_win32(cond, mtx, delta);
457
+ }
458
+ else
459
+ return thrd_error;
460
+ #else
461
+ int ret;
462
+ ret = pthread_cond_timedwait(cond, mtx, ts);
463
+ if (ret == ETIMEDOUT)
464
+ {
465
+ return thrd_timedout;
466
+ }
467
+ return ret == 0 ? thrd_success : thrd_error;
468
+ #endif
469
+ }
470
+
471
+
472
+
473
+ #if defined(_TTHREAD_WIN32_)
474
+ struct TinyCThreadTSSData {
475
+ void* value;
476
+ tss_t key;
477
+ struct TinyCThreadTSSData* next;
478
+ };
479
+
480
+ static tss_dtor_t _tinycthread_tss_dtors[1088] = { NULL, };
481
+
482
+ static _Thread_local struct TinyCThreadTSSData* _tinycthread_tss_head = NULL;
483
+ static _Thread_local struct TinyCThreadTSSData* _tinycthread_tss_tail = NULL;
484
+
485
+ static void _tinycthread_tss_cleanup (void);
486
+
487
+ static void _tinycthread_tss_cleanup (void) {
488
+ struct TinyCThreadTSSData* data;
489
+ int iteration;
490
+ unsigned int again = 1;
491
+ void* value;
492
+
493
+ for (iteration = 0 ; iteration < TSS_DTOR_ITERATIONS && again > 0 ; iteration++)
494
+ {
495
+ again = 0;
496
+ for (data = _tinycthread_tss_head ; data != NULL ; data = data->next)
497
+ {
498
+ if (data->value != NULL)
499
+ {
500
+ value = data->value;
501
+ data->value = NULL;
502
+
503
+ if (_tinycthread_tss_dtors[data->key] != NULL)
504
+ {
505
+ again = 1;
506
+ _tinycthread_tss_dtors[data->key](value);
507
+ }
508
+ }
509
+ }
510
+ }
511
+
512
+ while (_tinycthread_tss_head != NULL) {
513
+ data = _tinycthread_tss_head->next;
514
+ rd_free (_tinycthread_tss_head);
515
+ _tinycthread_tss_head = data;
516
+ }
517
+ _tinycthread_tss_head = NULL;
518
+ _tinycthread_tss_tail = NULL;
519
+ }
520
+
521
+ static void NTAPI _tinycthread_tss_callback(PVOID h, DWORD dwReason, PVOID pv)
522
+ {
523
+ (void)h;
524
+ (void)pv;
525
+
526
+ if (_tinycthread_tss_head != NULL && (dwReason == DLL_THREAD_DETACH || dwReason == DLL_PROCESS_DETACH))
527
+ {
528
+ _tinycthread_tss_cleanup();
529
+ }
530
+ }
531
+
532
+ #ifdef _WIN32
533
+ #ifdef _M_X64
534
+ #pragma const_seg(".CRT$XLB")
535
+ #else
536
+ #pragma data_seg(".CRT$XLB")
537
+ #endif
538
+ PIMAGE_TLS_CALLBACK p_thread_callback = _tinycthread_tss_callback;
539
+ #ifdef _M_X64
540
+ #pragma const_seg()
541
+ #else
542
+ #pragma data_seg()
543
+ #endif
544
+ #else
545
+ PIMAGE_TLS_CALLBACK p_thread_callback __attribute__((section(".CRT$XLB"))) = _tinycthread_tss_callback;
546
+ #endif
547
+
548
+ #endif /* defined(_TTHREAD_WIN32_) */
549
+
550
+ /** Information to pass to the new thread (what to run). */
551
+ typedef struct {
552
+ thrd_start_t mFunction; /**< Pointer to the function to be executed. */
553
+ void * mArg; /**< Function argument for the thread function. */
554
+ } _thread_start_info;
555
+
556
+ /* Thread wrapper function. */
557
+ #if defined(_TTHREAD_WIN32_)
558
+ static DWORD WINAPI _thrd_wrapper_function(LPVOID aArg)
559
+ #elif defined(_TTHREAD_POSIX_)
560
+ static void * _thrd_wrapper_function(void * aArg)
561
+ #endif
562
+ {
563
+ thrd_start_t fun;
564
+ void *arg;
565
+ int res;
566
+
567
+ /* Get thread startup information */
568
+ _thread_start_info *ti = (_thread_start_info *) aArg;
569
+ fun = ti->mFunction;
570
+ arg = ti->mArg;
571
+
572
+ /* The thread is responsible for freeing the startup information */
573
+ rd_free((void *)ti);
574
+
575
+ /* Call the actual client thread function */
576
+ res = fun(arg);
577
+
578
+ #if defined(_TTHREAD_WIN32_)
579
+ if (_tinycthread_tss_head != NULL)
580
+ {
581
+ _tinycthread_tss_cleanup();
582
+ }
583
+
584
+ return (DWORD)res;
585
+ #else
586
+ return (void*)(intptr_t)res;
587
+ #endif
588
+ }
589
+
590
+ int thrd_create(thrd_t *thr, thrd_start_t func, void *arg)
591
+ {
592
+ /* Fill out the thread startup information (passed to the thread wrapper,
593
+ which will eventually free it) */
594
+ _thread_start_info* ti = (_thread_start_info*)rd_malloc(sizeof(_thread_start_info));
595
+ if (ti == NULL)
596
+ {
597
+ return thrd_nomem;
598
+ }
599
+ ti->mFunction = func;
600
+ ti->mArg = arg;
601
+
602
+ /* Create the thread */
603
+ #if defined(_TTHREAD_WIN32_)
604
+ *thr = CreateThread(NULL, 0, _thrd_wrapper_function, (LPVOID) ti, 0, NULL);
605
+ #elif defined(_TTHREAD_POSIX_)
606
+ {
607
+ int err;
608
+ if((err = pthread_create(thr, NULL, _thrd_wrapper_function,
609
+ (void *)ti)) != 0) {
610
+ errno = err;
611
+ *thr = 0;
612
+ }
613
+ }
614
+ #endif
615
+
616
+ /* Did we fail to create the thread? */
617
+ if(!*thr)
618
+ {
619
+ rd_free(ti);
620
+ return thrd_error;
621
+ }
622
+
623
+ return thrd_success;
624
+ }
625
+
626
+ thrd_t thrd_current(void)
627
+ {
628
+ #if defined(_TTHREAD_WIN32_)
629
+ return GetCurrentThread();
630
+ #else
631
+ return pthread_self();
632
+ #endif
633
+ }
634
+
635
+ int thrd_detach(thrd_t thr)
636
+ {
637
+ thrd_is_detached = 1;
638
+ #if defined(_TTHREAD_WIN32_)
639
+ /* https://stackoverflow.com/questions/12744324/how-to-detach-a-thread-on-windows-c#answer-12746081 */
640
+ return CloseHandle(thr) != 0 ? thrd_success : thrd_error;
641
+ #else
642
+ return pthread_detach(thr) == 0 ? thrd_success : thrd_error;
643
+ #endif
644
+ }
645
+
646
+ int thrd_equal(thrd_t thr0, thrd_t thr1)
647
+ {
648
+ #if defined(_TTHREAD_WIN32_)
649
+ return thr0 == thr1;
650
+ #else
651
+ return pthread_equal(thr0, thr1);
652
+ #endif
653
+ }
654
+
655
+ void thrd_exit(int res)
656
+ {
657
+ #if defined(_TTHREAD_WIN32_)
658
+ if (_tinycthread_tss_head != NULL)
659
+ {
660
+ _tinycthread_tss_cleanup();
661
+ }
662
+
663
+ ExitThread(res);
664
+ #else
665
+ pthread_exit((void*)(intptr_t)res);
666
+ #endif
667
+ }
668
+
669
+ int thrd_join(thrd_t thr, int *res)
670
+ {
671
+ #if defined(_TTHREAD_WIN32_)
672
+ DWORD dwRes;
673
+
674
+ if (WaitForSingleObject(thr, INFINITE) == WAIT_FAILED)
675
+ {
676
+ return thrd_error;
677
+ }
678
+ if (res != NULL)
679
+ {
680
+ if (GetExitCodeThread(thr, &dwRes) != 0)
681
+ {
682
+ *res = dwRes;
683
+ }
684
+ else
685
+ {
686
+ return thrd_error;
687
+ }
688
+ }
689
+ CloseHandle(thr);
690
+ #elif defined(_TTHREAD_POSIX_)
691
+ void *pres;
692
+ if (pthread_join(thr, &pres) != 0)
693
+ {
694
+ return thrd_error;
695
+ }
696
+ if (res != NULL)
697
+ {
698
+ *res = (int)(intptr_t)pres;
699
+ }
700
+ #endif
701
+ return thrd_success;
702
+ }
703
+
704
+ int thrd_sleep(const struct timespec *duration, struct timespec *remaining)
705
+ {
706
+ #if !defined(_TTHREAD_WIN32_)
707
+ return nanosleep(duration, remaining);
708
+ #else
709
+ struct timespec start;
710
+ DWORD t;
711
+
712
+ timespec_get(&start, TIME_UTC);
713
+
714
+ t = SleepEx((DWORD)(duration->tv_sec * 1000 +
715
+ duration->tv_nsec / 1000000 +
716
+ (((duration->tv_nsec % 1000000) == 0) ? 0 : 1)),
717
+ TRUE);
718
+
719
+ if (t == 0) {
720
+ return 0;
721
+ } else if (remaining != NULL) {
722
+ timespec_get(remaining, TIME_UTC);
723
+ remaining->tv_sec -= start.tv_sec;
724
+ remaining->tv_nsec -= start.tv_nsec;
725
+ if (remaining->tv_nsec < 0)
726
+ {
727
+ remaining->tv_nsec += 1000000000;
728
+ remaining->tv_sec -= 1;
729
+ }
730
+ } else {
731
+ return -1;
732
+ }
733
+
734
+ return 0;
735
+ #endif
736
+ }
737
+
738
+ void thrd_yield(void)
739
+ {
740
+ #if defined(_TTHREAD_WIN32_)
741
+ Sleep(0);
742
+ #else
743
+ sched_yield();
744
+ #endif
745
+ }
746
+
747
+ int tss_create(tss_t *key, tss_dtor_t dtor)
748
+ {
749
+ #if defined(_TTHREAD_WIN32_)
750
+ *key = TlsAlloc();
751
+ if (*key == TLS_OUT_OF_INDEXES)
752
+ {
753
+ return thrd_error;
754
+ }
755
+ _tinycthread_tss_dtors[*key] = dtor;
756
+ #else
757
+ if (pthread_key_create(key, dtor) != 0)
758
+ {
759
+ return thrd_error;
760
+ }
761
+ #endif
762
+ return thrd_success;
763
+ }
764
+
765
+ void tss_delete(tss_t key)
766
+ {
767
+ #if defined(_TTHREAD_WIN32_)
768
+ struct TinyCThreadTSSData* data = (struct TinyCThreadTSSData*) TlsGetValue (key);
769
+ struct TinyCThreadTSSData* prev = NULL;
770
+ if (data != NULL)
771
+ {
772
+ if (data == _tinycthread_tss_head)
773
+ {
774
+ _tinycthread_tss_head = data->next;
775
+ }
776
+ else
777
+ {
778
+ prev = _tinycthread_tss_head;
779
+ if (prev != NULL)
780
+ {
781
+ while (prev->next != data)
782
+ {
783
+ prev = prev->next;
784
+ }
785
+ }
786
+ }
787
+
788
+ if (data == _tinycthread_tss_tail)
789
+ {
790
+ _tinycthread_tss_tail = prev;
791
+ }
792
+
793
+ rd_free (data);
794
+ }
795
+ _tinycthread_tss_dtors[key] = NULL;
796
+ TlsFree(key);
797
+ #else
798
+ pthread_key_delete(key);
799
+ #endif
800
+ }
801
+
802
+ void *tss_get(tss_t key)
803
+ {
804
+ #if defined(_TTHREAD_WIN32_)
805
+ struct TinyCThreadTSSData* data = (struct TinyCThreadTSSData*)TlsGetValue(key);
806
+ if (data == NULL)
807
+ {
808
+ return NULL;
809
+ }
810
+ return data->value;
811
+ #else
812
+ return pthread_getspecific(key);
813
+ #endif
814
+ }
815
+
816
+ int tss_set(tss_t key, void *val)
817
+ {
818
+ #if defined(_TTHREAD_WIN32_)
819
+ struct TinyCThreadTSSData* data = (struct TinyCThreadTSSData*)TlsGetValue(key);
820
+ if (data == NULL)
821
+ {
822
+ data = (struct TinyCThreadTSSData*)rd_malloc(sizeof(struct TinyCThreadTSSData));
823
+ if (data == NULL)
824
+ {
825
+ return thrd_error;
826
+ }
827
+
828
+ data->value = NULL;
829
+ data->key = key;
830
+ data->next = NULL;
831
+
832
+ if (_tinycthread_tss_tail != NULL)
833
+ {
834
+ _tinycthread_tss_tail->next = data;
835
+ }
836
+ else
837
+ {
838
+ _tinycthread_tss_tail = data;
839
+ }
840
+
841
+ if (_tinycthread_tss_head == NULL)
842
+ {
843
+ _tinycthread_tss_head = data;
844
+ }
845
+
846
+ if (!TlsSetValue(key, data))
847
+ {
848
+ rd_free (data);
849
+ return thrd_error;
850
+ }
851
+ }
852
+ data->value = val;
853
+ #else
854
+ if (pthread_setspecific(key, val) != 0)
855
+ {
856
+ return thrd_error;
857
+ }
858
+ #endif
859
+ return thrd_success;
860
+ }
861
+
862
+ #if defined(_TTHREAD_EMULATE_TIMESPEC_GET_)
863
+ int _tthread_timespec_get(struct timespec *ts, int base)
864
+ {
865
+ #if defined(_TTHREAD_WIN32_)
866
+ struct _timeb tb;
867
+ #elif !defined(CLOCK_REALTIME)
868
+ struct timeval tv;
869
+ #endif
870
+
871
+ if (base != TIME_UTC)
872
+ {
873
+ return 0;
874
+ }
875
+
876
+ #if defined(_TTHREAD_WIN32_)
877
+ _ftime_s(&tb);
878
+ ts->tv_sec = (time_t)tb.time;
879
+ ts->tv_nsec = 1000000L * (long)tb.millitm;
880
+ #elif defined(CLOCK_REALTIME)
881
+ base = (clock_gettime(CLOCK_REALTIME, ts) == 0) ? base : 0;
882
+ #else
883
+ gettimeofday(&tv, NULL);
884
+ ts->tv_sec = (time_t)tv.tv_sec;
885
+ ts->tv_nsec = 1000L * (long)tv.tv_usec;
886
+ #endif
887
+
888
+ return base;
889
+ }
890
+ #endif /* _TTHREAD_EMULATE_TIMESPEC_GET_ */
891
+
892
+ #if defined(_TTHREAD_WIN32_)
893
+ void call_once(once_flag *flag, void (*func)(void))
894
+ {
895
+ /* The idea here is that we use a spin lock (via the
896
+ InterlockedCompareExchange function) to restrict access to the
897
+ critical section until we have initialized it, then we use the
898
+ critical section to block until the callback has completed
899
+ execution. */
900
+ while (flag->status < 3)
901
+ {
902
+ switch (flag->status)
903
+ {
904
+ case 0:
905
+ if (InterlockedCompareExchange (&(flag->status), 1, 0) == 0) {
906
+ InitializeCriticalSection(&(flag->lock));
907
+ EnterCriticalSection(&(flag->lock));
908
+ flag->status = 2;
909
+ func();
910
+ flag->status = 3;
911
+ LeaveCriticalSection(&(flag->lock));
912
+ return;
913
+ }
914
+ break;
915
+ case 1:
916
+ break;
917
+ case 2:
918
+ EnterCriticalSection(&(flag->lock));
919
+ LeaveCriticalSection(&(flag->lock));
920
+ break;
921
+ }
922
+ }
923
+ }
924
+ #endif /* defined(_TTHREAD_WIN32_) */
925
+
926
+
927
+
928
+ #ifdef __cplusplus
929
+ }
930
+ #endif
931
+
932
+ #endif /* !WITH_C11THREADS */