janus-ar 8.0.1 → 8.1.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 +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +24 -24
- data/README.md +24 -1
- data/janus-ar.gemspec +6 -4
- data/lib/janus-ar/adapter_extensions.rb +5 -0
- data/lib/janus-ar/client.rb +6 -6
- data/lib/janus-ar/db_console_config.rb +17 -17
- data/lib/janus-ar/logging/logger.rb +15 -15
- data/lib/janus-ar/logging/subscriber.rb +27 -27
- data/lib/janus-ar/query_director.rb +9 -3
- data/lib/janus-ar/version.rb +2 -2
- metadata +8 -31
- data/.bundle/config +0 -5
- data/.github/dependabot.yml +0 -7
- data/.github/workflows/ci.yml +0 -68
- data/.github/workflows/publish.yml +0 -25
- data/.gitignore +0 -3
- data/.rspec +0 -3
- data/.rubocop.yml +0 -29
- data/assets/.gitkeep +0 -1
- data/assets/janus-logo.png +0 -0
- data/bin/release.sh +0 -4
- data/gemfiles/activerecord_8_0.gemfile +0 -7
- data/gemfiles/activerecord_8_1.gemfile +0 -7
- data/spec/lib/janus-ar/active_record/connection_adapters/janus_mysql_adapter_spec.rb +0 -78
- data/spec/lib/janus-ar/active_record/connection_adapters/janus_trilogy_adapter_spec.rb +0 -77
- data/spec/lib/janus-ar/client_spec.rb +0 -7
- data/spec/lib/janus-ar/context_spec.rb +0 -118
- data/spec/lib/janus-ar/db_console_config_spec.rb +0 -28
- data/spec/lib/janus-ar/logging/logger_spec.rb +0 -31
- data/spec/lib/janus-ar/logging/subscriber_spec.rb +0 -58
- data/spec/lib/janus-ar/query_director_spec.rb +0 -141
- data/spec/shared_examples/a_mysql_like_server.rb +0 -155
- data/spec/spec_helper.rb +0 -46
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cd05e24e1306fce67609a9e991fddad6c4d7014ce58f696a01eb64317838e837
|
|
4
|
+
data.tar.gz: d07db4e1d21a6363ed9f0f1ea41736b1d71d1ae0fd6c419f34f15e5f74e8825f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9bc3a5029f1b51374051a2c6f8ccc743192780bae4eaaafe18ea6578d9fb77826760ae95a6714bb5ea8f3cd128ef51a3247d39416ae78b8af7b5554ee652ab64
|
|
7
|
+
data.tar.gz: 0fc71666876765b84cc70ddc4ffc016cd175ae8594fb68dd0a442b047a27aced86e5597ebb1fcf3cebc10d00e81081f8ff63122fcacc4eefa680a89c0fdc4ca2
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
janus-ar (8.
|
|
4
|
+
janus-ar (8.1.0)
|
|
5
5
|
activerecord (>= 8.0, < 9.0)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
|
-
remote:
|
|
8
|
+
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
|
-
activemodel (8.1.3)
|
|
11
|
-
activesupport (= 8.1.3)
|
|
12
|
-
activerecord (8.1.3)
|
|
13
|
-
activemodel (= 8.1.3)
|
|
14
|
-
activesupport (= 8.1.3)
|
|
10
|
+
activemodel (8.1.3.1)
|
|
11
|
+
activesupport (= 8.1.3.1)
|
|
12
|
+
activerecord (8.1.3.1)
|
|
13
|
+
activemodel (= 8.1.3.1)
|
|
14
|
+
activesupport (= 8.1.3.1)
|
|
15
15
|
timeout (>= 0.4.0)
|
|
16
|
-
activesupport (8.1.3)
|
|
16
|
+
activesupport (8.1.3.1)
|
|
17
17
|
base64
|
|
18
18
|
bigdecimal
|
|
19
19
|
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
@@ -30,15 +30,15 @@ GEM
|
|
|
30
30
|
base64 (0.3.0)
|
|
31
31
|
bigdecimal (4.1.2)
|
|
32
32
|
coderay (1.1.3)
|
|
33
|
-
concurrent-ruby (1.3.
|
|
33
|
+
concurrent-ruby (1.3.8)
|
|
34
34
|
connection_pool (3.0.2)
|
|
35
35
|
diff-lcs (1.6.2)
|
|
36
36
|
drb (2.2.3)
|
|
37
|
-
i18n (1.
|
|
37
|
+
i18n (1.15.2)
|
|
38
38
|
concurrent-ruby (~> 1.0)
|
|
39
39
|
io-console (0.8.2)
|
|
40
|
-
json (2.
|
|
41
|
-
language_server-protocol (3.17.0.
|
|
40
|
+
json (2.21.2)
|
|
41
|
+
language_server-protocol (3.17.0.6)
|
|
42
42
|
lint_roller (1.1.0)
|
|
43
43
|
logger (1.7.0)
|
|
44
44
|
method_source (1.1.0)
|
|
@@ -48,7 +48,7 @@ GEM
|
|
|
48
48
|
mysql2 (0.5.7)
|
|
49
49
|
bigdecimal
|
|
50
50
|
parallel (1.28.0)
|
|
51
|
-
parser (3.3.
|
|
51
|
+
parser (3.3.12.0)
|
|
52
52
|
ast (~> 2.4.1)
|
|
53
53
|
racc
|
|
54
54
|
prism (1.9.0)
|
|
@@ -57,7 +57,7 @@ GEM
|
|
|
57
57
|
method_source (~> 1.0)
|
|
58
58
|
reline (>= 0.6.0)
|
|
59
59
|
racc (1.8.1)
|
|
60
|
-
rack (3.2.
|
|
60
|
+
rack (3.2.7)
|
|
61
61
|
rainbow (3.1.1)
|
|
62
62
|
rake (13.4.2)
|
|
63
63
|
regexp_parser (2.12.0)
|
|
@@ -76,8 +76,8 @@ GEM
|
|
|
76
76
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
77
77
|
rspec-support (~> 3.13.0)
|
|
78
78
|
rspec-support (3.13.7)
|
|
79
|
-
rubocop (1.
|
|
80
|
-
json (
|
|
79
|
+
rubocop (1.90.0)
|
|
80
|
+
json (>= 2.3)
|
|
81
81
|
language_server-protocol (~> 3.17.0.2)
|
|
82
82
|
lint_roller (~> 1.1.0)
|
|
83
83
|
parallel (>= 1.10)
|
|
@@ -87,18 +87,18 @@ GEM
|
|
|
87
87
|
rubocop-ast (>= 1.49.0, < 2.0)
|
|
88
88
|
ruby-progressbar (~> 1.7)
|
|
89
89
|
unicode-display_width (>= 2.4.0, < 4.0)
|
|
90
|
-
rubocop-ast (1.
|
|
90
|
+
rubocop-ast (1.50.0)
|
|
91
91
|
parser (>= 3.3.7.2)
|
|
92
92
|
prism (~> 1.7)
|
|
93
|
-
rubocop-performance (1.
|
|
93
|
+
rubocop-performance (1.27.0)
|
|
94
94
|
lint_roller (~> 1.1)
|
|
95
|
-
rubocop (>= 1.
|
|
95
|
+
rubocop (>= 1.89.0, < 2.0)
|
|
96
96
|
rubocop-ast (>= 1.47.1, < 2.0)
|
|
97
|
-
rubocop-rails (2.
|
|
97
|
+
rubocop-rails (2.37.0)
|
|
98
98
|
activesupport (>= 4.2.0)
|
|
99
99
|
lint_roller (~> 1.1)
|
|
100
100
|
rack (>= 1.1)
|
|
101
|
-
rubocop (>= 1.
|
|
101
|
+
rubocop (>= 1.89.0, < 2.0)
|
|
102
102
|
rubocop-ast (>= 1.44.0, < 2.0)
|
|
103
103
|
rubocop-rspec (3.10.2)
|
|
104
104
|
lint_roller (~> 1.1)
|
|
@@ -111,7 +111,7 @@ GEM
|
|
|
111
111
|
ruby-progressbar (1.13.0)
|
|
112
112
|
securerandom (0.4.1)
|
|
113
113
|
timeout (0.6.1)
|
|
114
|
-
trilogy (2.
|
|
114
|
+
trilogy (2.13.0)
|
|
115
115
|
bigdecimal
|
|
116
116
|
tzinfo (2.0.6)
|
|
117
117
|
concurrent-ruby (~> 1.0)
|
|
@@ -131,9 +131,9 @@ DEPENDENCIES
|
|
|
131
131
|
pry
|
|
132
132
|
rake
|
|
133
133
|
rspec (~> 3)
|
|
134
|
-
rubocop (~> 1.
|
|
134
|
+
rubocop (~> 1.90.0)
|
|
135
135
|
rubocop-performance
|
|
136
|
-
rubocop-rails (~> 2.
|
|
136
|
+
rubocop-rails (~> 2.37.0)
|
|
137
137
|
rubocop-rspec
|
|
138
138
|
rubocop-thread_safety
|
|
139
139
|
trilogy
|
data/README.md
CHANGED
|
@@ -119,7 +119,7 @@ There are some edge cases:
|
|
|
119
119
|
* `SET` operations will be sent to all connections
|
|
120
120
|
* Execution of specific methods such as `connect!`, `disconnect!`, `reconnect!`, and `clear_cache!` are invoked on all underlying connections
|
|
121
121
|
* Calls inside a transaction will always be sent to the primary (otherwise changes from within the transaction could not be read back on most transaction isolation levels)
|
|
122
|
-
* Locking reads (e.g. `SELECT ... FOR UPDATE`) will always be sent to the primary
|
|
122
|
+
* Locking reads (e.g. `SELECT ... FOR UPDATE`, `FOR UPDATE SKIP LOCKED`, `FOR SHARE`, `LOCK IN SHARE MODE`, `GET_LOCK(...)`) will always be sent to the primary
|
|
123
123
|
|
|
124
124
|
# Notes
|
|
125
125
|
|
|
@@ -128,3 +128,26 @@ Janus does not support Rails' read/write split or sharding using `with_connectio
|
|
|
128
128
|
# Acknowlegements
|
|
129
129
|
|
|
130
130
|
Amazing project logo by @undevelopedbruce.
|
|
131
|
+
|
|
132
|
+
## Releasing
|
|
133
|
+
|
|
134
|
+
Releases are cut from the [GitHub Releases UI](https://github.com/OLIOEX/janus-ar/releases/new).
|
|
135
|
+
Publishing to RubyGems is automatic — there is nothing to bump by hand, and no
|
|
136
|
+
API key to rotate (authentication uses RubyGems
|
|
137
|
+
[trusted publishing](https://guides.rubygems.org/trusted-publishing/) over OIDC).
|
|
138
|
+
|
|
139
|
+
To release:
|
|
140
|
+
|
|
141
|
+
1. Create a new release against the head of `main`, with a tag named
|
|
142
|
+
`vMAJOR.MINOR.PATCH` — e.g. `v8.1.0`. Pre-release suffixes use a dot, as
|
|
143
|
+
RubyGems requires: `v8.1.0.rc1`, not `v8.1.0-rc1`.
|
|
144
|
+
2. Publish it.
|
|
145
|
+
|
|
146
|
+
[`.github/workflows/publish.yml`](.github/workflows/publish.yml) then takes the
|
|
147
|
+
version from the tag, writes it into `lib/janus-ar/version.rb`, refreshes
|
|
148
|
+
`Gemfile.lock`, commits that bump to `main` as `Release vX.Y.Z`, moves the tag
|
|
149
|
+
onto that commit, and pushes the gem.
|
|
150
|
+
|
|
151
|
+
Because the bump is committed to `main`, releases must be created from its head
|
|
152
|
+
— the workflow refuses to publish if the tag sits anywhere else. You never need
|
|
153
|
+
to edit `version.rb` yourself; the tag is the source of truth.
|
data/janus-ar.gemspec
CHANGED
|
@@ -13,8 +13,10 @@ Gem::Specification.new do |gem|
|
|
|
13
13
|
'source_code_uri' => 'https://github.com/olioex/janus-ar',
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
gem.
|
|
16
|
+
ignored = %r{^(bin|spec|assets|gemfiles|\.github)/|^\.}
|
|
17
|
+
gem.files = `git ls-files`.split($OUTPUT_RECORD_SEPARATOR).grep_v(ignored)
|
|
18
|
+
# The gem ships no executables; bin/ holds repository maintenance scripts.
|
|
19
|
+
gem.executables = []
|
|
18
20
|
gem.name = 'janus-ar'
|
|
19
21
|
gem.require_paths = %w(lib)
|
|
20
22
|
gem.version = Janus::VERSION
|
|
@@ -28,8 +30,8 @@ Gem::Specification.new do |gem|
|
|
|
28
30
|
gem.add_development_dependency 'pry'
|
|
29
31
|
gem.add_development_dependency 'rake'
|
|
30
32
|
gem.add_development_dependency 'rspec', '~> 3'
|
|
31
|
-
gem.add_development_dependency 'rubocop', '~> 1.
|
|
32
|
-
gem.add_development_dependency 'rubocop-rails', '~> 2.
|
|
33
|
+
gem.add_development_dependency 'rubocop', '~> 1.90.0'
|
|
34
|
+
gem.add_development_dependency 'rubocop-rails', '~> 2.37.0'
|
|
33
35
|
gem.add_development_dependency 'rubocop-rspec'
|
|
34
36
|
gem.add_development_dependency 'rubocop-thread_safety'
|
|
35
37
|
gem.add_development_dependency 'rubocop-performance'
|
data/lib/janus-ar/client.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
module Janus
|
|
3
|
-
class Client
|
|
4
|
-
FOUND_ROWS = 2
|
|
5
|
-
end
|
|
6
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
module Janus
|
|
3
|
+
class Client
|
|
4
|
+
FOUND_ROWS = 2
|
|
5
|
+
end
|
|
6
|
+
end
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Janus
|
|
4
|
-
class DbConsoleConfig
|
|
5
|
-
def initialize(config)
|
|
6
|
-
@_config = config.configuration_hash
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def configuration_hash
|
|
10
|
-
@_config[:janus]['replica'].symbolize_keys
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def database
|
|
14
|
-
@_config[:database]
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Janus
|
|
4
|
+
class DbConsoleConfig
|
|
5
|
+
def initialize(config)
|
|
6
|
+
@_config = config.configuration_hash
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def configuration_hash
|
|
10
|
+
@_config[:janus]['replica'].symbolize_keys
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def database
|
|
14
|
+
@_config[:database]
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Janus
|
|
4
|
-
module Logging
|
|
5
|
-
class Logger
|
|
6
|
-
class << self
|
|
7
|
-
def log(message, format = :info)
|
|
8
|
-
logger&.send(format, "[Janus] #{message}")
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
attr_accessor :logger
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Janus
|
|
4
|
+
module Logging
|
|
5
|
+
class Logger
|
|
6
|
+
class << self
|
|
7
|
+
def log(message, format = :info)
|
|
8
|
+
logger&.send(format, "[Janus] #{message}")
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
attr_accessor :logger
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Janus
|
|
4
|
-
module Logging
|
|
5
|
-
module Subscriber
|
|
6
|
-
IGNORE_PAYLOAD_NAMES = %w(SCHEMA EXPLAIN).freeze
|
|
7
|
-
|
|
8
|
-
def sql(event)
|
|
9
|
-
name = event.payload[:name]
|
|
10
|
-
unless IGNORE_PAYLOAD_NAMES.include?(name)
|
|
11
|
-
name = [current_wrapper_name(event), name].compact.join(' ')
|
|
12
|
-
event.payload[:name] = name
|
|
13
|
-
end
|
|
14
|
-
super(event)
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
protected
|
|
18
|
-
|
|
19
|
-
def current_wrapper_name(_event)
|
|
20
|
-
connection = Janus::Context.last_used_connection
|
|
21
|
-
return nil unless connection
|
|
22
|
-
|
|
23
|
-
"[#{connection}]"
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Janus
|
|
4
|
+
module Logging
|
|
5
|
+
module Subscriber
|
|
6
|
+
IGNORE_PAYLOAD_NAMES = %w(SCHEMA EXPLAIN).freeze
|
|
7
|
+
|
|
8
|
+
def sql(event)
|
|
9
|
+
name = event.payload[:name]
|
|
10
|
+
unless IGNORE_PAYLOAD_NAMES.include?(name)
|
|
11
|
+
name = [current_wrapper_name(event), name].compact.join(' ')
|
|
12
|
+
event.payload[:name] = name
|
|
13
|
+
end
|
|
14
|
+
super(event)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
protected
|
|
18
|
+
|
|
19
|
+
def current_wrapper_name(_event)
|
|
20
|
+
connection = Janus::Context.last_used_connection
|
|
21
|
+
return nil unless connection
|
|
22
|
+
|
|
23
|
+
"[#{connection}]"
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -5,10 +5,16 @@ module Janus
|
|
|
5
5
|
REPLICA = :replica
|
|
6
6
|
PRIMARY = :primary
|
|
7
7
|
|
|
8
|
+
LOCK_FUNCTIONS = %w(
|
|
9
|
+
nextval currval lastval get_lock release_lock is_free_lock is_used_lock
|
|
10
|
+
pg_advisory_lock pg_advisory_unlock
|
|
11
|
+
).freeze
|
|
12
|
+
|
|
8
13
|
SQL_PRIMARY_MATCHERS = [
|
|
9
|
-
/\A\s*select
|
|
10
|
-
/\A\s*select
|
|
11
|
-
/\A\s*
|
|
14
|
+
/\A\s*select\b.*\bfor\s+(update|share)\b/im,
|
|
15
|
+
/\A\s*select\b.*\block\s+in\s+share\s+mode\b/im,
|
|
16
|
+
/\A\s*select\b.*\b(#{LOCK_FUNCTIONS.join('|')})\s*\(/im,
|
|
17
|
+
/\A\s*show\b/i,
|
|
12
18
|
].freeze
|
|
13
19
|
SQL_REPLICA_MATCHERS = [/\A\s*(select|with.+\)\s*select)\s/i].freeze
|
|
14
20
|
SQL_ALL_MATCHERS = [/\A\s*set\s/i].freeze
|
data/lib/janus-ar/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: janus-ar
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 8.0
|
|
4
|
+
version: 8.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Lloyd Watkin
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: activerecord
|
|
@@ -119,28 +119,28 @@ dependencies:
|
|
|
119
119
|
requirements:
|
|
120
120
|
- - "~>"
|
|
121
121
|
- !ruby/object:Gem::Version
|
|
122
|
-
version: 1.
|
|
122
|
+
version: 1.90.0
|
|
123
123
|
type: :development
|
|
124
124
|
prerelease: false
|
|
125
125
|
version_requirements: !ruby/object:Gem::Requirement
|
|
126
126
|
requirements:
|
|
127
127
|
- - "~>"
|
|
128
128
|
- !ruby/object:Gem::Version
|
|
129
|
-
version: 1.
|
|
129
|
+
version: 1.90.0
|
|
130
130
|
- !ruby/object:Gem::Dependency
|
|
131
131
|
name: rubocop-rails
|
|
132
132
|
requirement: !ruby/object:Gem::Requirement
|
|
133
133
|
requirements:
|
|
134
134
|
- - "~>"
|
|
135
135
|
- !ruby/object:Gem::Version
|
|
136
|
-
version: 2.
|
|
136
|
+
version: 2.37.0
|
|
137
137
|
type: :development
|
|
138
138
|
prerelease: false
|
|
139
139
|
version_requirements: !ruby/object:Gem::Requirement
|
|
140
140
|
requirements:
|
|
141
141
|
- - "~>"
|
|
142
142
|
- !ruby/object:Gem::Version
|
|
143
|
-
version: 2.
|
|
143
|
+
version: 2.37.0
|
|
144
144
|
- !ruby/object:Gem::Dependency
|
|
145
145
|
name: rubocop-rspec
|
|
146
146
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -186,29 +186,16 @@ dependencies:
|
|
|
186
186
|
description: Read/Write proxy for ActiveRecord using primary/replica databases
|
|
187
187
|
email:
|
|
188
188
|
- lloyd@olioex.com
|
|
189
|
-
executables:
|
|
190
|
-
- release.sh
|
|
189
|
+
executables: []
|
|
191
190
|
extensions: []
|
|
192
191
|
extra_rdoc_files: []
|
|
193
192
|
files:
|
|
194
|
-
- ".bundle/config"
|
|
195
|
-
- ".github/dependabot.yml"
|
|
196
|
-
- ".github/workflows/ci.yml"
|
|
197
|
-
- ".github/workflows/publish.yml"
|
|
198
|
-
- ".gitignore"
|
|
199
|
-
- ".rspec"
|
|
200
|
-
- ".rubocop.yml"
|
|
201
193
|
- CODE_OF_CONDUCT.md
|
|
202
194
|
- Gemfile
|
|
203
195
|
- Gemfile.lock
|
|
204
196
|
- LICENSE
|
|
205
197
|
- README.md
|
|
206
198
|
- Rakefile
|
|
207
|
-
- assets/.gitkeep
|
|
208
|
-
- assets/janus-logo.png
|
|
209
|
-
- bin/release.sh
|
|
210
|
-
- gemfiles/activerecord_8_0.gemfile
|
|
211
|
-
- gemfiles/activerecord_8_1.gemfile
|
|
212
199
|
- janus-ar.gemspec
|
|
213
200
|
- lib/janus-ar.rb
|
|
214
201
|
- lib/janus-ar/active_record/connection_adapters/janus_mysql2_adapter.rb
|
|
@@ -222,16 +209,6 @@ files:
|
|
|
222
209
|
- lib/janus-ar/query_director.rb
|
|
223
210
|
- lib/janus-ar/railtie.rb
|
|
224
211
|
- lib/janus-ar/version.rb
|
|
225
|
-
- spec/lib/janus-ar/active_record/connection_adapters/janus_mysql_adapter_spec.rb
|
|
226
|
-
- spec/lib/janus-ar/active_record/connection_adapters/janus_trilogy_adapter_spec.rb
|
|
227
|
-
- spec/lib/janus-ar/client_spec.rb
|
|
228
|
-
- spec/lib/janus-ar/context_spec.rb
|
|
229
|
-
- spec/lib/janus-ar/db_console_config_spec.rb
|
|
230
|
-
- spec/lib/janus-ar/logging/logger_spec.rb
|
|
231
|
-
- spec/lib/janus-ar/logging/subscriber_spec.rb
|
|
232
|
-
- spec/lib/janus-ar/query_director_spec.rb
|
|
233
|
-
- spec/shared_examples/a_mysql_like_server.rb
|
|
234
|
-
- spec/spec_helper.rb
|
|
235
212
|
homepage: https://github.com/olioex/janus-ar
|
|
236
213
|
licenses:
|
|
237
214
|
- MIT
|
|
@@ -251,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
251
228
|
- !ruby/object:Gem::Version
|
|
252
229
|
version: '0'
|
|
253
230
|
requirements: []
|
|
254
|
-
rubygems_version: 3.6.
|
|
231
|
+
rubygems_version: 3.6.9
|
|
255
232
|
specification_version: 4
|
|
256
233
|
summary: Read/Write proxy for ActiveRecord using primary/replica databases
|
|
257
234
|
test_files: []
|
data/.bundle/config
DELETED
data/.github/dependabot.yml
DELETED
data/.github/workflows/ci.yml
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
name: CI
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- main
|
|
7
|
-
pull_request:
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
build:
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
strategy:
|
|
13
|
-
fail-fast: false
|
|
14
|
-
matrix:
|
|
15
|
-
ruby:
|
|
16
|
-
- '3.2'
|
|
17
|
-
- '3.3'
|
|
18
|
-
- '3.4'
|
|
19
|
-
- '4.0'
|
|
20
|
-
gemfile:
|
|
21
|
-
- gemfiles/activerecord_8_0.gemfile
|
|
22
|
-
- gemfiles/activerecord_8_1.gemfile
|
|
23
|
-
name: Ruby ${{ matrix.ruby }} / ${{ matrix.gemfile }}
|
|
24
|
-
env:
|
|
25
|
-
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
|
26
|
-
services:
|
|
27
|
-
mysql:
|
|
28
|
-
image: mysql:8.0
|
|
29
|
-
env:
|
|
30
|
-
MYSQL_DATABASE: test
|
|
31
|
-
MYSQL_ROOT_PASSWORD: password
|
|
32
|
-
MYSQL_USER: test
|
|
33
|
-
MYSQL_PASSWORD: test_password
|
|
34
|
-
ports:
|
|
35
|
-
- 3306:3306
|
|
36
|
-
options: >-
|
|
37
|
-
--health-cmd "mysqladmin ping"
|
|
38
|
-
--health-interval 10s
|
|
39
|
-
--health-timeout 5s
|
|
40
|
-
--health-retries 5
|
|
41
|
-
steps:
|
|
42
|
-
- uses: actions/checkout@v4
|
|
43
|
-
- uses: ruby/setup-ruby@v1
|
|
44
|
-
with:
|
|
45
|
-
ruby-version: ${{ matrix.ruby }}
|
|
46
|
-
bundler-cache: true
|
|
47
|
-
- run: |
|
|
48
|
-
mysql -e "CREATE USER 'replica'@'%' IDENTIFIED BY 'replica_password';" -u root -p${{ env.MYSQL_PASSWORD || 'password' }} -h 127.0.0.1
|
|
49
|
-
mysql -e "GRANT SELECT ON test.* TO 'replica'@'%'" -u root -p${{ env.MYSQL_PASSWORD || 'password' }} -h 127.0.0.1
|
|
50
|
-
|
|
51
|
-
mysql -e "CREATE USER 'primary'@'%' IDENTIFIED BY 'primary_password';" -u root -p${{ env.MYSQL_PASSWORD || 'password' }} -h 127.0.0.1
|
|
52
|
-
mysql -e "GRANT ALL PRIVILEGES ON *.* TO 'primary'@'%';" -u root -p${{ env.MYSQL_PASSWORD || 'password' }} -h 127.0.0.1
|
|
53
|
-
mysql -e "FLUSH PRIVILEGES;" -u root -p${{ env.MYSQL_PASSWORD || 'password' }} -h 127.0.0.1
|
|
54
|
-
- run: |
|
|
55
|
-
bundle exec rspec
|
|
56
|
-
env:
|
|
57
|
-
MYSQL_HOST: 127.0.0.1
|
|
58
|
-
RAILS_ENV: test
|
|
59
|
-
RuboCop:
|
|
60
|
-
runs-on: ubuntu-latest
|
|
61
|
-
steps:
|
|
62
|
-
- uses: actions/checkout@v4
|
|
63
|
-
- uses: ruby/setup-ruby@v1
|
|
64
|
-
with:
|
|
65
|
-
ruby-version: '3.2'
|
|
66
|
-
bundler-cache: true
|
|
67
|
-
- run: |
|
|
68
|
-
bundle exec rubocop --parallel --color
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
name: Publish GEM
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
tags:
|
|
6
|
-
- v*
|
|
7
|
-
jobs:
|
|
8
|
-
push:
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
|
-
|
|
11
|
-
permissions:
|
|
12
|
-
contents: write
|
|
13
|
-
id-token: write
|
|
14
|
-
|
|
15
|
-
steps:
|
|
16
|
-
# Set up
|
|
17
|
-
- uses: actions/checkout@v4
|
|
18
|
-
- name: Set up Ruby
|
|
19
|
-
uses: ruby/setup-ruby@v1
|
|
20
|
-
with:
|
|
21
|
-
bundler-cache: true
|
|
22
|
-
ruby-version: ruby
|
|
23
|
-
|
|
24
|
-
# Release
|
|
25
|
-
- uses: rubygems/release-gem@v1
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.rubocop.yml
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
inherit_from:
|
|
2
|
-
- https://tech.olioex.com/.support/rubocop-styling-v1.0
|
|
3
|
-
|
|
4
|
-
require:
|
|
5
|
-
- rubocop-rails
|
|
6
|
-
|
|
7
|
-
AllCops:
|
|
8
|
-
SuggestExtensions: false
|
|
9
|
-
|
|
10
|
-
Style/Documentation:
|
|
11
|
-
Enabled: false
|
|
12
|
-
|
|
13
|
-
Rails/Delegate:
|
|
14
|
-
Enabled: false
|
|
15
|
-
|
|
16
|
-
Metrics/BlockLength:
|
|
17
|
-
Exclude:
|
|
18
|
-
- spec/**/*
|
|
19
|
-
|
|
20
|
-
Style/GlobalVars:
|
|
21
|
-
Exclude:
|
|
22
|
-
- 'spec/**/*'
|
|
23
|
-
|
|
24
|
-
Naming/FileName:
|
|
25
|
-
Exclude:
|
|
26
|
-
- lib/janus-ar.rb
|
|
27
|
-
|
|
28
|
-
Metrics/AbcSize:
|
|
29
|
-
Max: 25
|
data/assets/.gitkeep
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
data/assets/janus-logo.png
DELETED
|
Binary file
|
data/bin/release.sh
DELETED