aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actioncable/lib/action_cable.rb2
-rw-r--r--actioncable/lib/action_cable/server/base.rb2
-rw-r--r--actioncable/lib/action_cable/server/configuration.rb8
-rw-r--r--actioncable/lib/action_cable/storage_adapter.rb7
-rw-r--r--actioncable/lib/action_cable/subscription_adapter.rb7
-rw-r--r--actioncable/lib/action_cable/subscription_adapter/base.rb (renamed from actioncable/lib/action_cable/storage_adapter/base.rb)2
-rw-r--r--actioncable/lib/action_cable/subscription_adapter/postgresql.rb (renamed from actioncable/lib/action_cable/storage_adapter/postgresql.rb)2
-rw-r--r--actioncable/lib/action_cable/subscription_adapter/redis.rb (renamed from actioncable/lib/action_cable/storage_adapter/redis.rb)2
-rw-r--r--actioncable/test/stubs/test_adapter.rb2
-rw-r--r--actioncable/test/stubs/test_server.rb4
-rw-r--r--actioncable/test/subscription_adapter/base_test.rb (renamed from actioncable/test/storage_adapter/base_test.rb)6
11 files changed, 23 insertions, 21 deletions
diff --git a/actioncable/lib/action_cable.rb b/actioncable/lib/action_cable.rb
index 5cc29ecd00..1dc66ef3ad 100644
--- a/actioncable/lib/action_cable.rb
+++ b/actioncable/lib/action_cable.rb
@@ -47,5 +47,5 @@ module ActionCable
autoload :Connection
autoload :Channel
autoload :RemoteConnections
- autoload :StorageAdapter
+ autoload :SubscriptionAdapter
end
diff --git a/actioncable/lib/action_cable/server/base.rb b/actioncable/lib/action_cable/server/base.rb
index 041dc5e890..f44d0fdfb7 100644
--- a/actioncable/lib/action_cable/server/base.rb
+++ b/actioncable/lib/action_cable/server/base.rb
@@ -47,7 +47,7 @@ module ActionCable
# Adapter used for all streams/broadcasting.
def adapter
- @adapter ||= config.storage_adapter.new(self)
+ @adapter ||= config.subscription_adapter.new(self)
end
# All the identifiers applied to the connection class associated with this server.
diff --git a/actioncable/lib/action_cable/server/configuration.rb b/actioncable/lib/action_cable/server/configuration.rb
index c43928d898..344ae0ad5d 100644
--- a/actioncable/lib/action_cable/server/configuration.rb
+++ b/actioncable/lib/action_cable/server/configuration.rb
@@ -30,12 +30,14 @@ module ActionCable
end
end
- # Returns constant of storage adapter specified in config/cable.yml
+ # Returns constant of subscription adapter specified in config/cable.yml
# If the adapter cannot be found, this will default to the Redis adapter
- def storage_adapter
+ def subscription_adapter
# Defaults to redis if no adapter is set
adapter = cable.fetch('adapter') { 'redis' }
- "ActionCable::StorageAdapter::#{adapter.camelize}".constantize
+ adapter.camelize
+ adapter = 'PostgreSQL' if adapter == 'Postgresql'
+ "ActionCable::SubscriptionAdapter::#{adapter}".constantize
end
end
end
diff --git a/actioncable/lib/action_cable/storage_adapter.rb b/actioncable/lib/action_cable/storage_adapter.rb
deleted file mode 100644
index a4fe12c770..0000000000
--- a/actioncable/lib/action_cable/storage_adapter.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-module ActionCable
- module StorageAdapter
- autoload :Base, 'action_cable/storage_adapter/base'
- autoload :PostgreSQL, 'action_cable/storage_adapter/postgresql'
- autoload :Redis, 'action_cable/storage_adapter/redis'
- end
-end
diff --git a/actioncable/lib/action_cable/subscription_adapter.rb b/actioncable/lib/action_cable/subscription_adapter.rb
new file mode 100644
index 0000000000..287d2b9611
--- /dev/null
+++ b/actioncable/lib/action_cable/subscription_adapter.rb
@@ -0,0 +1,7 @@
+module ActionCable
+ module SubscriptionAdapter
+ autoload :Base, 'action_cable/subscription_adapter/base'
+ autoload :PostgreSQL, 'action_cable/subscription_adapter/postgresql'
+ autoload :Redis, 'action_cable/subscription_adapter/redis'
+ end
+end
diff --git a/actioncable/lib/action_cable/storage_adapter/base.rb b/actioncable/lib/action_cable/subscription_adapter/base.rb
index 4330bc28f1..11910803e8 100644
--- a/actioncable/lib/action_cable/storage_adapter/base.rb
+++ b/actioncable/lib/action_cable/subscription_adapter/base.rb
@@ -1,5 +1,5 @@
module ActionCable
- module StorageAdapter
+ module SubscriptionAdapter
class Base
attr_reader :logger, :server
diff --git a/actioncable/lib/action_cable/storage_adapter/postgresql.rb b/actioncable/lib/action_cable/subscription_adapter/postgresql.rb
index 1d8460e2ea..f55b56a2b5 100644
--- a/actioncable/lib/action_cable/storage_adapter/postgresql.rb
+++ b/actioncable/lib/action_cable/subscription_adapter/postgresql.rb
@@ -7,7 +7,7 @@ rescue Gem::LoadError => e
end
module ActionCable
- module StorageAdapter
+ module SubscriptionAdapter
class PostgreSQL < Base
# The storage instance used for broadcasting. Not intended for direct user use.
def broadcast(channel, payload)
diff --git a/actioncable/lib/action_cable/storage_adapter/redis.rb b/actioncable/lib/action_cable/subscription_adapter/redis.rb
index 62a3971ec7..c6d8371f16 100644
--- a/actioncable/lib/action_cable/storage_adapter/redis.rb
+++ b/actioncable/lib/action_cable/subscription_adapter/redis.rb
@@ -6,7 +6,7 @@ rescue Gem::LoadError => e
end
module ActionCable
- module StorageAdapter
+ module SubscriptionAdapter
class Redis < Base
def broadcast(channel, payload)
redis_conn.publish(channel, payload)
diff --git a/actioncable/test/stubs/test_adapter.rb b/actioncable/test/stubs/test_adapter.rb
index c18ca5dc9d..bbd142b287 100644
--- a/actioncable/test/stubs/test_adapter.rb
+++ b/actioncable/test/stubs/test_adapter.rb
@@ -1,4 +1,4 @@
-class SuccessAdapter < ActionCable::StorageAdapter::Base
+class SuccessAdapter < ActionCable::SubscriptionAdapter::Base
def broadcast(channel, payload)
end
diff --git a/actioncable/test/stubs/test_server.rb b/actioncable/test/stubs/test_server.rb
index e1eb9f113a..067266ed57 100644
--- a/actioncable/test/stubs/test_server.rb
+++ b/actioncable/test/stubs/test_server.rb
@@ -7,11 +7,11 @@ class TestServer
def initialize
@logger = ActiveSupport::TaggedLogging.new ActiveSupport::Logger.new(StringIO.new)
- @config = OpenStruct.new(log_tags: [], storage_adapter: SuccessAdapter)
+ @config = OpenStruct.new(log_tags: [], subscription_adapter: SuccessAdapter)
end
def adapter
- @config.storage_adapter.new(self)
+ @config.subscription_adapter.new(self)
end
def send_async
diff --git a/actioncable/test/storage_adapter/base_test.rb b/actioncable/test/subscription_adapter/base_test.rb
index 47632df387..7a7ae131e6 100644
--- a/actioncable/test/storage_adapter/base_test.rb
+++ b/actioncable/test/subscription_adapter/base_test.rb
@@ -1,15 +1,15 @@
require 'test_helper'
require 'stubs/test_server'
-class ActionCable::StorageAdapter::BaseTest < ActionCable::TestCase
+class ActionCable::SubscriptionAdapter::BaseTest < ActionCable::TestCase
## TEST THAT ERRORS ARE RETURNED FOR INHERITORS THAT DON'T OVERRIDE METHODS
- class BrokenAdapter < ActionCable::StorageAdapter::Base
+ class BrokenAdapter < ActionCable::SubscriptionAdapter::Base
end
setup do
@server = TestServer.new
- @server.config.storage_adapter = BrokenAdapter
+ @server.config.subscription_adapter = BrokenAdapter
@server.config.allowed_request_origins = %w( http://rubyonrails.com )
end