smart_schema 0.8.0 → 0.10.0

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: 9b77c587cbf99773471fe28e8113fe603dd9fc8eba4fd6509d87695976affaef
4
- data.tar.gz: dfbc216a7537c38b3dd2bb2dec9d7ce1a66f3c8b37528e903372a0519a44319a
3
+ metadata.gz: 1091be1a928799b1f68dbceb9d9776f1f522ede5052798373174effd3e113d90
4
+ data.tar.gz: a67e0c2668890e7cff9da035058596b9d80fe497f501487a56dbc1545b85f99a
5
5
  SHA512:
6
- metadata.gz: 130dbacff8c5765ad68f19dec163111d5e498f8464f1d3f8c954e15b45c6f278b5981373c9619964db316bc57c34d0b11a2b2782dde1eec5d777d672c918cf35
7
- data.tar.gz: 36cde9131e10e969a7470b26d6a3a8ea6044d27c11e61f50e320073293026f5259ab52b51cbf69c3d72b739e54220258b44da56a98223f0dc63cd8e5813072eb
6
+ metadata.gz: 71079e1950ce9a55b9f72ace447d96c07eebd5fd2696787be7dad04e2f46d1b51a2d4f9eee1b9eb519b567345ff054ccd4a3966f4cc38c5461405b7fdfce7fdb
7
+ data.tar.gz: a7334f5669d2b95e573a5d416c42193ecb60546f24babc8a1034c3459c753e728f2214a9a421b7d047a7bd7a959a74f995d9ebb8318d5550fd17198484ca2e18
data/CHANGELOG.md CHANGED
@@ -1,13 +1,21 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ # [0.10.0] - 2022-10-16
5
+ ## Changed
6
+ - Updated `smart_engine` dependency with a `SmartCore::Engine::ReadWriteLock` fixes;
7
+
8
+ # [0.9.0] - 2022-09-30
9
+ ## Changed
10
+ - Reduced context switching count during lock operations (migrate from `SmartCore::Engine::Lock` to `SmartCore::Engine::ReadWriteLock`);
11
+
4
12
  # [0.8.0] - 2022-09-30
5
13
  ## Changed
6
- - Decreased object allocations and mutex usage
7
- - the one mutex of `SmartCore::Schema::Checker` is enough cuz this mutex covers the entire validation process);
14
+ - Reduced object allocations and mutex usage:
15
+ - only one mutex of `SmartCore::Schema::Checker` instance is enough cuz this mutex covers the entire validation process;
8
16
  - more retained objects in `SmartCore::Schema::Checker::Rules` (cache layer for rule names);
9
17
  - Updated development dependencies;
10
- - Updated `smart_engine` dependency (`0.7` -> `0.8`);
18
+ - Updated `smart_engine` dependency (`~> 0.11` -> `~> 0.13`);
11
19
 
12
20
  # [0.7.0] - 2022-09-28
13
21
  ## Changed
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- smart_schema (0.8.0)
5
- smart_engine (~> 0.13)
4
+ smart_schema (0.10.0)
5
+ smart_engine (~> 0.17)
6
6
  smart_types (~> 0.4)
7
7
 
8
8
  GEM
@@ -81,7 +81,7 @@ GEM
81
81
  simplecov_json_formatter (~> 0.1)
82
82
  simplecov-html (0.12.3)
83
83
  simplecov_json_formatter (0.1.4)
84
- smart_engine (0.13.0)
84
+ smart_engine (0.17.0)
85
85
  smart_types (0.7.1)
86
86
  smart_engine (~> 0.11)
87
87
  tzinfo (2.0.5)
@@ -2,7 +2,7 @@
2
2
 
3
3
  # @api private
4
4
  # @since 0.1.0
5
- # @version 0.3.0
5
+ # @version 0.9.0
6
6
  class SmartCore::Schema::Checker
7
7
  require_relative 'checker/verifiable_hash'
8
8
  require_relative 'checker/rules'
@@ -12,9 +12,10 @@ class SmartCore::Schema::Checker
12
12
  #
13
13
  # @api private
14
14
  # @since 0.1.0
15
+ # @version 0.9.0
15
16
  def initialize
16
17
  @reconciler = Reconciler::Constructor.create
