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
gotime-cassandra_object-2.7.6 lib/cassandra_object/consistency.rb
gotime-cassandra_object-2.7.5 lib/cassandra_object/consistency.rb
gotime-cassandra_object-2.7.4 lib/cassandra_object/consistency.rb
sessionm-cassandra_object-2.2.26 lib/cassandra_object/consistency.rb
sessionm-cassandra_object-2.2.24 lib/cassandra_object/consistency.rb
gotime-cassandra_object-2.7.3 lib/cassandra_object/consistency.rb
gotime-cassandra_object-2.7.2 lib/cassandra_object/consistency.rb
gotime-cassandra_object-2.7.1 lib/cassandra_object/consistency.rb
gotime-cassandra_object-2.7.0 lib/cassandra_object/consistency.rb
gotime-cassandra_object-2.6.4 lib/cassandra_object/consistency.rb
gotime-cassandra_object-2.6.3 lib/cassandra_object/consistency.rb
gotime-cassandra_object-2.6.2 lib/cassandra_object/consistency.rb
gotime-cassandra_object-2.6.1 lib/cassandra_object/consistency.rb
gotime-cassandra_object-2.6.0 lib/cassandra_object/consistency.rb
gotime-cassandra_object-2.5.0 lib/cassandra_object/consistency.rb
gotime-cassandra_object-2.4.2 lib/cassandra_object/consistency.rb
gotime-cassandra_object-2.4.1 lib/cassandra_object/consistency.rb
sessionm-cassandra_object-2.2.23 lib/cassandra_object/consistency.rb
sessionm-cassandra_object-2.2.22 lib/cassandra_object/consistency.rb
sessionm-cassandra_object-2.2.20 lib/cassandra_object/consistency.rb