Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

renamed Cassandra into CassandraOld #217

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/cassandra_native.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ VALUE rb_cassandra_dynamic_composite_fast_unpack(VALUE self, VALUE packed_string
}

void Init_cassandra_native(void) {
VALUE cassandra_module = rb_const_get(rb_cObject, rb_intern("Cassandra"));
VALUE cassandra_module = rb_const_get(rb_cObject, rb_intern("CassandraOld"));
VALUE cassandra_composite_class = rb_define_class_under(cassandra_module, "Composite", rb_cObject);
rb_define_method(cassandra_composite_class, "fast_unpack", rb_cassandra_composite_fast_unpack, 1);

Expand Down
47 changes: 0 additions & 47 deletions lib/cassandra.rb

This file was deleted.

2 changes: 0 additions & 2 deletions lib/cassandra/0.7/cassandra.rb

This file was deleted.

11 changes: 0 additions & 11 deletions lib/cassandra/constants.rb

This file was deleted.

47 changes: 47 additions & 0 deletions lib/cassandra_old.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
require 'rubygems'
gem 'thrift_client', '~> 0.7'
require 'thrift_client'
gem 'simple_uuid' , '~> 0.3'
require 'simple_uuid'

require 'json' unless defined?(JSON)

here = File.expand_path(File.dirname(__FILE__))

class CassandraOld ; end
unless CassandraOld.respond_to?(:VERSION)
require "#{here}/cassandra_old/0.8"
end

$LOAD_PATH << "#{here}/../vendor/#{CassandraOld.VERSION}/gen-rb"
require "#{here}/../vendor/#{CassandraOld.VERSION}/gen-rb/cassandra"

$LOAD_PATH << "#{here}"

require 'cassandra_old/helpers'
require 'cassandra_old/array'
require 'cassandra_old/time'
require 'cassandra_old/comparable'
require 'cassandra_old/long'
require 'cassandra_old/composite'
require 'cassandra_old/dynamic_composite'
require 'cassandra_old/ordered_hash'
require 'cassandra_old/columns'
require 'cassandra_old/protocol'
require 'cassandra_old/batch'
require "cassandra_old/#{CassandraOld.VERSION}/columns"
require "cassandra_old/#{CassandraOld.VERSION}/protocol"
require "cassandra_old/cassandra"
require "cassandra_old/#{CassandraOld.VERSION}/cassandra"
unless CassandraOld.VERSION.eql?("0.6")
require "cassandra_old/column_family"
require "cassandra_old/keyspace"
end
require 'cassandra_old/constants'
require 'cassandra_old/debug' if ENV['DEBUG']

begin
require "cassandra_native"
rescue LoadError
puts "Unable to load cassandra_native extension. Defaulting to pure Ruby libraries."
end
4 changes: 2 additions & 2 deletions lib/cassandra/0.6.rb → lib/cassandra_old/0.6.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class Cassandra
class CassandraOld
def self.VERSION
"0.6"
end
end

require "#{File.expand_path(File.dirname(__FILE__))}/../cassandra"
require "#{File.expand_path(File.dirname(__FILE__))}/../cassandra_old"
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Cassandra
class CassandraOld
def self.DEFAULT_TRANSPORT_WRAPPER
Thrift::BufferedTransport
end
Expand All @@ -16,7 +16,7 @@ def login!(username, password)
end

def inspect
"#<Cassandra:#{object_id}, @keyspace=#{keyspace.inspect}, @schema={#{
"#<CassandraOld:#{object_id}, @keyspace=#{keyspace.inspect}, @schema={#{
schema(false).map {|name, hash| ":#{name} => #{hash['type'].inspect}"}.join(', ')
}}, @servers=#{servers.inspect}>"
end
Expand Down Expand Up @@ -56,16 +56,16 @@ def clear_keyspace!(options = {})
# the <tt>:consistency</tt> option, which overrides the consistency set in
# the individual commands.
def batch(options = {})
_, _, _, options =
_, _, _, options =
extract_and_validate_params(schema.keys.first, "", [options], WRITE_DEFAULTS)

