async-mysql 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +13 -0
- data/.rspec +4 -0
- data/.travis.yml +21 -0
- data/Gemfile +14 -0
- data/README.md +65 -0
- data/Rakefile +14 -0
- data/async-mysql.gemspec +27 -0
- data/examples/rack/config.ru +26 -0
- data/lib/active_record/connection_adapters/async_mysql_adapter.rb +27 -0
- data/lib/async/mysql.rb +22 -0
- data/lib/async/mysql/client.rb +51 -0
- data/lib/async/mysql/pool.rb +112 -0
- data/lib/async/mysql/version.rb +25 -0
- data/spec/activerecord/connection_spec.rb +28 -0
- data/spec/async/mysql/client_spec.rb +18 -0
- data/spec/spec_helper.rb +30 -0
- metadata +161 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b996e0d3b933ddc339252f9a4aa516eedde0802f6176ae56715e2de78a6ff671
|
4
|
+
data.tar.gz: 83b7be26aaa4c6208ca589d08bd37bef7e31bba65e46acca3c65cacd86b07d4b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: cf4eecdf457fb171f8c2e8fca944f3a63934640c7cf013edd6c0578e0b0c7beb7f06e2bea6522e9784e59483621c93d6c8053586c6719e9a57ca187cee10e218
|
7
|
+
data.tar.gz: b2d4c8553aa2c4e456793d23bc6d1832b3afa85434185b9b61fcbdd65b6d1a7e5278f535f032e7021fcafbaa93ea944db8914d139be52b1df5ed35b2d482ba6b
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
language: ruby
|
2
|
+
sudo: false
|
3
|
+
dist: trusty
|
4
|
+
cache: bundler
|
5
|
+
services:
|
6
|
+
- mysqlql
|
7
|
+
before_script:
|
8
|
+
- psql -c 'create database test;' -U mysql
|
9
|
+
rvm:
|
10
|
+
- 2.2
|
11
|
+
- 2.3
|
12
|
+
- 2.4
|
13
|
+
- 2.5
|
14
|
+
- jruby-head
|
15
|
+
- ruby-head
|
16
|
+
- rbx-3
|
17
|
+
matrix:
|
18
|
+
allow_failures:
|
19
|
+
- rvm: ruby-head
|
20
|
+
- rvm: jruby-head
|
21
|
+
- rvm: rbx-3
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
# Async::MySQL
|
2
|
+
|
3
|
+
This is an experimental drop in wrapper to make MySQL work asynchronously, including an ActiveRecord connection adapter.
|
4
|
+
|
5
|
+
## Motivation
|
6
|
+
|
7
|
+
We have some IO bound web APIs generating statistics and we sometimes have issues when using [passenger] due to thread/process exhaustion. In addition, we make a lot of upstream HTTP RPCs and these are also IO bound.
|
8
|
+
|
9
|
+
This library, in combination with [async-http], ensure that we don't become IO bound in many cases. In addition, we don't need to tune the intermediate server as it will simply scale according to backend resource availability and IO throughput.
|
10
|
+
|
11
|
+
[passenger]: https://github.com/phusion/passenger
|
12
|
+
[async-http]: https://github.com/socketry/async-http
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
Add this line to your application's Gemfile:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
gem 'async-mysql'
|
20
|
+
```
|
21
|
+
|
22
|
+
And then execute:
|
23
|
+
|
24
|
+
$ bundle
|
25
|
+
|
26
|
+
Or install it yourself as:
|
27
|
+
|
28
|
+
$ gem install async-mysql
|
29
|
+
|
30
|
+
## Usage
|
31
|
+
|
32
|
+
Use the `async_mysql` adapter, as in `adapter: async_mysql` in your database configuration. This is a drop-in replacement for the MySQL adapter for ActiveRecord. But, it must be used with an [async] capable server like [falcon].
|
33
|
+
|
34
|
+
[async]: https://github.com/socketry/async
|
35
|
+
[falcon]: https://github.com/socketry/falcon
|
36
|
+
|
37
|
+
## Contributing
|
38
|
+
|
39
|
+
1. Fork it
|
40
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
41
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
42
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
43
|
+
5. Create new Pull Request
|
44
|
+
|
45
|
+
## License
|
46
|
+
|
47
|
+
Copyright, 2018, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
48
|
+
|
49
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
50
|
+
of this software and associated documentation files (the "Software"), to deal
|
51
|
+
in the Software without restriction, including without limitation the rights
|
52
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
53
|
+
copies of the Software, and to permit persons to whom the Software is
|
54
|
+
furnished to do so, subject to the following conditions:
|
55
|
+
|
56
|
+
The above copyright notice and this permission notice shall be included in
|
57
|
+
all copies or substantial portions of the Software.
|
58
|
+
|
59
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
60
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
61
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
62
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
63
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
64
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
65
|
+
THE SOFTWARE.
|
data/Rakefile
ADDED
data/async-mysql.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
require_relative 'lib/async/mysql/version'
|
3
|
+
|
4
|
+
Gem::Specification.new do |spec|
|
5
|
+
spec.name = "async-mysql"
|
6
|
+
spec.version = Async::MySQL::VERSION
|
7
|
+
spec.authors = ["Samuel Williams"]
|
8
|
+
spec.email = ["samuel.williams@oriontransfer.co.nz"]
|
9
|
+
spec.summary = %q{Access mysql without blocking.}
|
10
|
+
spec.homepage = "https://github.com/socketry/async-mysql"
|
11
|
+
spec.license = "MIT"
|
12
|
+
|
13
|
+
spec.files = `git ls-files`.split($/)
|
14
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
15
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
16
|
+
spec.require_paths = ["lib"]
|
17
|
+
|
18
|
+
spec.add_dependency "async", "~> 1.3"
|
19
|
+
spec.add_dependency "mysql2"
|
20
|
+
|
21
|
+
spec.add_development_dependency "async-rspec"
|
22
|
+
spec.add_development_dependency "activerecord"
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
25
|
+
spec.add_development_dependency "rspec", "~> 3.6"
|
26
|
+
spec.add_development_dependency "rake"
|
27
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
$LOAD_PATH << "../../lib"
|
3
|
+
|
4
|
+
gem 'mysql2'
|
5
|
+
require 'active_record'
|
6
|
+
|
7
|
+
if defined?(Falcon)
|
8
|
+
$stderr.puts "Loading async/mysql"
|
9
|
+
require_relative '../../lib/async/mysql'
|
10
|
+
|
11
|
+
ActiveRecord::Base.establish_connection(adapter: "async_mysql", database: "test", pool: 1024)
|
12
|
+
else
|
13
|
+
ActiveRecord::Base.establish_connection(adapter: "mysql2", database: "test", pool: 1024)
|
14
|
+
end
|
15
|
+
|
16
|
+
# ActiveRecord::Base.logger = Logger.new(STDOUT)
|
17
|
+
|
18
|
+
run lambda {|env|
|
19
|
+
10.times do
|
20
|
+
ActiveRecord::Base.connection.execute("SELECT SLEEP(0.01)")
|
21
|
+
end
|
22
|
+
|
23
|
+
ActiveRecord::Base.clear_active_connections!
|
24
|
+
|
25
|
+
[200, {}, ["Hello World"]]
|
26
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "active_record/connection_adapters/mysql2_adapter"
|
4
|
+
|
5
|
+
module ActiveRecord
|
6
|
+
module ConnectionHandling
|
7
|
+
def async_mysql_connection(config)
|
8
|
+
config = config.symbolize_keys
|
9
|
+
|
10
|
+
if config[:flags].kind_of? Array
|
11
|
+
config[:flags].push "FOUND_ROWS".freeze
|
12
|
+
else
|
13
|
+
config[:flags] ||= 0
|
14
|
+
config[:flags] |= Mysql2::Client::FOUND_ROWS
|
15
|
+
end
|
16
|
+
|
17
|
+
client = Async::MySQL::Client.new(config)
|
18
|
+
ConnectionAdapters::Mysql2Adapter.new(client, logger, nil, config)
|
19
|
+
rescue Mysql2::Error => error
|
20
|
+
if error.message.include?("Unknown database")
|
21
|
+
raise ActiveRecord::NoDatabaseError
|
22
|
+
else
|
23
|
+
raise
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/async/mysql.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# Copyright, 2018, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
11
|
+
# all copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
# THE SOFTWARE.
|
20
|
+
|
21
|
+
require_relative "mysql/version"
|
22
|
+
require_relative "mysql/client"
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# Copyright, 2018, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
11
|
+
# all copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
# THE SOFTWARE.
|
20
|
+
|
21
|
+
require 'async/wrapper'
|
22
|
+
|
23
|
+
require 'mysql2'
|
24
|
+
|
25
|
+
module Async
|
26
|
+
module MySQL
|
27
|
+
class Client < Wrapper
|
28
|
+
def initialize(config, reactor = nil)
|
29
|
+
@client = ::Mysql2::Client.new(config)
|
30
|
+
|
31
|
+
super(::IO.for_fd(@client.socket), reactor)
|
32
|
+
end
|
33
|
+
|
34
|
+
def query(sql, **options)
|
35
|
+
@client.query(sql, async: true, **options)
|
36
|
+
|
37
|
+
wait_readable
|
38
|
+
|
39
|
+
return @client.async_result
|
40
|
+
end
|
41
|
+
|
42
|
+
def respond_to?(*args)
|
43
|
+
@client.respond_to(*args)
|
44
|
+
end
|
45
|
+
|
46
|
+
def method_missing(*args)
|
47
|
+
@client.send(*args)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
# Copyright, 2018, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
11
|
+
# all copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
# THE SOFTWARE.
|
20
|
+
|
21
|
+
require 'async/reactor'
|
22
|
+
|
23
|
+
module Async
|
24
|
+
class Reactor < Node
|
25
|
+
attr_accessor :mysql_pools
|
26
|
+
end
|
27
|
+
|
28
|
+
module MySQL
|
29
|
+
class Proxy
|
30
|
+
def initialize(connection_string, task: Task.current)
|
31
|
+
@connection_string = connection_string
|
32
|
+
|
33
|
+
pools = task.reactor.mysql_pools ||= {}
|
34
|
+
|
35
|
+
@pool = pools[@connection_string] ||= Pool.new do
|
36
|
+
Connection.new(@connection_string)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def close
|
41
|
+
@pool.close
|
42
|
+
end
|
43
|
+
|
44
|
+
def async_exec(*args)
|
45
|
+
@pool.acquire do |connection|
|
46
|
+
connection.async_exec(*args)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def respond_to?(*args)
|
51
|
+
@pool.acquire do |connection|
|
52
|
+
connection.respond_to?(*args)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def method_missing(*args, &block)
|
57
|
+
@pool.acquire do |connection|
|
58
|
+
connection.send(*args, &block)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# This pool doesn't impose a maximum number of open resources, but it WILL block if there are no available resources and trying to allocate another one fails.
|
64
|
+
class Pool
|
65
|
+
def initialize(&block)
|
66
|
+
@available = []
|
67
|
+
@waiting = []
|
68
|
+
|
69
|
+
@constructor = block
|
70
|
+
end
|
71
|
+
|
72
|
+
def acquire
|
73
|
+
resource = wait_for_next_available
|
74
|
+
|
75
|
+
begin
|
76
|
+
yield resource
|
77
|
+
ensure
|
78
|
+
@available << resource
|
79
|
+
|
80
|
+
if task = @waiting.pop
|
81
|
+
task.resume
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def close
|
87
|
+
@available.each(&:close)
|
88
|
+
@available.clear
|
89
|
+
end
|
90
|
+
|
91
|
+
def wait_for_next_available
|
92
|
+
until resource = next_available
|
93
|
+
@waiting << Fiber.current
|
94
|
+
Task.yield
|
95
|
+
end
|
96
|
+
|
97
|
+
return resource
|
98
|
+
end
|
99
|
+
|
100
|
+
def next_available
|
101
|
+
if @available.empty?
|
102
|
+
return @constructor.call # This might fail, which is okay :)
|
103
|
+
else
|
104
|
+
return @available.pop
|
105
|
+
end
|
106
|
+
rescue StandardError
|
107
|
+
$stderr.puts $!.inspect
|
108
|
+
return nil
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Copyright, 2018, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
11
|
+
# all copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
# THE SOFTWARE.
|
20
|
+
|
21
|
+
module Async
|
22
|
+
module MySQL
|
23
|
+
VERSION = "0.1.0"
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
require 'active_record'
|
3
|
+
|
4
|
+
class Book < ActiveRecord::Base
|
5
|
+
end
|
6
|
+
|
7
|
+
RSpec.describe ActiveRecord do
|
8
|
+
include_context Async::RSpec::Reactor
|
9
|
+
|
10
|
+
it "should work using async adapter" do
|
11
|
+
reactor.async do
|
12
|
+
ActiveRecord::Base.establish_connection(adapter: "async_mysql", database: "test")
|
13
|
+
ActiveRecord::Base.logger = Logger.new(STDOUT)
|
14
|
+
|
15
|
+
ActiveRecord::Schema.define do
|
16
|
+
create_table :books, force: true do |t|
|
17
|
+
t.string :name
|
18
|
+
t.timestamps
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
Book.create(name: "How to use a fork")
|
23
|
+
|
24
|
+
# This closes the underlying connection.
|
25
|
+
ActiveRecord::Base.remove_connection
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
|
2
|
+
require 'async/mysql/client'
|
3
|
+
|
4
|
+
RSpec.describe Async::MySQL::Client do
|
5
|
+
include_context Async::RSpec::Reactor
|
6
|
+
|
7
|
+
let(:connection) {Async::MySQL::Client.new(host: 'localhost', database: 'test')}
|
8
|
+
|
9
|
+
it "should execute query" do
|
10
|
+
reactor.async do
|
11
|
+
results = connection.query("SELECT 42 AS LIFE")
|
12
|
+
|
13
|
+
expect(results.each.to_a).to be == [{"LIFE" => 42}]
|
14
|
+
|
15
|
+
connection.close
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
if ENV['COVERAGE']
|
3
|
+
begin
|
4
|
+
require 'simplecov'
|
5
|
+
|
6
|
+
SimpleCov.start do
|
7
|
+
add_filter "/spec/"
|
8
|
+
end
|
9
|
+
|
10
|
+
if ENV['TRAVIS']
|
11
|
+
require 'coveralls'
|
12
|
+
Coveralls.wear!
|
13
|
+
end
|
14
|
+
rescue LoadError
|
15
|
+
warn "Could not load simplecov: #{$!}"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
require "bundler/setup"
|
20
|
+
require "async/mysql"
|
21
|
+
require 'async/rspec'
|
22
|
+
|
23
|
+
RSpec.configure do |config|
|
24
|
+
# Enable flags like --only-failures and --next-failure
|
25
|
+
config.example_status_persistence_file_path = ".rspec_status"
|
26
|
+
|
27
|
+
config.expect_with :rspec do |c|
|
28
|
+
c.syntax = :expect
|
29
|
+
end
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,161 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: async-mysql
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Samuel Williams
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-04-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: async
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: mysql2
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: async-rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: activerecord
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: bundler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.3'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.3'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.6'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.6'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description:
|
112
|
+
email:
|
113
|
+
- samuel.williams@oriontransfer.co.nz
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- ".gitignore"
|
119
|
+
- ".rspec"
|
120
|
+
- ".travis.yml"
|
121
|
+
- Gemfile
|
122
|
+
- README.md
|
123
|
+
- Rakefile
|
124
|
+
- async-mysql.gemspec
|
125
|
+
- examples/rack/config.ru
|
126
|
+
- lib/active_record/connection_adapters/async_mysql_adapter.rb
|
127
|
+
- lib/async/mysql.rb
|
128
|
+
- lib/async/mysql/client.rb
|
129
|
+
- lib/async/mysql/pool.rb
|
130
|
+
- lib/async/mysql/version.rb
|
131
|
+
- spec/activerecord/connection_spec.rb
|
132
|
+
- spec/async/mysql/client_spec.rb
|
133
|
+
- spec/spec_helper.rb
|
134
|
+
homepage: https://github.com/socketry/async-mysql
|
135
|
+
licenses:
|
136
|
+
- MIT
|
137
|
+
metadata: {}
|
138
|
+
post_install_message:
|
139
|
+
rdoc_options: []
|
140
|
+
require_paths:
|
141
|
+
- lib
|
142
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - ">="
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0'
|
147
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
requirements: []
|
153
|
+
rubyforge_project:
|
154
|
+
rubygems_version: 2.7.6
|
155
|
+
signing_key:
|
156
|
+
specification_version: 4
|
157
|
+
summary: Access mysql without blocking.
|
158
|
+
test_files:
|
159
|
+
- spec/activerecord/connection_spec.rb
|
160
|
+
- spec/async/mysql/client_spec.rb
|
161
|
+
- spec/spec_helper.rb
|