phobos 2.1.5 → 2.1.6

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.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phobos
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.5
4
+ version: 2.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Túlio Ornelas
@@ -15,7 +15,7 @@ authors:
15
15
  autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
- date: 2022-09-08 00:00:00.000000000 Z
18
+ date: 2023-08-31 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: bundler
@@ -115,6 +115,20 @@ dependencies:
115
115
  - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
+ - !ruby/object:Gem::Dependency
119
+ name: sorbet
120
+ requirement: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ type: :development
126
+ prerelease: false
127
+ version_requirements: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
118
132
  - !ruby/object:Gem::Dependency
119
133
  name: sord
120
134
  requirement: !ruby/object:Gem::Requirement
@@ -129,6 +143,20 @@ dependencies:
129
143
  - - ">="
130
144
  - !ruby/object:Gem::Version
131
145
  version: '0'
146
+ - !ruby/object:Gem::Dependency
147
+ name: tapioca
148
+ requirement: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ type: :development
154
+ prerelease: false
155
+ version_requirements: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
132
160
  - !ruby/object:Gem::Dependency
133
161
  name: timecop
134
162
  requirement: !ruby/object:Gem::Requirement
@@ -274,6 +302,7 @@ extra_rdoc_files: []
274
302
  files:
275
303
  - ".dockerignore"
276
304
  - ".env"
305
+ - ".gitattributes"
277
306
  - ".gitignore"
278
307
  - ".rspec"
279
308
  - ".rubocop.yml"
@@ -291,7 +320,9 @@ files:
291
320
  - bin/console
292
321
  - bin/phobos
293
322
  - bin/setup
323
+ - bin/tapioca
294
324
  - config/phobos.yml.example
325
+ - defs.rbi
295
326
  - docker-compose.yml
296
327
  - examples/handler_saving_events_database.rb
297
328
  - examples/handler_using_async_producer.rb
@@ -322,8 +353,7 @@ files:
322
353
  - lib/phobos/version.rb
323
354
  - logo.png
324
355
  - phobos.gemspec
325
- - sig/defs.rbs
326
- - sig/kafka.rbs
356
+ - rbi/defs.rbi
327
357
  - utils/create-topic.sh
328
358
  homepage: https://github.com/klarna/phobos
329
359
  licenses:
@@ -345,7 +375,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
345
375
  - !ruby/object:Gem::Version
346
376
  version: '0'
347
377
  requirements: []
348
- rubygems_version: 3.3.21
378
+ rubygems_version: 3.3.3
349
379
  signing_key:
350
380
  specification_version: 4
351
381
  summary: Simplifying Kafka for ruby apps
