active_replicas 0.1.6 → 0.1.7

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: 79aa4f5186505c7c9a23809a4a0dee60e9a1530e
4
- data.tar.gz: '0332495f8e70cd11bb39ae1bd6019e9e97402f9e'
3
+ metadata.gz: 2506a129ec27e169dc050b24d1cac38bfe838aac
4
+ data.tar.gz: c9712f7e29a4864e13afd74bb3e9701863cb9460
5
5
  SHA512:
6
- metadata.gz: c238e428f63b3f56d433ae46ed2e5673442eb8c80eea3f1edded79f29881012980e232d031db13a64d43863d2858cfbc5afbbc873f85e1bb9e608dc6977b4250
7
- data.tar.gz: 85bcaa56e98c748f8e25aec00af426cec9eadd97e09890a14710382abf826703b8e1e19ede186e2719c74686538cea5f3d0bcf08f3755711f3ede2d2985c14bc
6
+ metadata.gz: 770acee1a9083324c4f90365ebb84a354c22860283e5175c9ee7670085ec4b8e53a0cf879412f13973951b6ea5876279583e64132027faf4216a57a0409dfea9
7
+ data.tar.gz: 633069d3114dc2c90e63d1e0280308ddf31ce089353e96e75353045bb9bac109b78cec13fad0d45ddf865d66c5b61e65ae50fb216d6c21316e79d4c15d988ef0
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- active_replicas (0.1.6)
4
+ active_replicas (0.1.7)
5
5
  concurrent-ruby (~> 1.0)
6
6
 
7
7
  GEM
@@ -61,6 +61,10 @@ module ActiveReplicas
61
61
  @connections.clear
62
62
  end
63
63
 
64
+ def with_connection(&block)
65
+ current_pool.with_connection(&block)
66
+ end
67
+
64
68
  def connected?
65
69
  current_pool.connected?
66
70
  end
@@ -5,14 +5,17 @@ module ActiveReplicas
5
5
  cattr_accessor :replica_delegated_methods
6
6
  cattr_accessor :primary_delegated_methods
7
7
 
8
- @@replica_delegated_methods = [
9
- :active?, :clear_query_cache, :column_name_for_operation, :columns,
10
- :disable_query_cache!, :disconnect!, :enable_query_cache!,
11
- :query_cache_enabled, :quote_column_name, :quote_table_name,
12
- :raw_connection, :reconnect!, :sanitize_limit, :schema_cache, :select,
13
- :select_all, :select_one, :select_rows, :select_value, :select_values,
14
- :substitute_at, :to_sql, :verify!
15
- ]
8
+ # All the methods which are safe to be delegated to a replica.
9
+ @@replica_delegated_methods = (
10
+ [
11
+ :active?, :clear_query_cache, :column_name_for_operation, :columns,
12
+ :disable_query_cache!, :disconnect!, :enable_query_cache!,
13
+ :query_cache_enabled, :quote_column_name, :quote_table_name,
14
+ :raw_connection, :reconnect!, :sanitize_limit, :schema_cache, :select,
15
+ :select_all, :select_one, :select_rows, :select_value, :select_values,
16
+ :substitute_at, :to_sql, :verify!
17
+ ]
18
+ ).uniq
16
19
 
17
20
  # Rails methods that translate to SQL DDL (data definition language).
18
21
  DDL_METHODS = [
@@ -30,12 +33,25 @@ module ActiveReplicas
30
33
  :delete, :insert, :truncate, :update
31
34
  ]
32
35
 
36
+ # Rails methods that query whether or not the adapter or database engine
37
+ # supports a given feature.
38
+ SUPPORTS_METHODS = [
39
+ :supports_ddl_transactions?, :supports_explain?, :supports_extensions?,
40
+ :supports_foreign_keys?, :supports_index_sort_order?,
41
+ :supports_materialized_views?, :supports_migrations?,
42
+ :supports_partial_index?, :supports_primary_key?, :supports_ranges?,
43
+ :supports_statement_cache?, :supports_transaction_isolation?,
44
+ :supports_views?
45
+ ]
46
+
33
47
  @@primary_delegated_methods = (
34
48
  DDL_METHODS +
35
49
  CRUD_METHODS +
50
+ SUPPORTS_METHODS +
36
51
  [
37
- :next_sequence_value, :prefetch_primary_key?, :transaction,
38
- :transaction_state
52
+ :assume_migrated_upto_version, :foreign_keys, :native_database_types,
53
+ :next_sequence_value, :prefetch_primary_key?, :tables,
54
+ :table_exists?, :transaction, :transaction_state
39
55
  ]
40
56
  ).uniq
41
57
 
@@ -1,3 +1,3 @@
1
1
  module ActiveReplicas
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_replicas
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dirk Gadsden