Module: Cassie::Statements::Execution

Extended by:
ClassMethods
Includes:
Callbacks, Consistency, Instrumentation, PartitionLinking
Included in:
Core
Defined in:
lib/cassie/statements/execution.rb,
lib/cassie/statements/execution/peeking.rb,
lib/cassie/statements/execution/fetching.rb,
lib/cassie/statements/execution/callbacks.rb,
lib/cassie/statements/execution/deserialization.rb,
lib/cassie/statements/execution/instrumentation.rb,
lib/cassie/statements/execution/batched_fetching.rb,
lib/cassie/statements/execution/partition_linking.rb

Overview

Execution support for Cassandra Statements

Requires the following methods be provided:

  • statement

    • CQL String or Cassandra::Statements:Statement executable by a Cassandra::Session

  • session

    • A Cassandra::Session scoped to an appropriate keyspace

Defined Under Namespace

Modules: BatchedFetching, Callbacks, ClassMethods, Consistency, Deserialization, Fetching, Instrumentation, PartitionLinking, Peeking

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#result_classObject Originally defined in module ClassMethods

The class to use for decorating the Cassandra::Result

Class Method Details

.inherited(subclass) ⇒ Object Originally defined in module ClassMethods

Instance Method Details

#build_partition_linkerObject Originally defined in module PartitionLinking

#consistencyObject Originally defined in module Consistency

#executeBoolean

Executes the statment and populates result


58
59
60
61
# File 'lib/cassie/statements/execution.rb', line 58

def execute
  @result = result_class.new(session.execute(statement, execution_options), result_opts)
  result.success?
end

#execute!Boolean

Same as #execute. Raises if not succesfull.

Raises:


66
67
68
# File 'lib/cassie/statements/execution.rb', line 66

def execute!
  execute || (raise Cassie::Statements::ExecutionError.new(result))
end

#execution_optionsHash{Symbol => Object}

The session exection options configured for statement execution


72
73
74
75
76
77
78
79
80
# File 'lib/cassie/statements/execution.rb', line 72

def execution_options
  {}.tap do |opts|
    # @todo rework consistency module to be more
    #      abstract implementation for all execution options
    opts[:consistency] = consistency if consistency
    opts[:paging_state] = paging_state if respond_to?(:paging_state) && paging_state
    opts[:page_size] = stateless_page_size if respond_to?(:stateless_page_size) && stateless_page_size
  end
end

#partition_linker?Boolean Originally defined in module PartitionLinking