sequel-schema-sharding 0.13.1 → 0.13.2
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b98c0f0746590cbb1e82cb9168174082c30360b8
|
4
|
+
data.tar.gz: f8d580760294f88b947ee43625b3a37d63e9de9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: caa856b979c083ece5e0a44686bbf26a06fc8e5f1fd827dfb0665db2ab47b2e9bc453a1a812b70149b4ea4e847e93a405f3a67133842ef9048bfd22d2de72b8e
|
7
|
+
data.tar.gz: 310c68f1f3688d2c427e8e88a279a2f5c945846e29582eb31f877227765cc2adfda08ccb9e1bf13bd6d23811245dab40d88623016bd820b204594bd311ec8dcd
|
@@ -10,7 +10,7 @@ module Sequel
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def read_only_shard_for
|
13
|
-
@read_only_probe ||= provider.probe(:model, :read_only_shard_for, :string)
|
13
|
+
@read_only_probe ||= provider.probe(:model, :read_only_shard_for, :string, :integer)
|
14
14
|
end
|
15
15
|
|
16
16
|
def replica_hash_for
|
@@ -18,7 +18,7 @@ module Sequel
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def shard_for
|
21
|
-
@shard_for_probe ||= provider.probe(:model, :shard_for, :string)
|
21
|
+
@shard_for_probe ||= provider.probe(:model, :shard_for, :string, :integer)
|
22
22
|
end
|
23
23
|
|
24
24
|
def self.provider
|
@@ -49,19 +49,21 @@ module Sequel
|
|
49
49
|
# Return a valid Sequel::Dataset that is tied to the shard table and connection for the id and will load values
|
50
50
|
# run by the query into the model.
|
51
51
|
def shard_for(id)
|
52
|
-
Sequel::SchemaSharding::DTraceProvider.provider.shard_for.fire(id.to_s) if Sequel::SchemaSharding::DTraceProvider.provider.shard_for.enabled?
|
53
52
|
result = self.result_for(id)
|
54
53
|
ds = result.connection[schema_and_table(result)]
|
55
54
|
ds.row_proc = self
|
56
55
|
dataset_method_modules.each { |m| ds.instance_eval { extend(m) } }
|
57
56
|
ds.shard_number = result.shard_number
|
58
57
|
ds.model = self
|
59
|
-
ds
|
58
|
+
ds.tap do |d|
|
59
|
+
Sequel::SchemaSharding::DTraceProvider.provider.shard_for.fire(id.to_s, d.shard_number) if Sequel::SchemaSharding::DTraceProvider.provider.shard_for.enabled?
|
60
|
+
end
|
60
61
|
end
|
61
62
|
|
62
63
|
def read_only_shard_for(id)
|
63
|
-
|
64
|
-
|
64
|
+
shard_for(id).server(:read_only).tap do |d|
|
65
|
+
Sequel::SchemaSharding::DTraceProvider.provider.read_only_shard_for.fire(id.to_s, d.shard_number) if Sequel::SchemaSharding::DTraceProvider.provider.read_only_shard_for.enabled?
|
66
|
+
end
|
65
67
|
end
|
66
68
|
|
67
69
|
# The result of a lookup for the given id. See Sequel::SchemaSharding::Finder::Result
|
@@ -43,7 +43,7 @@ describe Sequel::SchemaSharding::DTraceProvider do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
it 'takes a string argument' do
|
46
|
-
expect(provider.read_only_shard_for.arguments).to eq([:string])
|
46
|
+
expect(provider.read_only_shard_for.arguments).to eq([:string, :integer])
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
@@ -61,7 +61,7 @@ describe Sequel::SchemaSharding::DTraceProvider do
|
|
61
61
|
end
|
62
62
|
|
63
63
|
it 'takes a string argument' do
|
64
|
-
expect(provider.read_only_shard_for.arguments).to eq([:string])
|
64
|
+
expect(provider.read_only_shard_for.arguments).to eq([:string, :integer])
|
65
65
|
end
|
66
66
|
end
|
67
67
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sequel-schema-sharding
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.13.
|
4
|
+
version: 0.13.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Henry
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-
|
13
|
+
date: 2014-11-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: sequel
|
@@ -174,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
174
174
|
version: '0'
|
175
175
|
requirements: []
|
176
176
|
rubyforge_project:
|
177
|
-
rubygems_version: 2.2.
|
177
|
+
rubygems_version: 2.2.2
|
178
178
|
signing_key:
|
179
179
|
specification_version: 4
|
180
180
|
summary: Create horizontally sharded Sequel models with Postgres
|