janus-ar 7.2.2 → 8.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: abaa44daa4820589fe37b9524a37a8190e9bb856b95498b0d66b6273ed3c8672
4
- data.tar.gz: 100aa33fe074292a34dc758c64a122e16664a067a0117e976437dd1b415dceda
3
+ metadata.gz: 612d3c32af790b83f526dfe55c6a657e527c0d08c9dc7959c7203e5fe794fec0
4
+ data.tar.gz: f98329224347cbe2e08a2fadef8d3e9e705afb281066a18aa29a7757fd0adf26
5
5
  SHA512:
6
- metadata.gz: 452aebf630ed525f284d379b82d45b8f81665d44887fb21ee7d768e2310696446754df0c09b5d101dcd0142d9eab4cc3260fe0c06359e807f30652c186717fca
7
- data.tar.gz: 9417eacddc58ec5f1bfc879b260d9a3f362f833db80f897efb634e1eade1ba185f7bc6461290551ef933971da0619652f7a24c783660d190f3985f28a65db3b3
6
+ metadata.gz: 8565f506ef40bb85d1a453f3978961af94d3fcc0d4e743d691c443c656c4e2eaeb078c07e453abc7580fc7ff6e31184ca774fd90f6ffa33753d3de3c2646f4fe
7
+ data.tar.gz: 653188ccf586dfd9d1d30bb666b62f09f053749a8b5b04c6403f05a5d6f02f8ae188c1d5eb1a00ee7944c9023cbd7796c482d2ac1c45e291af516d15abfe4b6c
data/Gemfile.lock CHANGED
@@ -1,20 +1,21 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- janus-ar (7.2.2)
5
- activerecord (~> 7.2)
4
+ janus-ar (7.2.0)
5
+ activerecord (>= 8.0, < 9.0)
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
9
9
  specs:
10
- activemodel (7.2.1)
11
- activesupport (= 7.2.1)
12
- activerecord (7.2.1)
13
- activemodel (= 7.2.1)
14
- activesupport (= 7.2.1)
10
+ activemodel (8.0.1)
11
+ activesupport (= 8.0.1)
12
+ activerecord (8.0.1)
13
+ activemodel (= 8.0.1)
14
+ activesupport (= 8.0.1)
15
15
  timeout (>= 0.4.0)
16
- activesupport (7.2.1)
16
+ activesupport (8.0.1)
17
17
  base64
18
+ benchmark (>= 0.3)
18
19
  bigdecimal
19
20
  concurrent-ruby (~> 1.0, >= 1.3.1)
20
21
  connection_pool (>= 2.2.5)
@@ -24,36 +25,36 @@ GEM
24
25
  minitest (>= 5.1)
25
26
  securerandom (>= 0.3)
26
27
  tzinfo (~> 2.0, >= 2.0.5)
28
+ uri (>= 0.13.1)
27
29
  ast (2.4.2)
28
30
  base64 (0.2.0)
29
- bigdecimal (3.1.8)
31
+ benchmark (0.4.0)
32
+ bigdecimal (3.1.9)
30
33
  coderay (1.1.3)
31
34
  concurrent-ruby (1.3.4)
32
35
  connection_pool (2.4.1)
33
36
  diff-lcs (1.5.1)
34
37
  drb (2.2.1)
35
- i18n (1.14.5)
38
+ i18n (1.14.6)
36
39
  concurrent-ruby (~> 1.0)
37
- json (2.7.2)
40
+ json (2.9.1)
38
41
  language_server-protocol (3.17.0.3)
39
- logger (1.6.0)
40
- method_source (1.0.0)
41
- minitest (5.25.1)
42
+ logger (1.6.4)
43
+ method_source (1.1.0)
44
+ minitest (5.25.4)
42
45
  mysql2 (0.5.6)
43
46
  parallel (1.26.3)
44
- parser (3.3.4.2)
47
+ parser (3.3.6.0)
45
48
  ast (~> 2.4.1)
46
49
  racc
47
- pry (0.14.2)
50
+ pry (0.15.2)
48
51
  coderay (~> 1.1)
49
52
  method_source (~> 1.0)
50
53
  racc (1.8.1)
51
- rack (3.1.7)
54
+ rack (3.1.8)
52
55
  rainbow (3.1.1)
53
56
  rake (13.2.1)
54
- regexp_parser (2.9.2)
55
- rexml (3.3.6)
56
- strscan
57
+ regexp_parser (2.10.0)
57
58
  rspec (3.13.0)
58
59
  rspec-core (~> 3.13.0)
