data_fabric 1.0.0 → 1.0.1
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.
- data/README.rdoc +5 -5
- data/Rakefile +0 -9
- data/TESTING.rdoc +4 -6
- data/data_fabric.gemspec +3 -3
- data/example/db/s0_test.sqlite3 +0 -0
- data/example/db/s1_test.sqlite3 +0 -0
- data/example/db/test.sqlite3 +0 -0
- data/lib/data_fabric/version.rb +1 -1
- data/lib/data_fabric.rb +7 -6
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -21,23 +21,23 @@ You describe the topology for your database infrastructure in your model(s).
|
|
21
21
|
Different models can use different topologies.
|
22
22
|
|
23
23
|
class MyHugeVolumeOfDataModel < ActiveRecord::Base
|
24
|
-
|
24
|
+
data_fabric :replicated => true, :shard_by => :city
|
25
25
|
end
|
26
26
|
|
27
27
|
There are four supported modes of operation, depending on the options given to the
|
28
|
-
|
28
|
+
data_fabric method. The plugin will look for connections in your
|
29
29
|
config/database.yml with the following convention:
|
30
30
|
|
31
31
|
No connection topology:
|
32
32
|
#{environment} - this is the default, as with ActiveRecord, e.g. "production"
|
33
33
|
|
34
|
-
|
34
|
+
data_fabric :replicated => true
|
35
35
|
#{environment}_#{role} - no sharding, just replication, where role is "master" or "slave", e.g. "production_master"
|
36
36
|
|
37
|
-
|
37
|
+
data_fabric :shard_by => :city
|
38
38
|
#{group}_#{shard}_#{environment} - sharding, no replication, e.g. "city_austin_production"
|
39
39
|
|
40
|
-
|
40
|
+
data_fabric :replicated => true, :shard_by => :city
|
41
41
|
#{group}_#{shard}_#{environment}_#{role} - sharding with replication, e.g. "city_austin_production_master"
|
42
42
|
|
43
43
|
|
data/Rakefile
CHANGED
@@ -14,15 +14,6 @@ Echoe.new 'data_fabric' do |p|
|
|
14
14
|
p.include_rakefile = true
|
15
15
|
end
|
16
16
|
|
17
|
-
require 'rake/testtask'
|
18
|
-
|
19
|
-
RAILS_ROOT=File.dirname(__FILE__)
|
20
|
-
|
21
|
-
Rake::TestTask.new do |t|
|
22
|
-
t.test_files = FileList['test/*_test.rb']
|
23
|
-
t.verbose = true
|
24
|
-
end
|
25
|
-
|
26
17
|
task :pretest do
|
27
18
|
setup(false)
|
28
19
|
end
|
data/TESTING.rdoc
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
There are two layers of tests: unit tests and integration tests.
|
1
|
+
data_fabric has two layers of tests: unit tests and integration tests.
|
4
2
|
|
5
3
|
|
6
4
|
== Running the Unit Tests
|
@@ -22,9 +20,9 @@ Run the Rake task to prepare the application for testing. This will copy the la
|
|
22
20
|
to vendor/plugins, delete existing databases and migrate all the databases from scratch. You should
|
23
21
|
then be able to run the example application's tests.
|
24
22
|
|
25
|
-
cd example
|
26
|
-
rake app:prepare
|
27
|
-
rake test
|
23
|
+
cd example
|
24
|
+
rake app:prepare
|
25
|
+
rake test
|
28
26
|
|
29
27
|
|
30
28
|
== Submitting Bugs
|
data/data_fabric.gemspec
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
|
2
|
-
# Gem::Specification for Data_fabric-1.0.
|
2
|
+
# Gem::Specification for Data_fabric-1.0.1
|
3
3
|
# Originally generated by Echoe
|
4
4
|
|
5
5
|
--- !ruby/object:Gem::Specification
|
6
6
|
name: data_fabric
|
7
7
|
version: !ruby/object:Gem::Version
|
8
|
-
version: 1.0.
|
8
|
+
version: 1.0.1
|
9
9
|
platform: ruby
|
10
10
|
authors:
|
11
11
|
- Mike Perham
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
|
15
|
-
date: 2008-07-
|
15
|
+
date: 2008-07-09 00:00:00 -05:00
|
16
16
|
default_executable:
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
data/example/db/s0_test.sqlite3
CHANGED
Binary file
|
data/example/db/s1_test.sqlite3
CHANGED
Binary file
|
data/example/db/test.sqlite3
CHANGED
Binary file
|
data/lib/data_fabric/version.rb
CHANGED
data/lib/data_fabric.rb
CHANGED
@@ -5,21 +5,21 @@ require 'active_record/version'
|
|
5
5
|
# You need to describe the topology for your database infrastructure in your model(s). As with ActiveRecord normally, different models can use different topologies.
|
6
6
|
#
|
7
7
|
# class MyHugeVolumeOfDataModel < ActiveRecord::Base
|
8
|
-
#
|
8
|
+
# data_fabric :replicated => true, :shard_by => :city
|
9
9
|
# end
|
10
10
|
#
|
11
|
-
# There are four supported modes of operation, depending on the options given to the
|
11
|
+
# There are four supported modes of operation, depending on the options given to the data_fabric method. The plugin will look for connections in your config/database.yml with the following convention:
|
12
12
|
#
|
13
13
|
# No connection topology:
|
14
14
|
# #{environment} - this is the default, as with ActiveRecord, e.g. "production"
|
15
15
|
#
|
16
|
-
#
|
16
|
+
# data_fabric :replicated => true
|
17
17
|
# #{environment}_#{role} - no sharding, just replication, where role is "master" or "slave", e.g. "production_master"
|
18
18
|
#
|
19
|
-
#
|
19
|
+
# data_fabric :shard_by => :city
|
20
20
|
# #{group}_#{shard}_#{environment} - sharding, no replication, e.g. "city_austin_production"
|
21
21
|
#
|
22
|
-
#
|
22
|
+
# data_fabric :replicated => true, :shard_by => :city
|
23
23
|
# #{group}_#{shard}_#{environment}_#{role} - sharding with replication, e.g. "city_austin_production_master"
|
24
24
|
#
|
25
25
|
#
|
@@ -92,13 +92,14 @@ module DataFabric
|
|
92
92
|
|
93
93
|
# Class methods injected into ActiveRecord::Base
|
94
94
|
module ClassMethods
|
95
|
-
def
|
95
|
+
def data_fabric(options)
|
96
96
|
proxy = DataFabric::ConnectionProxy.new(self, options)
|
97
97
|
ActiveRecord::Base.active_connections[name] = proxy
|
98
98
|
|
99
99
|
raise ArgumentError, "data_fabric does not support ActiveRecord's allow_concurrency = true" if allow_concurrency
|
100
100
|
DataFabric.logger.info "Creating data_fabric proxy for class #{name}"
|
101
101
|
end
|
102
|
+
alias :connection_topology :data_fabric # legacy
|
102
103
|
end
|
103
104
|
|
104
105
|
class StringProxy
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: data_fabric
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Perham
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-07-
|
12
|
+
date: 2008-07-09 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|