Class: Cassandra::LoadBalancing::Policy Abstract
- Inherits:
-
Object
- Object
- Cassandra::LoadBalancing::Policy
- Defined in:
- lib/cassandra/load_balancing.rb
Overview
Actual load balancing policies don't need to extend this class, only implement its methods. This class exists for documentation purposes only.
Direct Known Subclasses
Cassandra::LoadBalancing::Policies::DCAwareRoundRobin, Cassandra::LoadBalancing::Policies::RoundRobin, Cassandra::LoadBalancing::Policies::TokenAware, Cassandra::LoadBalancing::Policies::WhiteList
Instance Method Summary collapse
-
#distance(host) ⇒ Symbol
Returns a distance that determines how many connections (if any) the driver will open to the host.
- #host_down(host) ⇒ Object
- #host_found(host) ⇒ Object
- #host_lost(host) ⇒ Object
- #host_up(host) ⇒ Object
-
#inspect ⇒ String
A console-friendly representation of this policy.
-
#plan(keyspace, statement, options) ⇒ Cassandra::LoadBalancing::Plan
Load balancing plan is used to determine the order in which hosts should be tried in case of a network failure.
-
#setup(cluster) ⇒ void
Allows policy to initialize with the cluster instance.
-
#teardown(cluster) ⇒ void
Allows policy to release any external resources it might be holding.
Instance Method Details
#distance(host) ⇒ Symbol
Returns a distance that determines how many connections (if any) the driver will open to the host.
68 69 |
# File 'lib/cassandra/load_balancing.rb', line 68 def distance(host) end |
#host_down(host) ⇒ Object
51 52 |
# File 'lib/cassandra/load_balancing.rb', line 51 def host_down(host) end |
#host_found(host) ⇒ Object
55 56 |
# File 'lib/cassandra/load_balancing.rb', line 55 def host_found(host) end |
#host_lost(host) ⇒ Object
59 60 |
# File 'lib/cassandra/load_balancing.rb', line 59 def host_lost(host) end |
#host_up(host) ⇒ Object
47 48 |
# File 'lib/cassandra/load_balancing.rb', line 47 def host_up(host) end |
#inspect ⇒ String
Returns a console-friendly representation of this policy.
85 86 87 |
# File 'lib/cassandra/load_balancing.rb', line 85 def inspect "#<#{self.class.name}:0x#{self.object_id.to_s(16)}>" end |
#plan(keyspace, statement, options) ⇒ Cassandra::LoadBalancing::Plan
Hosts that should be ignored, must not be included in the Plan
Load balancing plan is used to determine the order in which hosts should be tried in case of a network failure.
81 82 |
# File 'lib/cassandra/load_balancing.rb', line 81 def plan(keyspace, statement, ) end |
#setup(cluster) ⇒ void
This method returns an undefined value.
Allows policy to initialize with the cluster instance. This method is called once before connecting to the cluster.
34 35 |
# File 'lib/cassandra/load_balancing.rb', line 34 def setup(cluster) end |
#teardown(cluster) ⇒ void
This method returns an undefined value.
Allows policy to release any external resources it might be holding. This method is called once the cluster has been terminated after calling Cluster#close
43 44 |
# File 'lib/cassandra/load_balancing.rb', line 43 def teardown(cluster) end |