59
60
  rspec-expectations (~> 3.13.0)
@@ -67,55 +68,55 @@ GEM
67
68
  diff-lcs (>= 1.2.0, < 2.0)
68
69
  rspec-support (~> 3.13.0)
69
70
  rspec-support (3.13.1)
70
- rubocop (1.65.1)
71
+ rubocop (1.69.2)
71
72
  json (~> 2.3)
72
73
  language_server-protocol (>= 3.17.0)
73
74
  parallel (~> 1.10)
74
75
  parser (>= 3.3.0.2)
75
76
  rainbow (>= 2.2.2, < 4.0)
76
- regexp_parser (>= 2.4, < 3.0)
77
- rexml (>= 3.2.5, < 4.0)
78
- rubocop-ast (>= 1.31.1, < 2.0)
77
+ regexp_parser (>= 2.9.3, < 3.0)
78
+ rubocop-ast (>= 1.36.2, < 2.0)
79
79
  ruby-progressbar (~> 1.7)
80
- unicode-display_width (>= 2.4.0, < 3.0)
81
- rubocop-ast (1.32.1)
80
+ unicode-display_width (>= 2.4.0, < 4.0)
81
+ rubocop-ast (1.37.0)
82
82
  parser (>= 3.3.1.0)
83
- rubocop-performance (1.21.1)
83
+ rubocop-performance (1.23.1)
84
84
  rubocop (>= 1.48.1, < 2.0)
85
85
  rubocop-ast (>= 1.31.1, < 2.0)
86
- rubocop-rails (2.26.0)
86
+ rubocop-rails (2.28.0)
87
87
  activesupport (>= 4.2.0)
88
88
  rack (>= 1.1)
89
89
  rubocop (>= 1.52.0, < 2.0)
90
90
  rubocop-ast (>= 1.31.1, < 2.0)
91
- rubocop-rspec (3.0.4)
91
+ rubocop-rspec (3.2.0)
92
92
  rubocop (~> 1.61)
93
- rubocop-thread_safety (0.5.1)
94
- rubocop (>= 0.90.0)
93
+ rubocop-thread_safety (0.6.0)
94
+ rubocop (>= 1.48.1)
95
95
  ruby-progressbar (1.13.0)
96
- securerandom (0.3.1)
97
- strscan (3.1.0)
98
- timeout (0.4.1)
99
- trilogy (2.8.1)
96
+ securerandom (0.4.1)
97
+ timeout (0.4.3)
98
+ trilogy (2.9.0)
100
99
  tzinfo (2.0.6)
101
100
  concurrent-ruby (~> 1.0)
102
- unicode-display_width (2.5.0)
101
+ unicode-display_width (3.1.3)
102
+ unicode-emoji (~> 4.0, >= 4.0.4)
103
+ unicode-emoji (4.0.4)
104
+ uri (1.0.2)
103
105
 
104
106
  PLATFORMS
105
107
  arm64-darwin-23
106
- x86_64-darwin-19
107
108
  x86_64-linux
108
109
 
109
110
  DEPENDENCIES
110
- activesupport (>= 7.2.0)
111
+ activesupport (>= 8.0)
111
112
  janus-ar!
112
113
  mysql2
113
114
  pry
114
115
  rake
115
116
  rspec (~> 3)
116
- rubocop (~> 1.65.0)
117
+ rubocop (~> 1.69.2)
117
118
  rubocop-performance
118
- rubocop-rails (~> 2.26.0)
119
+ rubocop-rails (~> 2.28.0)
119
120
  rubocop-rspec
120
121
  rubocop-thread_safety
121
122
  trilogy
data/README.md CHANGED
@@ -35,7 +35,9 @@ This project assumes that your read/write endpoints are handled by a separate sy
35
35
 
36
36
  After a write request during a thread the adapter will continue using the `primary` server, unless the context is specifically released.
37
37
 
38
- ## Rails 7.2+
38
+ ### Setup
39
+
40
+ #### Rails 7.2+
39
41
 
40
42
  For Rails 7.2 you'll need to manually register the database adaptor in `config/application.rb` after requiring rails but before entering the application configuration, e.g.
41
43
 
