Class: Cassandra::LoadBalancing::Policy Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/cassandra/load_balancing.rb

Overview

This class is abstract.

Actual load balancing policies don't need to extend this class, only implement its methods. This class exists for documentation purposes only.

Instance Method Summary collapse

Instance Method Details

#distance(host) ⇒ Symbol

Returns a distance that determines how many connections (if any) the driver will open to the host.

Parameters:

Returns:

  • (Symbol)

    distance to host. Must be one of DISTANCES



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

#inspectString

Returns a console-friendly representation of this policy.

Returns:

  • (String)

    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

Note:

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.

Parameters:

Returns:

Raises:

  • (NotImplementedError)

    override this method to return a plan



81
82
# File 'lib/cassandra/load_balancing.rb', line 81

def plan(keyspace, statement, options)
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.

Parameters:



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

Parameters:



43
44
# File 'lib/cassandra/load_balancing.rb', line 43

def teardown(cluster)
end