data/sig/defs.rbs DELETED
@@ -1,459 +0,0 @@
1
- # Please use this with at least the same consideration as you would when using OpenStruct.
2
- # Right now we only use this to parse our internal configuration files. It is not meant to
3
- # be used on incoming data.
4
- module Phobos
5
- extend Phobos::Configuration
6
- VERSION: String
7
-
8
- # _@param_ `configuration`
9
- def self.add_listeners: (::Hash[String, Object] configuration) -> void
10
-
11
- # _@param_ `config_key`
12
- def self.create_kafka_client: (?String? config_key) -> untyped
13
-
14
- # _@param_ `backoff_config`
15
- def self.create_exponential_backoff: (?::Hash[Symbol, Integer]? backoff_config) -> untyped
16
-
17
- # _@param_ `message`
18
- def self.deprecate: (String message) -> void
19
-
20
- # _@param_ `configuration`
21
- def self.configure: (untyped configuration) -> void
22
-
23
- def self.configure_logger: () -> void
24
-
25
- def self.config: () -> Phobos::DeepStruct
26
-
27
- def self.logger: () -> Logger
28
-
29
- def self.silence_log: () -> bool
30
-
31
- def self.silence_log=: (bool value) -> bool
32
-
33
- module Log
34
- def log_info: (untyped msg, ?untyped metadata) -> untyped
35
-
36
- def log_debug: (untyped msg, ?untyped metadata) -> untyped
37
-
38
- def log_error: (untyped msg, untyped metadata) -> untyped
39
-
40
- def log_warn: (untyped msg, ?untyped metadata) -> untyped
41
- end
42
-
43
- module LoggerHelper
44
- def self.log: (untyped method, untyped msg, untyped metadata) -> untyped
45
- end
46
-
47
- class Error < StandardError
48
- end
49
-
50
- class AbortError < Phobos::Error
51
- end
52
-
53
- module Handler
54
- def consume: (untyped _payload, untyped _metadata) -> untyped
55
-
56
- def around_consume: (untyped payload, untyped metadata) -> untyped
57
-
58
- module ClassMethods
59
- def start: (untyped kafka_client) -> untyped
60
-
61
- def stop: () -> untyped
62
- end
63
- end
64
-
65
- class Executor
66
- include Phobos::Instrumentation
67
- include Phobos::Log
68
-
69
- def initialize: () -> void
70
-
71
- def start: () -> untyped
72
-
73
- def stop: () -> untyped
74
-
75
- def log_info: (untyped msg, ?untyped metadata) -> untyped
76
-
77
- def log_debug: (untyped msg, ?untyped metadata) -> untyped
78
-
79
- def log_error: (untyped msg, untyped metadata) -> untyped
80
-
81
- def log_warn: (untyped msg, ?untyped metadata) -> untyped
82
-
83
- def instrument: (untyped event, ?untyped extra) -> untyped
84
- end
85
-
86
- # rubocop:disable Metrics/ParameterLists, Metrics/ClassLength
87
- class Listener
88
- include Phobos::Instrumentation
89
- include Phobos::Log
90
- DEFAULT_MAX_BYTES_PER_PARTITION: untyped
91
- DELIVERY_OPTS: untyped
92
-
93
- # rubocop:disable Metrics/MethodLength
94
- #
95
- # _@param_ `handler`
96
- #
97
- # _@param_ `group_id`
98
- #
99
- # _@param_ `topic`
100
- #
101
- # _@param_ `min_bytes`
102
- #
103
- # _@param_ `max_wait_time`
104
- #
105
- # _@param_ `start_from_beginning`
106
- #
107
- # _@param_ `delivery`
108
- #
109
- # _@param_ `max_bytes_per_partition`
110
- #
111
- # _@param_ `session_timeout`
112
- #
113
- # _@param_ `offset_commit_interval`
114
- #
115
- # _@param_ `heartbeat_interval`
116
- #
117
- # _@param_ `offset_commit_threshold`
118
- #
119
- # _@param_ `offset_retention_time`
120
- def initialize: (
121
- handler: Class,
122
- group_id: String,
123
- topic: String,
124
- ?min_bytes: Integer?,
125
- ?max_wait_time: Integer?,
126
- ?force_encoding: untyped,
127
- ?start_from_beginning: bool,
128
- ?backoff: untyped,
129
- ?delivery: String,
130
- ?max_bytes_per_partition: Integer,
131
- ?session_timeout: Integer?,
132
- ?offset_commit_interval: Integer?,
133
- ?heartbeat_interval: Integer?,
134
- ?offset_commit_threshold: Integer?,
135
- ?offset_retention_time: Integer?
136
- ) -> void
137
-
138
- def start: () -> void
139
-
140
- def stop: () -> void
141
-
142
- def create_exponential_backoff: () -> untyped
143
-
144
- def should_stop?: () -> bool
145
-
146
- def send_heartbeat_if_necessary: () -> untyped
147
-
148
- def log_info: (untyped msg, ?untyped metadata) -> untyped
149
-
150
- def log_debug: (untyped msg, ?untyped metadata) -> untyped
151
-
152
- def log_error: (untyped msg, untyped metadata) -> untyped
153
-
154
- def log_warn: (untyped msg, ?untyped metadata) -> untyped
155
-
156
- def instrument: (untyped event, ?untyped extra) -> untyped
157
-
158
- attr_reader group_id: String
159
-
160
- attr_reader topic: String
161
-
162
- # Returns the value of attribute id.
163
- attr_reader id: untyped
164
-
165
- attr_reader handler_class: Class
166
-
167
- # Returns the value of attribute encoding.
168
- attr_reader encoding: untyped
169
-
170
- # Returns the value of attribute consumer.
171
- attr_reader consumer: untyped
172
- end
173
-
174
- module Producer
175
- def producer: () -> Phobos::Producer::PublicAPI
176
-
177
- class PublicAPI
178
- def initialize: (untyped host_obj) -> void
179
-
180
- # _@param_ `topic`
181
- #
182
- # _@param_ `payload`
183
- #
184
- # _@param_ `key`
185
- #
186
- # _@param_ `partition_key`
187
- #
188
- # _@param_ `headers`
189
- def publish: (
190
- topic: String,
191
- payload: String,
192
- ?key: String?,
193
- ?partition_key: Integer?,
194
- ?headers: ::Hash[untyped, untyped]?
195
- ) -> void
196
-
197
- # _@param_ `topic`
198
- #
199
- # _@param_ `payload`
200
- #
201
- # _@param_ `key`
202
- #
203
- # _@param_ `partition_key`
204
- #
205
- # _@param_ `headers`
206
- def async_publish: (
207
- topic: String,
208
- payload: String,
209
- ?key: String?,
210
- ?partition_key: Integer?,
211
- ?headers: ::Hash[untyped, untyped]?
212
- ) -> void
213
-
214
- # _@param_ `messages` — e.g.: [ { topic: 'A', payload: 'message-1', key: '1', headers: { foo: 'bar' } }, { topic: 'B', payload: 'message-2', key: '2', headers: { foo: 'bar' } } ]
215
- def publish_list: (::Array[::Hash[untyped, untyped]] messages) -> untyped
216
-
217
- # _@param_ `messages`
218
- def async_publish_list: (::Array[::Hash[untyped, untyped]] messages) -> untyped
219
- end
220
-
221
- module ClassMethods
222
- def producer: () -> Phobos::Producer::ClassMethods::PublicAPI
223
-
224
- class PublicAPI
225
- NAMESPACE: Symbol
226
- ASYNC_PRODUCER_PARAMS: ::Array[Symbol]
227
- INTERNAL_PRODUCER_PARAMS: ::Array[Symbol]
228
-
229
- # This method configures the kafka client used with publish operations
230
- # performed by the host class
231
- #
232
- # _@param_ `kafka_client`
233
- def configure_kafka_client: (Kafka::Client kafka_client) -> void
234
-
235
- def kafka_client: () -> Kafka::Client
236
-
237
- def create_sync_producer: () -> Kafka::Producer
238
-
239
- def sync_producer: () -> Kafka::Producer
240
-
241
- def sync_producer_shutdown: () -> void
242
-
243
- # _@param_ `topic`
244
- #
245
- # _@param_ `payload`
246
- #
247
- # _@param_ `partition_key`
248
- #
249
- # _@param_ `headers`
250
- def publish: (
251
- topic: String,
252
- payload: String,
253
- ?key: untyped,
254
- ?partition_key: Integer?,
255
- ?headers: ::Hash[untyped, untyped]?
256
- ) -> void
257
-
258
- # _@param_ `messages`
259
- def publish_list: (::Array[::Hash[untyped, untyped]] messages) -> void
260
-
261
- def create_async_producer: () -> Kafka::AsyncProducer
262
-
263
- def async_producer: () -> Kafka::AsyncProducer
264
-
265
- # _@param_ `topic`
266
- #
267
- # _@param_ `payload`
268
- #
269
- # _@param_ `partition_key`
270
- #
271
- # _@param_ `headers`
272
- def async_publish: (
273
- topic: String,
274
- payload: String,
275
- ?key: untyped,
276
- ?partition_key: Integer?,
277
- ?headers: ::Hash[untyped, untyped]?
278
- ) -> void
279
-
280
- # _@param_ `messages`
281
- def async_publish_list: (::Array[::Hash[untyped, untyped]] messages) -> void
282
-
283
- def async_producer_shutdown: () -> void
284
-
285
- def regular_configs: () -> ::Hash[untyped, untyped]
286
-
287
- def async_configs: () -> ::Hash[untyped, untyped]
288
- end
289
- end
290
- end
291
-
292
- module Constants
293
- LOG_DATE_PATTERN: untyped
294
- KAFKA_CONSUMER_OPTS: untyped
295
- LISTENER_OPTS: untyped
296
- end
297
-
298
- module Processor
299
- include Phobos::Instrumentation
300
- extend ActiveSupport::Concern
301
- MAX_SLEEP_INTERVAL: untyped
302
-
303
- def snooze: (untyped interval) -> untyped
304
-
305
- def instrument: (untyped event, ?untyped extra) -> untyped
306
- end
307
-
308
- class DeepStruct < OpenStruct
309
- # Based on
310
- # https://docs.omniref.com/ruby/2.3.0/files/lib/ostruct.rb#line=88
311
- def initialize: (?untyped hash) -> void
312
-
313
- def to_h: () -> untyped
314
- end
315
-
316
- module Test
317
- module Helper
318
- TOPIC: untyped
319
- GROUP: untyped
320
-
321
- def process_message: (
322
- handler: untyped,
323
- payload: untyped,
324
- ?metadata: untyped,
325
- ?force_encoding: untyped
326
- ) -> untyped
327
- end
328
- end
329
-
330
- class EchoHandler
331
- include Phobos::Handler
332
-
333
- def consume: (untyped message, untyped metadata) -> untyped
334
-
335
- def around_consume: (untyped payload, untyped metadata) -> untyped
336
- end
337
-
338
- module BatchHandler
339
- # _@param_ `_payloads`
340
- #
341
- # _@param_ `_metadata`
342
- def consume_batch: (::Array[untyped] _payloads, ::Hash[String, Object] _metadata) -> void
343
-
344
- # _@param_ `payloads`
345
- #
346
- # _@param_ `metadata`
347
- def around_consume_batch: (::Array[untyped] payloads, ::Hash[String, Object] metadata) -> void
348
-
349
- module ClassMethods
350
- # _@param_ `kafka_client`
351
- def start: (untyped kafka_client) -> void
352
-
353
- def stop: () -> void
354
- end
355
- end
356
-
357
- class BatchMessage
358
- # _@param_ `key`
359
- #
360
- # _@param_ `partition`
361
- #
362
- # _@param_ `offset`
363
- #
364
- # _@param_ `payload`
365
- #
366
- # _@param_ `headers`
367
- def initialize: (
368
- key: untyped,
369
- partition: Integer,
370
- offset: Integer,
371
- payload: untyped,
372
- headers: untyped
373
- ) -> void
374
-
375
- # _@param_ `other`
376
- def ==: (Phobos::BatchMessage other) -> bool
377
-
378
- attr_accessor key: untyped
379
-
380
- attr_accessor partition: Integer
381
-
382
- attr_accessor offset: Integer
383
-
384
- attr_accessor payload: untyped
385
-
386
- attr_accessor headers: untyped
387
- end
388
-
389
- module Configuration
390
- # _@param_ `configuration`
391
- def configure: (untyped configuration) -> void
392
-
393
- def configure_logger: () -> void
394
- end
395
-
396
- module Instrumentation
397
- NAMESPACE: untyped
398
-
399
- def self.subscribe: (untyped event) -> untyped
400
-
401
- def self.unsubscribe: (untyped subscriber) -> untyped
402
-
403
- def instrument: (untyped event, ?untyped extra) -> untyped
404
- end
405
-
406
- module Actions
407
- class ProcessBatch
408
- include Phobos::Instrumentation
409
- include Phobos::Log
410
-
411
- def initialize: (listener: untyped, batch: untyped, listener_metadata: untyped) -> void
412
-
413
- def execute: () -> untyped
414
-
415
- def log_info: (untyped msg, ?untyped metadata) -> untyped
416
-
417
- def log_debug: (untyped msg, ?untyped metadata) -> untyped
418
-
419
- def log_error: (untyped msg, untyped metadata) -> untyped
420
-
421
- def log_warn: (untyped msg, ?untyped metadata) -> untyped
422
-
423
- def instrument: (untyped event, ?untyped extra) -> untyped
424
-
425
- # Returns the value of attribute metadata.
426
- attr_reader metadata: untyped
427
- end
428
-
429
- class ProcessMessage
430
- include Phobos::Processor
431
-
432
- def initialize: (listener: untyped, message: untyped, listener_metadata: untyped) -> void
433
-
434
- def execute: () -> untyped
435
-
436
- def snooze: (untyped interval) -> untyped
437
-
438
- def instrument: (untyped event, ?untyped extra) -> untyped
439
-
440
- # Returns the value of attribute metadata.
441
- attr_reader metadata: untyped
442
- end
443
-
444
- class ProcessBatchInline
445
- include Phobos::Processor
446
-
447
- def initialize: (listener: untyped, batch: untyped, metadata: untyped) -> void
448
-
449
- def execute: () -> untyped
450
-
451
- def snooze: (untyped interval) -> untyped
452
-
453
- def instrument: (untyped event, ?untyped extra) -> untyped
454
-
455
- # Returns the value of attribute metadata.
456
- attr_reader metadata: untyped
457
- end
458
- end
459
- end
data/sig/kafka.rbs DELETED
@@ -1,12 +0,0 @@
1
- # Ruby-Kafka definitions
2
-
3
- module Kafka
4
- class Client
5
- end
6
-
7
- class Producer
8
- end
9
-
10
- class AsyncProducer
11
- end
12
- end