ecco 0.3.1-java → 0.4.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rspec +1 -0
- data/.travis.yml +22 -1
- data/README.md +18 -1
- data/Rakefile +7 -1
- data/Vagrantfile +11 -0
- data/bin/all_specs +3 -0
- data/bin/specs +3 -0
- data/ecco.gemspec +2 -0
- data/lib/ecco/client.rb +14 -0
- data/lib/ecco/error.rb +6 -0
- data/lib/ecco/version.rb +1 -1
- data/vagrant/files/ecco-my.cnf +5 -0
- data/vagrant/playbook.yml +27 -0
- metadata +42 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd1b527dc35566172d3b9365bf81b4a13f474855
|
4
|
+
data.tar.gz: d8537a4cb9aa49ccfe4ff2c203d2157d22b521a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21ebf8126ab13e13635514f67c8b9635516f37dad9d87710f95e4c211cf4a1da465273e3a8422ccf4b688ba2b240cbd085b6afde5524bb9257620604a5e13e37
|
7
|
+
data.tar.gz: 13fac62a6a3089741ca5176bb7163ddc21482e15571e6bb1ce078d4b5cd634a6608eaf70341ee856c46b56b81f944b905c8eb29d7f6a709857ddd96212d38545
|
data/.gitignore
CHANGED
data/.rspec
CHANGED
data/.travis.yml
CHANGED
@@ -1,5 +1,26 @@
|
|
1
|
+
sudo: true
|
2
|
+
|
1
3
|
language: ruby
|
2
|
-
|
4
|
+
|
5
|
+
services:
|
6
|
+
- mysql
|
7
|
+
|
8
|
+
before_install:
|
9
|
+
- rvm get head
|
10
|
+
- rvm use jruby-9.0.3.0 --install
|
11
|
+
- printf "[mysqld]\nlog-bin=mysql-bin\nserver-id=1\nbinlog-format=ROW\n" | sudo tee /etc/mysql/conf.d/binlog.cnf
|
12
|
+
- sudo service mysql restart
|
13
|
+
- mysql -u root -e 'create database ecco_test;'
|
14
|
+
- gem install bundler -v 1.10.6
|
15
|
+
|
16
|
+
env:
|
17
|
+
global:
|
18
|
+
- DATABASE_USER=root
|
19
|
+
- DATABASE_PASS=""
|
20
|
+
- DATABASE_URL=jdbc:mysql://localhost:3306/ecco_test
|
21
|
+
|
22
|
+
script: bin/all_specs
|
23
|
+
|
3
24
|
notifications:
|
4
25
|
email: false
|
5
26
|
hipchat:
|
data/README.md
CHANGED
@@ -69,7 +69,7 @@ Note: You need Maven to download
|
|
69
69
|
|
70
70
|
Run the tests
|
71
71
|
|
72
|
-
|
72
|
+
bin/specs
|
73
73
|
|
74
74
|
For an interactive prompt
|
75
75
|
|
@@ -79,6 +79,22 @@ To install this gem onto your local machine
|
|
79
79
|
|
80
80
|
bundle exec rake install
|
81
81
|
|
82
|
+
### Integration tests
|
83
|
+
|
84
|
+
The integration tests don't run by default. To run all the tests, including integration, use
|
85
|
+
|
86
|
+
bin/all_specs
|
87
|
+
|
88
|
+
The tests needs a MySQL server with replication enabled.
|
89
|
+
|
90
|
+
Ecco includes a Vagrant machine, that can be used for this. Note that your Vagrant host need to have [Ansible] installed as it is used for provisioning.
|
91
|
+
|
92
|
+
Just start it before running the tests
|
93
|
+
|
94
|
+
vagrant up
|
95
|
+
|
96
|
+
*Note: Stop any local mysql servers first as it forwards mysql to localhost:3306.*
|
97
|
+
|
82
98
|
## Release
|
83
99
|
|
84
100
|
To release a new version, update the version number in `version.rb`, and then run
|
@@ -92,3 +108,4 @@ which will create a git tag for the version, push git commits and tags, and push
|
|
92
108
|
The gem is available as open source under the terms of the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0).
|
93
109
|
|
94
110
|
[mysql-binlog-connector-java]: https://github.com/shyiko/mysql-binlog-connector-java
|
111
|
+
[Ansible]: http://www.ansible.com/
|
data/Rakefile
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
2
|
require "rspec/core/rake_task"
|
3
3
|
|
4
|
-
RSpec::Core::RakeTask.new(:spec)
|
4
|
+
RSpec::Core::RakeTask.new(:spec) do |task|
|
5
|
+
task.exclude_pattern = "spec/integration/*_spec.rb"
|
6
|
+
end
|
7
|
+
|
8
|
+
namespace :spec do
|
9
|
+
RSpec::Core::RakeTask.new(:all)
|
10
|
+
end
|
5
11
|
|
6
12
|
task :default => :spec
|
7
13
|
|
data/Vagrantfile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
Vagrant.configure("2") do |config|
|
2
|
+
config.vm.define "ecco-test" do |ubuntu|
|
3
|
+
ubuntu.vm.hostname = "ecco-test"
|
4
|
+
ubuntu.vm.box = "ubuntu/trusty64"
|
5
|
+
ubuntu.vm.provision :ansible do |ansible|
|
6
|
+
ansible.playbook = "vagrant/playbook.yml"
|
7
|
+
end
|
8
|
+
|
9
|
+
ubuntu.vm.network :forwarded_port, host: 3306, guest: 3306
|
10
|
+
end
|
11
|
+
end
|
data/bin/all_specs
ADDED
data/bin/specs
ADDED
data/ecco.gemspec
CHANGED
@@ -22,4 +22,6 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_development_dependency "bundler", "~> 1.10"
|
23
23
|
spec.add_development_dependency "rake", "~> 10.0"
|
24
24
|
spec.add_development_dependency "rspec"
|
25
|
+
spec.add_development_dependency "sequel"
|
26
|
+
spec.add_development_dependency "jdbc-mysql"
|
25
27
|
end
|
data/lib/ecco/client.rb
CHANGED
@@ -1,15 +1,19 @@
|
|
1
1
|
require "ext/mysql-binlog-connector-java-#{Ecco::MYSQL_BINLOG_CONNECTOR_VERSION}.jar"
|
2
2
|
require "ecco/row_event_listener"
|
3
3
|
require "ecco/save_event_listener"
|
4
|
+
require "ecco/error"
|
4
5
|
|
5
6
|
module Ecco
|
6
7
|
class Client
|
8
|
+
DEFAULT_CONNECT_TIMEOUT = 3000 # ms
|
9
|
+
|
7
10
|
extend Forwardable
|
8
11
|
def_delegators :@client, :set_server_id, :get_server_id
|
9
12
|
def_delegators :@client, :set_binlog_filename, :get_binlog_filename
|
10
13
|
def_delegators :@client, :set_binlog_position, :get_binlog_position
|
11
14
|
|
12
15
|
java_import com.github.shyiko.mysql.binlog.BinaryLogClient
|
16
|
+
java_import java.io.IOException
|
13
17
|
|
14
18
|
def initialize(hostname: "localhost", port: 3306, username:, password:)
|
15
19
|
@client = BinaryLogClient.new(hostname, port, username, password)
|
@@ -31,6 +35,16 @@ module Ecco
|
|
31
35
|
|
32
36
|
def start
|
33
37
|
@client.connect
|
38
|
+
rescue IOException => e
|
39
|
+
raise Ecco::Error::ConnectionError, e.get_message
|
40
|
+
end
|
41
|
+
|
42
|
+
def start_in_thread(connect_timeout: DEFAULT_CONNECT_TIMEOUT)
|
43
|
+
@client.connect(connect_timeout)
|
44
|
+
end
|
45
|
+
|
46
|
+
def stop
|
47
|
+
@client.disconnect
|
34
48
|
end
|
35
49
|
end
|
36
50
|
end
|
data/lib/ecco/error.rb
ADDED
data/lib/ecco/version.rb
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
---
|
2
|
+
- hosts: all
|
3
|
+
sudo: yes
|
4
|
+
tasks:
|
5
|
+
|
6
|
+
- name: Update package cache
|
7
|
+
apt: update_cache=yes
|
8
|
+
|
9
|
+
- name: Install ansible dependencies
|
10
|
+
apt: name={{ item }}
|
11
|
+
with_items:
|
12
|
+
- python-mysqldb
|
13
|
+
|
14
|
+
- name: Install mysql server
|
15
|
+
apt: name=mysql-server state=present
|
16
|
+
|
17
|
+
- name: Copy mysql config file
|
18
|
+
copy: src=files/ecco-my.cnf dest=/etc/mysql/conf.d/
|
19
|
+
|
20
|
+
- name: Allow mysql root connection from remote hosts
|
21
|
+
mysql_user: name=root password="" host=% priv=*.*:ALL state=present
|
22
|
+
|
23
|
+
- name: Restart mysql
|
24
|
+
service: name=mysql state=restarted
|
25
|
+
|
26
|
+
- name: Create database
|
27
|
+
mysql_db: name=ecco_test
|
metadata
CHANGED
@@ -1,57 +1,85 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ecco
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Twingly AB
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - "~>"
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: '1.10'
|
14
19
|
name: bundler
|
20
|
+
prerelease: false
|
21
|
+
type: :development
|
15
22
|
version_requirements: !ruby/object:Gem::Requirement
|
16
23
|
requirements:
|
17
24
|
- - "~>"
|
18
25
|
- !ruby/object:Gem::Version
|
19
26
|
version: '1.10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
20
28
|
requirement: !ruby/object:Gem::Requirement
|
21
29
|
requirements:
|
22
30
|
- - "~>"
|
23
31
|
- !ruby/object:Gem::Version
|
24
|
-
version: '
|
32
|
+
version: '10.0'
|
33
|
+
name: rake
|
25
34
|
prerelease: false
|
26
35
|
type: :development
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
36
|
version_requirements: !ruby/object:Gem::Requirement
|
30
37
|
requirements:
|
31
38
|
- - "~>"
|
32
39
|
- !ruby/object:Gem::Version
|
33
40
|
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
34
42
|
requirement: !ruby/object:Gem::Requirement
|
35
43
|
requirements:
|
36
|
-
- - "
|
44
|
+
- - ">="
|
37
45
|
- !ruby/object:Gem::Version
|
38
|
-
version: '
|
46
|
+
version: '0'
|
47
|
+
name: rspec
|
39
48
|
prerelease: false
|
40
49
|
type: :development
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
|
-
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
name: sequel
|
62
|
+
prerelease: false
|
63
|
+
type: :development
|
43
64
|
version_requirements: !ruby/object:Gem::Requirement
|
44
65
|
requirements:
|
45
66
|
- - ">="
|
46
67
|
- !ruby/object:Gem::Version
|
47
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
48
70
|
requirement: !ruby/object:Gem::Requirement
|
49
71
|
requirements:
|
50
72
|
- - ">="
|
51
73
|
- !ruby/object:Gem::Version
|
52
74
|
version: '0'
|
75
|
+
name: jdbc-mysql
|
53
76
|
prerelease: false
|
54
77
|
type: :development
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
55
83
|
description: MySQL replication binlog parser using mysql-binlog-connector-java.
|
56
84
|
email:
|
57
85
|
- support@twingly.com
|
@@ -66,10 +94,14 @@ files:
|
|
66
94
|
- Gemfile
|
67
95
|
- README.md
|
68
96
|
- Rakefile
|
97
|
+
- Vagrantfile
|
98
|
+
- bin/all_specs
|
69
99
|
- bin/console
|
100
|
+
- bin/specs
|
70
101
|
- ecco.gemspec
|
71
102
|
- lib/ecco.rb
|
72
103
|
- lib/ecco/client.rb
|
104
|
+
- lib/ecco/error.rb
|
73
105
|
- lib/ecco/event_listener.rb
|
74
106
|
- lib/ecco/row_event.rb
|
75
107
|
- lib/ecco/row_event_listener.rb
|
@@ -77,6 +109,8 @@ files:
|
|
77
109
|
- lib/ecco/version.rb
|
78
110
|
- lib/ext/mysql-binlog-connector-java-0.2.4.jar
|
79
111
|
- pom.xml
|
112
|
+
- vagrant/files/ecco-my.cnf
|
113
|
+
- vagrant/playbook.yml
|
80
114
|
homepage: https://github.com/twingly/ecco
|
81
115
|
licenses:
|
82
116
|
- Apache-2.0
|