Sha256: e7de8ae7d375cde94094cb4d9988f20c3bbcdd7894cdf4bfe48e128acfba5260

Contents?: true

Size: 928 Bytes

Versions: 1

Compression:

Stored size: 928 Bytes

Contents

module CassandraObject
  module Adapters
    class AbstractAdapter
      attr_reader :config
      def initialize(config)
        @config = config
      end

      # === Options
      # [:select]
      #   Only select certain fields
      # [:limit]
      #   Limit the results
      def select(ids, options ={}) # abstract
      end

      def write(id, attributes) # abstract
      end

      def delete(ids) # abstract
      end

      def execute_batch(statements) # abstract
      end

      def batching?
        !@batch_statements.nil?
      end

      def batch
        @batch_statements = []
        yield
        execute_batch(@batch_statements) if @batch_statements.any?
      ensure
        @batch_statements = nil
      end

      def execute_batchable(statement)
        if @batch_statements
          @batch_statements << statement
        else
          execute statement
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gotime-cassandra_object-4.11.6 lib/cassandra_object/adapters/abstract_adapter.rb