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 Method Summary collapse

Methods included from ClassMethods

inherited

Methods included from PartitionLinking

#build_partition_linker, #partition_linker?

Methods included from Consistency

#consistency

Instance Method Details

#executeBoolean

Executes the statment and populates result

Returns:

  • (Boolean)

    indicating a successful execution or not



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.

Returns:

  • (Boolean)

    true if sucessful

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

Returns:



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