Sha256: ddf2e19cd30b9ab409955164ca06a732f737af65bc23ad4ed61df0fc70e55281

Contents?: true

Size: 871 Bytes

Versions: 119

Compression:

Stored size: 871 Bytes

Contents

module CassandraObject
  module Consistency
    extend ActiveSupport::Concern

    included do
      cattr_accessor :consistency_levels
      self.consistency_levels = [:one, :quorum, :all]

      class_attribute :write_consistency
      class_attribute :read_consistency
      self.write_consistency  = :quorum
      self.read_consistency   = :quorum
    end

    module ClassMethods
      THRIFT_LEVELS = {
        :one    => Cassandra::Consistency::ONE,
        :quorum => Cassandra::Consistency::QUORUM,
        :all    => Cassandra::Consistency::ALL
      }

      def thrift_read_consistency
        THRIFT_LEVELS[read_consistency] || (raise "Invalid consistency level #{read_consistency}")
      end

      def thrift_write_consistency
        THRIFT_LEVELS[write_consistency] || (raise "Invalid consistency level #{write_consistency}")
      end
    end
  end
end

Version data entries

119 entries across 119 versions & 2 rubygems

Version Path
sessionm-cassandra_object-2.2.55 lib/cassandra_object/consistency.rb
gotime-cassandra_object-3.0.5 lib/cassandra_object/consistency.rb
gotime-cassandra_object-3.0.4 lib/cassandra_object/consistency.rb
gotime-cassandra_object-3.0.3 lib/cassandra_object/consistency.rb
gotime-cassandra_object-3.0.2 lib/cassandra_object/consistency.rb
gotime-cassandra_object-3.0.1 lib/cassandra_object/consistency.rb
gotime-cassandra_object-3.0.0 lib/cassandra_object/consistency.rb
gotime-cassandra_object-2.13.0 lib/cassandra_object/consistency.rb
gotime-cassandra_object-2.12.5 lib/cassandra_object/consistency.rb
sessionm-cassandra_object-2.2.54 lib/cassandra_object/consistency.rb
sessionm-cassandra_object-2.2.53 lib/cassandra_object/consistency.rb
sessionm-cassandra_object-2.2.52 lib/cassandra_object/consistency.rb
gotime-cassandra_object-2.12.4 lib/cassandra_object/consistency.rb
gotime-cassandra_object-2.12.3 lib/cassandra_object/consistency.rb
gotime-cassandra_object-2.12.2 lib/cassandra_object/consistency.rb
gotime-cassandra_object-2.12.1 lib/cassandra_object/consistency.rb
sessionm-cassandra_object-2.2.51 lib/cassandra_object/consistency.rb
sessionm-cassandra_object-2.2.50 lib/cassandra_object/consistency.rb
gotime-cassandra_object-2.12.0 lib/cassandra_object/consistency.rb
sessionm-cassandra_object-2.2.49 lib/cassandra_object/consistency.rb