17
- @lock = SmartCore::Engine::Lock.new
18
+ @lock = SmartCore::Engine::ReadWriteLock.new
18
19
  end
19
20
 
20
21
  # @param verifiable_hash [Hash<String|Symbol,Any>]
@@ -22,8 +23,9 @@ class SmartCore::Schema::Checker
22
23
  #
23
24
  # @api private
24
25
  # @since 0.1.0
26
+ # @version 0.9.0
25
27
  def check!(verifiable_hash)
26
- thread_safe do
28
+ @lock.read_sync do
27
29
  raise(SmartCore::Schema::ArgumentError, <<~ERROR_MESSAGE) unless verifiable_hash.is_a?(Hash)
28
30
  Verifiable hash should be a type of ::Hash
29
31
  ERROR_MESSAGE
@@ -37,8 +39,9 @@ class SmartCore::Schema::Checker
37
39
  #
38
40
  # @api private
39
41
  # @since 0.3.0
42
+ # @version 0.9.0
40
43
  def invoke_in_pipe(&checker_invokations)
41
- thread_safe { instance_eval(&checker_invokations) }
44
+ @lock.write_sync { instance_eval(&checker_invokations) }
42
45
  end
43
46
 
44
47
  # @param strict_mode [NilClass, String, Symbol]
@@ -46,8 +49,9 @@ class SmartCore::Schema::Checker
46
49
  #
47
50
  # @api private
48
51
  # @since 0.3.0
52
+ # @version 0.9.0
49
53
  def set_strict_mode(strict_mode)
50
- thread_safe { apply_strict_mode(strict_mode) }
54
+ @lock.write_sync { apply_strict_mode(strict_mode) }
51
55
  end
52
56
 
53
57
  # @param definitions [Block]
@@ -55,8 +59,9 @@ class SmartCore::Schema::Checker
55
59
  #
56
60
  # @api private
57
61
  # @since 0.1.0
62
+ # @version 0.9.0
58
63
  def append_schema_definitions(&definitions)
59
- thread_safe { add_schema_definitions(&definitions) }
64
+ @lock.write_sync { add_schema_definitions(&definitions) }
60
65
  end
61
66
 
62
67
  # @param another_checker [SmartCore::Schema::Checker]
@@ -64,8 +69,9 @@ class SmartCore::Schema::Checker
64
69
  #
65
70
  # @api private
66
71
  # @since 0.1.0
72
+ # @version 0.9.0
67
73
  def combine_with(another_checker)
68
- thread_safe { self } # TODO (0.x.0): merge the definitions and return self
74
+ @lock.write_sync { self } # TODO (0.x.0): merge the definitions and return self
69
75
  end
70
76
 
71
77
  private
@@ -97,13 +103,4 @@ class SmartCore::Schema::Checker
97
103
  def apply_strict_mode(strict_mode)
98
104
  Reconciler::Constructor.set_strict_mode(reconciler, strict_mode)
99
105
  end
100
-
101
- # @param block [Block]
102
- # @return [Any]
103
- #
104
- # @api private
105
- # @since 0.1.0
106
- def thread_safe(&block)
107
- @lock.synchronize(&block)
108
- end
109
106
  end
@@ -7,8 +7,8 @@ module SmartCore
7
7
  #
8
8
  # @api public
9
9
  # @since 0.1.0
10
- # @version 0.8.0
11
- VERSION = '0.8.0'
10
+ # @version 0.10.0
11
+ VERSION = '0.10.0'
12
12
  end
13
13
  # rubocop:enable Style/StaticClass
14
14
  end
data/smart_schema.gemspec CHANGED
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
30
30
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
31
  spec.require_paths = ['lib']
32
32
 
33
- spec.add_dependency 'smart_engine', '~> 0.13'
33
+ spec.add_dependency 'smart_engine', '~> 0.17'
34
34
  spec.add_dependency 'smart_types', '~> 0.4'
35
35
 
36
36
  spec.add_development_dependency 'pry', '~> 0.13'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rustam Ibragimov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-29 00:00:00.000000000 Z
11
+ date: 2022-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: smart_engine
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.13'
19
+ version: '0.17'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.13'
26
+ version: '0.17'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: smart_types
29
29
  requirement: !ruby/object:Gem::Requirement