@batch = []
yield(self)
compacted_map,seen_clevels = compact_mutations!
clevel = if options[:consistency] != nil # Override any clevel from individual mutations if
clevel = if options[:consistency] != nil # Override any clevel from individual mutations if
options[:consistency]
elsif seen_clevels.length > 1 # Cannot choose which CLevel to use if there are several ones
raise "Multiple consistency levels used in the batch, and no override...cannot pick one"
raise "Multiple consistency levels used in the batch, and no override...cannot pick one"
else # if no consistency override has been provided but all the clevels in the batch are the same: use that one
seen_clevels.first
end
Expand Down Expand Up @@ -102,7 +102,7 @@ def all_nodes
ips = ::JSON.parse(temp_client.get_string_property('token map')).values
port = @servers.first.split(':').last
ips.map{|ip| "#{ip}:#{port}" }
ensure
ensure
temp_client.disconnect!
end
else
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Cassandra
class CassandraOld
# A bunch of crap, mostly related to introspecting on column types
module Columns #:nodoc:
private
Expand Down Expand Up @@ -35,7 +35,7 @@ def _standard_insert_mutation(column_family, column_name, value, timestamp, _=ni
end

def _super_insert_mutation(column_family, super_column_name, sub_columns, timestamp, _=nil)
CassandraThrift::Mutation.new(:column_or_supercolumn =>
CassandraThrift::Mutation.new(:column_or_supercolumn =>
CassandraThrift::ColumnOrSuperColumn.new(
:super_column => CassandraThrift::SuperColumn.new(
:name => column_name_class(column_family).new(super_column_name).to_s,
Expand All @@ -53,12 +53,12 @@ def _super_insert_mutation(column_family, super_column_name, sub_columns, timest

# General info about a deletion object within a mutation
# timestamp - required. If this is the only param, it will cause deletion of the whole key at that TS
# supercolumn - opt. If passed, the deletes will only occur within that supercolumn (only subcolumns
# supercolumn - opt. If passed, the deletes will only occur within that supercolumn (only subcolumns
# will be deleted). Otherwise the normal columns will be deleted.
# predicate - opt. Defines how to match the columns to delete. if supercolumn passed, the slice will
# predicate - opt. Defines how to match the columns to delete. if supercolumn passed, the slice will
# be scoped to subcolumns of that supercolumn.
# Deletes a single column from the containing key/CF (and possibly supercolumn), at a given timestamp.

# Deletes a single column from the containing key/CF (and possibly supercolumn), at a given timestamp.
# Although mutations (as opposed to 'remove' calls) support deleting slices and lists of columns in one shot, this is not implemented here.
# The main reason being that the batch function takes removes, but removes don't have that capability...so we'd need to change the remove
# methods to use delete mutation calls...although that might have performance implications. We'll leave that refactoring for later.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

class Cassandra
class CassandraOld
# Inner methods for actually doing the Thrift calls
module Protocol #:nodoc:
private
Expand Down
4 changes: 2 additions & 2 deletions lib/cassandra/0.7.rb → lib/cassandra_old/0.7.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class Cassandra
class CassandraOld
def self.VERSION
"0.7"
end
end

require "#{File.expand_path(File.dirname(__FILE__))}/../cassandra"
require "#{File.expand_path(File.dirname(__FILE__))}/../cassandra_old"
2 changes: 2 additions & 0 deletions lib/cassandra_old/0.7/cassandra.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class CassandraOld
end
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Cassandra
class CassandraOld
module Columns #:nodoc:
end
end
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Cassandra
class CassandraOld
# Inner methods for actually doing the Thrift calls
module Protocol #:nodoc:
end
Expand Down
4 changes: 2 additions & 2 deletions lib/cassandra/0.8.rb → lib/cassandra_old/0.8.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class Cassandra
class CassandraOld
def self.VERSION
"0.8"
end
end

require "#{File.expand_path(File.dirname(__FILE__))}/../cassandra"
require "#{File.expand_path(File.dirname(__FILE__))}/../cassandra_old"
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Cassandra
class CassandraOld

## Counters

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Cassandra
class CassandraOld
module Columns #:nodoc:
def _standard_counter_mutation(column_family, column_name, value)
CassandraThrift::Mutation.new(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Cassandra
class CassandraOld
# Inner methods for actually doing the Thrift calls
module Protocol #:nodoc:
private
Expand Down
4 changes: 2 additions & 2 deletions lib/cassandra/1.0.rb → lib/cassandra_old/1.0.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class Cassandra
class CassandraOld
def self.VERSION
"1.0"
end
end

require "#{File.expand_path(File.dirname(__FILE__))}/../cassandra"
require "#{File.expand_path(File.dirname(__FILE__))}/../cassandra_old"
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions lib/cassandra/1.1.rb → lib/cassandra_old/1.1.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class Cassandra
class CassandraOld
def self.VERSION
"1.1"
end
end

require "#{File.expand_path(File.dirname(__FILE__))}/../cassandra"
require "#{File.expand_path(File.dirname(__FILE__))}/../cassandra_old"
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions lib/cassandra/1.2.rb → lib/cassandra_old/1.2.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class Cassandra
class CassandraOld
def self.VERSION
"1.2"
end
end

require "#{File.expand_path(File.dirname(__FILE__))}/../cassandra"
require "#{File.expand_path(File.dirname(__FILE__))}/../cassandra_old"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions lib/cassandra/batch.rb → lib/cassandra_old/batch.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
class Cassandra
class CassandraOld
class Batch
include Enumerable

def initialize(cassandra, options)
def initialize(cassandra, options)
@queue_size = options.delete(:queue_size) || 0
@cassandra = cassandra
@options = options
Expand Down
Loading