karafka-core 2.0.6 → 2.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4405dd3063f0901a0e362e4af4d518a36d9222e0b0bc653e6214789649d1aedc
4
- data.tar.gz: 3989835a62bb524675548bd8d04b8b8b3f9fad027879b4a063f09c3776cc66a2
3
+ metadata.gz: 158fcf590bf58fc10f8c47c5f9b9e8a256db4df8bfa842780cd20b6859c82392
4
+ data.tar.gz: 33025b3aaae92b63dffd21bf1820937d768cae4f8103701c963903e2add50fa6
5
5
  SHA512:
6
- metadata.gz: f016129dc7b5dd6cd7bbf545025731674fd9252756b65db02f0ad01da5c88555b0f2b382e8687b767936e71c9b0f15f8de197ab2d22e551342aac5d61958cb15
7
- data.tar.gz: d806ccc59909f9650deea4284b9262bf4644749aa5e0a206ecd835d7b4b1e97fdd3292a84ddbb0292a23a3fd8106c20b42b52eff8021a9488253d409b911be44
6
+ metadata.gz: ebd3106bfe9f3ee67c1fca1ed6c871a2b7d18d03bb6a1dd9be4922777cb0bed1362047550a1a146491e9402fd9da61d6a37baf6aef99d6e303410702e7cedb3b
7
+ data.tar.gz: 89fab64ee5a909d0e05fbf179b690cc4fa75153d13cdbfe06e22d8b2d66b11fe4484641897ce95cb1a21e48e05746e29313a0d4157cc0a38d5dbe169d21ecc7f
checksums.yaml.gz.sig CHANGED
@@ -1,3 +1 @@
1
- ���5�~���h)R�۹/�̡���3Y��LAur�X�Axb"��p�\�ޖ]pm��t*�@���E5ϙ����!D(E�i��8v S���ڰ
2
- ���2N�i�`�Rh ����BڌF�II��̑*d2����xvG��Y5���^܀�Rj����Z0 �n�Ն�/��<gq��$�Q�zV�w"��1��u������s�|�`�� �)�Fs[g]Г&���Ӓ�`�
3
- �>�y��"Ӵ�4Xy���Md����Iqm.��D�T�%"�hT��-Z
1
+ ��*NMQ��<���iqIgu��B�s+W�]���$���`���X��左q8��4�.9�}�����ᡯl|Y :��C/�-*t2��Y��{s����S[U�`c�$��-?VuE��W���!��`d ���>+-�#��8jBf�����g���<��7��hv�c����o�M�um�������t�<�T�FS!��:(�'�r��cmÂ��<���w�M��Ŝ�i����=�`�թZkɄ��JVu�@<�0����G )�ǧ������Z>�Ȅ�ю�|�Tat��+��O��t��&mut+}�����������Z����8huM���Tb��l�?��㿞���<��y-?�+E`YF�X��$
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Karafka core changelog
2
2
 
3
+ ## 2.0.7 (2022-12-18)
4
+ - Allow for recompilation of config upon injecting new config nodes.
5
+ - Compile given config scope automatically after it is defined.
6
+ - Support sub-config merging via their nested definitions.
7
+
3
8
  ## 2.0.6 (2022-12-07)
4
9
  - Reverse node compilation state tracking removal.
5
10
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- karafka-core (2.0.6)
4
+ karafka-core (2.0.7)
5
5
  concurrent-ruby (>= 1.1)
6
6
  rdkafka (>= 0.12)
7
7
 
@@ -4,7 +4,12 @@ module Karafka
4
4
  module Core
5
5
  module Configurable
6
6
  # Single end config value representation
7
- Leaf = Struct.new(:name, :default, :constructor)
7
+ Leaf = Struct.new(:name, :default, :constructor, :compiled) do
8
+ # @return [Boolean] true if already compiled
9
+ def compiled?
10
+ compiled
11
+ end
12
+ end
8
13
  end
9
14
  end
10
15
  end
@@ -35,8 +35,10 @@ module Karafka
35
35
  @children << if block
36
36
  Node.new(name, block)
37
37
  else
38
- Leaf.new(name, default, constructor)
38
+ Leaf.new(name, default, constructor, false)
39
39
  end
40
+
41
+ compile
40
42
  end
41
43
 
42
44
  # Allows for the configuration and setup of the settings
@@ -44,7 +46,7 @@ module Karafka
44
46
  # Compile settings, allow for overrides via yielding
45
47
  # @return [Node] returns self after configuration
46
48
  def configure
47
- compile unless @compiled
49
+ compile if !@compiled || name == :root
48
50
  yield(self) if block_given?
49
51
  self
50
52
  end
@@ -55,7 +57,10 @@ module Karafka
55
57
 
56
58
  @children.each do |value|
57
59
  config[value.name] = if value.is_a?(Leaf)
58
- public_send(value.name)
60
+ result = public_send(value.name)
61
+ # We need to check if value is not a result node for cases where
62
+ # we merge additional config
63
+ result.is_a?(Node) ? result.to_h : result
59
64
  else
60
65
  value.to_h
61
66
  end
@@ -71,7 +76,14 @@ module Karafka
71
76
  dupped = Node.new(name, nestings)
72
77
 
73
78
  dupped.children += children.map do |value|
74
- value.is_a?(Leaf) ? value.dup : value.deep_dup
79
+ if value.is_a?(Leaf)
80
+ # After inheritance we need to reload the state so the leafs are recompiled again
81
+ value = value.dup
82
+ value.compiled = false
83
+ value
84
+ else
85
+ value.deep_dup
86
+ end
75
87
  end
76
88
 
77
89
  dupped
@@ -90,6 +102,9 @@ module Karafka
90
102
  next if skippable
91
103
 
92
104
  initialized = if value.is_a?(Leaf)
105
+ next if value.compiled?
106
+
107
+ value.compiled = true
93
108
  value.constructor ? value.constructor.call(value.default) : value.default
94
109
  else
95
110
  value.compile
@@ -4,6 +4,6 @@ module Karafka
4
4
  module Core
5
5
  # Current Karafka::Core version
6
6
  # We follow the versioning schema of given Karafka version
7
- VERSION = '2.0.6'
7
+ VERSION = '2.0.7'
8
8
  end
9
9
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: karafka-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.6
4
+ version: 2.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maciej Mensfeld
@@ -35,7 +35,7 @@ cert_chain:
35
35
  Qf04B9ceLUaC4fPVEz10FyobjaFoY4i32xRto3XnrzeAgfEe4swLq8bQsR3w/EF3
36
36
  MGU0FeSV2Yj7Xc2x/7BzLK8xQn5l7Yy75iPF+KP3vVmDHnNl
37
37
  -----END CERTIFICATE-----
38
- date: 2022-12-07 00:00:00.000000000 Z
38
+ date: 2022-12-18 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: concurrent-ruby
metadata.gz.sig CHANGED
Binary file