Module: Cassandra::Retry::Policy Abstract

Overview

This module is abstract.

Actual retry policies supplied as :retry_policy option to Cassandra.cluster don't need to inherit this class, only implement its methods. This class exists for documentation purposes only.

Instance Method Summary collapse

Instance Method Details

#read_timeout(statement, consistency, required, received, retrieved, retries) ⇒ Cassandra::Policies::Retry::Decision

Note:

this method may be called even if required_responses >= received responses if data_present is false.

Decides wether to retry a read and at what consistency level.

Parameters:

  • statement (Cassandra::Statement)

    the original statement that timed out

  • consistency (Symbol)

    the original consistency level for the request, one of CONSISTENCIES

  • required (Integer)

    the number of responses required to achieve requested consistency level

  • received (Integer)

    the number of responses received by the time the query timed out

  • retrieved (Boolean)

    whether actual data (as opposed to data checksum) was present in the received responses.

  • retries (Integer)

    the number of retries already performed

Returns:

  • (Cassandra::Policies::Retry::Decision)

    a retry decision

See Also:

  • #try_again
  • #reraise
  • #ignore


46
47
# File 'lib/cassandra/retry.rb', line 46

def read_timeout(statement, consistency, required, received, retrieved, retries)
end

#unavailable(statement, consistency, required, alive, retries) ⇒ Cassandra::Policies::Retry::Decision

Decides wether to retry and at what consistency level on an Unavailable exception.

Parameters:

  • statement (Cassandra::Statement)

    the original Statement that timed out

  • consistency (Symbol)

    the original consistency level for the request, one of CONSISTENCIES

  • required (Integer)

    the number of replicas required to achieve requested consistency level

  • alive (Integer)

    the number of replicas available for the request

  • retries (Integer)

    the number of retries already performed

Returns:

  • (Cassandra::Policies::Retry::Decision)

    a retry decision

See Also:

  • #try_again
  • #reraise
  • #ignore


85
86
# File 'lib/cassandra/retry.rb', line 85

def unavailable(statement, consistency, required, alive, retries)
end

#write_timeout(statement, consistency, type, required, received, retries) ⇒ Cassandra::Policies::Retry::Decision

Decides wether to retry a write and at what consistency level.

Parameters:

  • statement (Cassandra::Statement)

    the original statement that timed out

  • consistency (Symbol)

    the original consistency level for the request, one of CONSISTENCIES

  • type (Symbol)

    One of WRITE_TYPES

  • required (Integer)

    the number of acks required to achieve requested consistency level

  • received (Integer)

    the number of acks received by the time the query timed out

  • retries (Integer)

    the number of retries already performed

Returns:

  • (Cassandra::Policies::Retry::Decision)

    a retry decision

See Also:

  • #try_again
  • #reraise
  • #ignore


66
67
# File 'lib/cassandra/retry.rb', line 66

def write_timeout(statement, consistency, type, required, received, retries)
end