smart_schema 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -3
- data/Gemfile.lock +3 -3
- data/lib/smart_core/schema/checker.rb +13 -15
- data/lib/smart_core/schema/version.rb +2 -2
- data/smart_schema.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a161786a837c4ada32a0faed7e94824b7c7d9b8fe5d8424017f1b35a9247046
|
4
|
+
data.tar.gz: 8bad145419a14dea10ce51e52575b6defb1f03cc4f60bb7e8469e53c78abe533
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e3d78a45f8c0520f091efcec8c51ad0dd9b4997406260843702c738a70aace1b79c671fbb4aff339092f458bc6825a491e6188f3fe18952d0992b429813945c
|
7
|
+
data.tar.gz: c12d347de7ec869ea0d0019e4d270d24a06f894b9b3c05d945be4172e4e5d9cf9e39a589f925756d13f1bb27d8073417757bcc7f857e329f5c8d9682e5e15a08
|
data/CHANGELOG.md
CHANGED
@@ -1,13 +1,17 @@
|
|
1
1
|
# Changelog
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
+
# [0.9.0] - 2022-09-30
|
5
|
+
## Changed
|
6
|
+
- Reduced context switching count during lock operations (migrate from `SmartCore::Engine::Lock` to `SmartCore::Engine::ReadWriteLock`);
|
7
|
+
|
4
8
|
# [0.8.0] - 2022-09-30
|
5
9
|
## Changed
|
6
|
-
-
|
7
|
-
-
|
10
|
+
- Reduced object allocations and mutex usage:
|
11
|
+
- only one mutex of `SmartCore::Schema::Checker` instance is enough cuz this mutex covers the entire validation process;
|
8
12
|
- more retained objects in `SmartCore::Schema::Checker::Rules` (cache layer for rule names);
|
9
13
|
- Updated development dependencies;
|
10
|
-
- Updated `smart_engine` dependency (
|
14
|
+
- Updated `smart_engine` dependency (`~> 0.11` -> `~> 0.13`);
|
11
15
|
|
12
16
|
# [0.7.0] - 2022-09-28
|
13
17
|
## Changed
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
smart_schema (0.
|
5
|
-
smart_engine (~> 0.
|
4
|
+
smart_schema (0.9.0)
|
5
|
+
smart_engine (~> 0.16)
|
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.
|
84
|
+
smart_engine (0.16.0)
|
85
85
|
smart_types (0.7.1)
|
86
86
|
smart_engine (~> 0.11)
|
87
87
|
tzinfo (2.0.5)
|
@@ -3,6 +3,7 @@
|
|
3
3
|
# @api private
|
4
4
|
# @since 0.1.0
|
5
5
|
# @version 0.3.0
|
6
|
+
# @version 0.9.0
|
6
7
|
class SmartCore::Schema::Checker
|
7
8
|
require_relative 'checker/verifiable_hash'
|
8
9
|
require_relative 'checker/rules'
|
@@ -12,9 +13,10 @@ class SmartCore::Schema::Checker
|
|
12
13
|
#
|
13
14
|
# @api private
|
14
15
|
# @since 0.1.0
|
16
|
+
# @version 0.9.0
|
15
17
|
def initialize
|
16
18
|
@reconciler = Reconciler::Constructor.create
|
17
|
-
@lock = SmartCore::Engine::
|
19
|
+
@lock = SmartCore::Engine::ReadWriteLock.new
|
18
20
|
end
|
19
21
|
|
20
22
|
# @param verifiable_hash [Hash<String|Symbol,Any>]
|
@@ -22,8 +24,9 @@ class SmartCore::Schema::Checker
|
|
22
24
|
#
|
23
25
|
# @api private
|
24
26
|
# @since 0.1.0
|
27
|
+
# @version 0.9.0
|
25
28
|
def check!(verifiable_hash)
|
26
|
-
|
29
|
+
@lock.read_sync do
|
27
30
|
raise(SmartCore::Schema::ArgumentError, <<~ERROR_MESSAGE) unless verifiable_hash.is_a?(Hash)
|
28
31
|
Verifiable hash should be a type of ::Hash
|
29
32
|
ERROR_MESSAGE
|
@@ -37,8 +40,9 @@ class SmartCore::Schema::Checker
|
|
37
40
|
#
|
38
41
|
# @api private
|
39
42
|
# @since 0.3.0
|
43
|
+
# @version 0.9.0
|
40
44
|
def invoke_in_pipe(&checker_invokations)
|
41
|
-
|
45
|
+
@lock.write_sync { instance_eval(&checker_invokations) }
|
42
46
|
end
|
43
47
|
|
44
48
|
# @param strict_mode [NilClass, String, Symbol]
|
@@ -46,8 +50,9 @@ class SmartCore::Schema::Checker
|
|
46
50
|
#
|
47
51
|
# @api private
|
48
52
|
# @since 0.3.0
|
53
|
+
# @version 0.9.0
|
49
54
|
def set_strict_mode(strict_mode)
|
50
|
-
|
55
|
+
@lock.write_sync { apply_strict_mode(strict_mode) }
|
51
56
|
end
|
52
57
|
|
53
58
|
# @param definitions [Block]
|
@@ -55,8 +60,9 @@ class SmartCore::Schema::Checker
|
|
55
60
|
#
|
56
61
|
# @api private
|
57
62
|
# @since 0.1.0
|
63
|
+
# @version 0.9.0
|
58
64
|
def append_schema_definitions(&definitions)
|
59
|
-
|
65
|
+
@lock.write_sync { add_schema_definitions(&definitions) }
|
60
66
|
end
|
61
67
|
|
62
68
|
# @param another_checker [SmartCore::Schema::Checker]
|
@@ -64,8 +70,9 @@ class SmartCore::Schema::Checker
|
|
64
70
|
#
|
65
71
|
# @api private
|
66
72
|
# @since 0.1.0
|
73
|
+
# @version 0.9.0
|
67
74
|
def combine_with(another_checker)
|
68
|
-
|
75
|
+
@lock.write_sync { self } # TODO (0.x.0): merge the definitions and return self
|
69
76
|
end
|
70
77
|
|
71
78
|
private
|
@@ -97,13 +104,4 @@ class SmartCore::Schema::Checker
|
|
97
104
|
def apply_strict_mode(strict_mode)
|
98
105
|
Reconciler::Constructor.set_strict_mode(reconciler, strict_mode)
|
99
106
|
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
107
|
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.
|
33
|
+
spec.add_dependency 'smart_engine', '~> 0.16'
|
34
34
|
spec.add_dependency 'smart_types', '~> 0.4'
|
35
35
|
|
36
36
|
spec.add_development_dependency 'pry', '~> 0.13'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smart_schema
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rustam Ibragimov
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.16'
|
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.
|
26
|
+
version: '0.16'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: smart_types
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|