Method: Cequel::Metal::Batch#initialize

Defined in:
lib/cequel/metal/batch.rb

#initialize(keyspace, options = {}) ⇒ Batch

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Batch.

Parameters:

  • keyspace (Keyspace)

    the keyspace that this batch will be executed on

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :auto_apply (Integer)

    If specified, flush the batch after this many statements have been added.

  • :unlogged (Boolean) — default: false

    Whether to use an [unlogged batch]( www.datastax.com/dev/blog/atomic-batches-in-cassandra-1-2). Logged batches guarantee atomicity (but not isolation) at the cost of a performance penalty; unlogged batches are useful for bulk write operations but behave the same as discrete writes.

See Also:

Since:

  • 1.0.0



27
28
29
30
31
32
33
34
35
# File 'lib/cequel/metal/batch.rb', line 27

def initialize(keyspace, options = {})
  options.assert_valid_keys(:auto_apply, :unlogged, :consistency)
  @keyspace = keyspace
  @auto_apply = options[:auto_apply]
  @unlogged = options.fetch(:unlogged, false)
  @consistency = options.fetch(:consistency,
                               keyspace.default_consistency)
  reset
end