class NoSE::Cost::CassandraCost

A cost model which estimates the number of requests to the backend

Public Instance Methods

delete_cost(step) click to toggle source

Cost estimate as number of entities deleted

# File lib/nose/cost/cassandra.rb, line 21
def delete_cost(step)
  return nil if step.state.nil?
  step.state.cardinality * @options[:delete_cost]
end
index_lookup_cost(step) click to toggle source

Rough cost estimate as the number of requests made @return [Numeric]

# File lib/nose/cost/cassandra.rb, line 11
def index_lookup_cost(step)
  return nil if step.state.nil?
  rows = step.state.cardinality
  parts = step.state.hash_cardinality

  @options[:index_cost] + parts * @options[:partition_cost] +
    rows * @options[:row_cost]
end
insert_cost(step) click to toggle source

Cost estimate as number of entities inserted

# File lib/nose/cost/cassandra.rb, line 27
def insert_cost(step)
  return nil if step.state.nil?
  step.state.cardinality * @options[:insert_cost]
end