Class: NoSE::Backend::CassandraBackend::IndexLookupStatementStep

Inherits:
Backend::IndexLookupStatementStep show all
Defined in:
lib/nose/backend/cassandra.rb

Overview

A query step to look up data from a particular column family

Instance Attribute Summary

Attributes inherited from Backend::StatementStep

#index

Instance Method Summary collapse

Methods included from Supertype

included

Constructor Details

#initialize(client, select, conditions, step, next_step, prev_step) ⇒ IndexLookupStatementStep

rubocop:disable Metrics/ParameterLists



273
274
275
276
277
278
279
280
# File 'lib/nose/backend/cassandra.rb', line 273

def initialize(client, select, conditions, step, next_step, prev_step)
  super

  @logger = Logging.logger['nose::backend::cassandra::indexlookupstep']

  # TODO: Check if we can apply the next filter via ALLOW FILTERING
  @prepared = client.prepare select_cql(select, conditions)
end

Instance Method Details

#process(conditions, results) ⇒ Object

Perform a column family lookup in Cassandra



284
285
286
287
288
289
290
291
# File 'lib/nose/backend/cassandra.rb', line 284

def process(conditions, results)
  results = initial_results(conditions) if results.nil?
  condition_list = result_conditions conditions, results
  new_result = fetch_all_queries condition_list, results

  # Limit the size of the results in case we fetched multiple keys
  new_result[0..(@step.limit.nil? ? -1 : @step.limit)]
end