@@ -47,7 +49,7 @@ ActiveRecord::ConnectionAdapters.register("janus_trilogy", "ActiveRecord::Connec
47
49
  ActiveRecord::ConnectionAdapters.register("janus_mysql2", "ActiveRecord::ConnectionAdapters::JanusMysql2Adapter", 'janus-ar/active_record/connection_adapters/janus_mysql2_adapter')
48
50
  ```
49
51
 
50
- ## Rails <= 7.1
52
+ #### Rails <= 7.1
51
53
 
52
54
  ActiveRecord 7.1 was tested up to releases v0.15.*. After this release we only tested Rails 7.2+. This does not mean it is not compatible, just not tested.
53
55
 
data/janus-ar.gemspec CHANGED
@@ -21,15 +21,15 @@ Gem::Specification.new do |gem|
21
21
 
22
22
  gem.required_ruby_version = '>= 3.2.0'
23
23
 
24
- gem.add_dependency 'activerecord', '~> 7.2'
25
- gem.add_development_dependency 'activesupport', '>= 7.2.0'
24
+ gem.add_dependency 'activerecord', '>= 8.0', '< 9.0'
25
+ gem.add_development_dependency 'activesupport', '>= 8.0'
26
26
  gem.add_development_dependency 'mysql2'
27
27
  gem.add_development_dependency 'trilogy'
28
28
  gem.add_development_dependency 'pry'
29
29
  gem.add_development_dependency 'rake'
30
30
  gem.add_development_dependency 'rspec', '~> 3'
31
- gem.add_development_dependency 'rubocop', '~> 1.65.0'
32
- gem.add_development_dependency 'rubocop-rails', '~> 2.26.0'
31
+ gem.add_development_dependency 'rubocop', '~> 1.69.2'
32
+ gem.add_development_dependency 'rubocop-rails', '~> 2.28.0'
33
33
  gem.add_development_dependency 'rubocop-rspec'
34
34
  gem.add_development_dependency 'rubocop-thread_safety'
35
35
  gem.add_development_dependency 'rubocop-performance'
@@ -51,13 +51,14 @@ module ActiveRecord
51
51
  self
52
52
  end
53
53
 
54
- def raw_execute(sql, name, async: false, allow_retry: false, materialize_transactions: true)
54
+ def raw_execute(sql, name = nil, binds = [], prepare: false, async: false, allow_retry: false,
55
+ materialize_transactions: true, batch: false)
55
56
  case where_to_send?(sql)
56
57
  when :all
57
- send_to_replica(sql, connection: :all, name:)
58
+ send_to_replica(sql, connection: :all, method: :raw_execute)
58
59
  super
59
60
  when :replica
60
- send_to_replica(sql, connection: :replica, name:)
61
+ send_to_replica(sql, connection: :replica, method: :raw_execute)
61
62
  else
62
63
  Janus::Context.stick_to_primary if write_query?(sql)
63
64
  Janus::Context.used_connection(:primary)
@@ -65,13 +66,13 @@ module ActiveRecord
65
66
  end
66
67
  end
67
68
 
68
- def execute(sql, name = nil)
69
+ def execute(sql)
69
70
  case where_to_send?(sql)
70
71
  when :all
71
- send_to_replica(sql, connection: :all, method: :execute, name:)
72
+ send_to_replica(sql, connection: :all, method: :execute)
72
73
  super(sql)
73
74
  when :replica
74
- send_to_replica(sql, connection: :replica, method: :execute, name:)
75
+ send_to_replica(sql, connection: :replica, method: :execute)
75
76
  else
76
77
  Janus::Context.stick_to_primary if write_query?(sql)
77
78
  Janus::Context.used_connection(:primary)
@@ -79,17 +80,17 @@ module ActiveRecord
79
80
  end
80
81
  end
81
82
 
82
- def execute_and_free(sql, name = nil, async: false, allow_retry: false)
83
+ def execute_and_free(sql, name = nil, async: false)
83
84
  case where_to_send?(sql)
84
85
  when :all
85
- send_to_replica(sql, connection: :all, name:)
86
+ send_to_replica(sql, connection: :all, method: :execute)
86
87
  super(sql, name, async:)
87
88
  when :replica
88
- send_to_replica(sql, connection: :replica, name:)
89
+ send_to_replica(sql, connection: :replica, method: :execute)
89
90
  else
90
91
  Janus::Context.stick_to_primary if write_query?(sql)
91
92
  Janus::Context.used_connection(:primary)
92
- super(sql, name, async:, allow_retry:)
93
+ super(sql, name, async:)
93
94
  end
94
95
  end
95
96
 
@@ -123,13 +124,14 @@ module ActiveRecord
123
124
  Janus::QueryDirector.new(sql, open_transactions).where_to_send?
124
125
  end
125
126
 
126
- def send_to_replica(sql, connection: nil, method: :exec_query, name:)
127
- name ||= "SQL"
127
+ def send_to_replica(sql, connection: nil, method: :exec_query)
128
128
  Janus::Context.used_connection(connection) if connection
129
129
  if method == :execute
130
- replica_connection.execute(sql, name)
130
+ replica_connection.execute(sql)
131
+ elsif method == :raw_execute
132
+ replica_connection.execute(sql)
131
133
  else
132
- replica_connection.exec_query(sql, name)
134
+ replica_connection.exec_query(sql)
133
135
  end
134
136
  end
135
137
 
@@ -47,7 +47,8 @@ module ActiveRecord
47
47
  update_config
48
48
  end
49
49
 
50
- def raw_execute(sql, name, async: false, allow_retry: false, materialize_transactions: true)
50
+ def raw_execute(sql, name = nil, binds = [], prepare: false, async: false, allow_retry: false,
51
+ materialize_transactions: true, batch: false)
51
52
  case where_to_send?(sql)
52
53
  when :all
53
54
  send_to_replica(sql, connection: :all, method: :execute)
@@ -75,17 +76,17 @@ module ActiveRecord
75
76
  end
76
77
  end
77
78
 
78
- def execute_and_free(sql, name = nil, async: false, allow_retry: false)
79
+ def execute_and_free(sql, name = nil, async: false)
79
80
  case where_to_send?(sql)
80
81
  when :all
81
82
  send_to_replica(sql, connection: :all, method: :execute)
82
- super(sql, name, async:, allow_retry:)
83
+ super(sql, name, async:)
83
84
  when :replica
84
85
  send_to_replica(sql, connection: :replica, method: :execute)
85
86
  else
86
87
  Janus::Context.stick_to_primary if write_query?(sql)
87
88
  Janus::Context.used_connection(:primary)
88
- super(sql, name, async:, allow_retry:)
89
+ super(sql, name, async:)
89
90
  end
90
91
  end
91
92
 
@@ -3,9 +3,9 @@
3
3
  module Janus
4
4
  unless defined?(::Janus::VERSION)
5
5
  module VERSION
6
- MAJOR = 7
7
- MINOR = 2
8
- PATCH = 2
6
+ MAJOR = 8
7
+ MINOR = 0
8
+ PATCH = 0
9
9
  PRE = nil
10
10
 
11
11
  def self.to_s
metadata CHANGED
@@ -1,43 +1,49 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: janus-ar
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.2.2
4
+ version: 8.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lloyd Watkin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-03-06 00:00:00.000000000 Z
11
+ date: 2025-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '8.0'
20
+ - - "<"
18
21
  - !ruby/object:Gem::Version
19
- version: '7.2'
22
+ version: '9.0'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '8.0'
30
+ - - "<"
25
31
  - !ruby/object:Gem::Version
26
- version: '7.2'
32
+ version: '9.0'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: activesupport
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - ">="
32
38
  - !ruby/object:Gem::Version
33
- version: 7.2.0
39
+ version: '8.0'
34
40
  type: :development
35
41
  prerelease: false
36
42
  version_requirements: !ruby/object:Gem::Requirement
37
43
  requirements:
38
44
  - - ">="
39
45
  - !ruby/object:Gem::Version
40
- version: 7.2.0
46
+ version: '8.0'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: mysql2
43
49
  requirement: !ruby/object:Gem::Requirement
@@ -114,28 +120,28 @@ dependencies:
114
120
  requirements:
115
121
  - - "~>"
116
122
  - !ruby/object:Gem::Version
117
- version: 1.65.0
123
+ version: 1.69.2
118
124
  type: :development
119
125
  prerelease: false
120
126
  version_requirements: !ruby/object:Gem::Requirement
121
127
  requirements:
122
128
  - - "~>"
123
129
  - !ruby/object:Gem::Version
124
- version: 1.65.0
130
+ version: 1.69.2
125
131
  - !ruby/object:Gem::Dependency
126
132
  name: rubocop-rails
127
133
  requirement: !ruby/object:Gem::Requirement
128
134
  requirements:
129
135
  - - "~>"
130
136
  - !ruby/object:Gem::Version
131
- version: 2.26.0
137
+ version: 2.28.0
132
138
  type: :development
133
139
  prerelease: false
134
140
  version_requirements: !ruby/object:Gem::Requirement
135
141
  requirements:
136
142
  - - "~>"
137
143
  - !ruby/object:Gem::Version
138
- version: 2.26.0
144
+ version: 2.28.0
139
145
  - !ruby/object:Gem::Dependency
140
146
  name: rubocop-rspec
141
147
  requirement: !ruby/object:Gem::Requirement