Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of git://github.com/fauna/cassandra

  • Loading branch information...
commit b3c475e7d7b56f47932e5b68ebf343c908d2e230 2 parents 617cdf7 + 7bf4a53
Philip (flip) Kromer authored
View
40 lib/cassandra/0.7/cassandra.rb
@@ -9,25 +9,31 @@ def login!(username, password)
client.login(@auth_request)
end
+ def inspect
+ "#<Cassandra:#{object_id}, @keyspace=#{keyspace.inspect}, @schema={#{
+ Array(schema(false).cf_defs).map {|cfdef| ":#{cfdef.name} => #{cfdef.column_type}"}.join(', ')
+ }}, @servers=#{servers.inspect}>"
+ end
+
def keyspace=(ks)
client.set_keyspace(ks) if check_keyspace(ks)
@schema = nil; @keyspace = ks
end
def keyspaces
- client.describe_keyspaces.to_a
+ client.describe_keyspaces.to_a.collect {|ksdef| ksdef.name }
end
def schema(load=true)
if !load && !@schema
- []
+ Cassandra::Keyspace.new
else
@schema ||= client.describe_keyspace(@keyspace)
end
end
def schema_agreement?
- client.check_schema_agreement().length == 1
+ client.describe_schema_versions().length == 1
end
def version
@@ -58,7 +64,7 @@ def truncate!(column_family)
# Remove all rows in the keyspace.
def clear_keyspace!
- schema.keys.each { |column_family| truncate!(column_family) }
+ schema.cf_defs.each { |cfdef| truncate!(cfdef.name) }
end
### Read
@@ -131,6 +137,30 @@ def rename_keyspace(old_name, new_name)
res
end
+ # Open a batch operation and yield self. Inserts and deletes will be queued
+ # until the block closes, and then sent atomically to the server. Supports
+ # the <tt>:consistency</tt> option, which overrides the consistency set in
+ # the individual commands.
+ def batch(options = {})
+ _, _, _, options =
+ extract_and_validate_params(schema.cf_defs.first.name, "", [options], WRITE_DEFAULTS)
+
+ @batch = []
+ yield(self)
+ compact_mutations!
+
+ @batch.each do |mutation|
+ case mutation.first
+ when :remove
+ _remove(*mutation[1])
+ else
+ _mutate(*mutation)
+ end
+ end
+ ensure
+ @batch = nil
+ end
+
protected
def client
@@ -154,7 +184,7 @@ def check_keyspace(ks = @keyspace)
def all_nodes
if @auto_discover_nodes && !@keyspace.eql?("system")
- ips = (new_client.describe_ring(@keyspace).map {|range| range.endpoints}).flatten
+ ips = (new_client.describe_ring(@keyspace).map {|range| range.endpoints}).flatten.uniq
port = @servers.first.split(':').last
ips.map{|ip| "#{ip}:#{port}" }
else
View
37 lib/cassandra/0.7/columns.rb
@@ -1,19 +1,28 @@
-# THIS IS FILTHY
-module CassandraThrift
- class Column
- def timestamp
- clock.timestamp
- end
-
- def timestamp=(ts)
- clock.timestamp = ts
- end
- end
-end
class Cassandra
# A bunch of crap, mostly related to introspecting on column types
module Columns #:nodoc:
+
+ def is_super(column_family)
+ @is_super[column_family] ||= column_family_property(column_family, 'column_type') == "Super"
+ end
+
+ def column_name_class(column_family)
+ @column_name_class[column_family] ||= column_name_class_for_key(column_family, "comparator_type")
+ end
+
+ def sub_column_name_class(column_family)
+ @sub_column_name_class[column_family] ||= column_name_class_for_key(column_family, "subcomparator_type")
+ end
+
+ def column_family_property(column_family, key)
+ cfdef = schema.cf_defs.find {|cfdef| cfdef.name == column_family }
+ unless cfdef
+ raise AccessError, "Invalid column family \"#{column_family}\""
+ end
+ cfdef.send(key)
+ end
+
private
def _standard_insert_mutation(column_family, column_name, value, timestamp, ttl = nil)
@@ -22,7 +31,7 @@ def _standard_insert_mutation(column_family, column_name, value, timestamp, ttl
:column => CassandraThrift::Column.new(
:name => column_name_class(column_family).new(column_name).to_s,
:value => value,
- :clock => CassandraThrift::Clock.new(:timestamp => timestamp),
+ :timestamp => timestamp,
:ttl => ttl
)
)
@@ -38,7 +47,7 @@ def _super_insert_mutation(column_family, super_column_name, sub_columns, timest
CassandraThrift::Column.new(
:name => sub_column_name_class(column_family).new(sub_column_name).to_s,
:value => sub_column_value.to_s,
- :clock => CassandraThrift::Clock.new(:timestamp => timestamp),
+ :timestamp => timestamp,
:ttl => ttl
)
}
View
2  lib/cassandra/0.7/protocol.rb
@@ -9,7 +9,7 @@ def _mutate(mutation_map, consistency_level)
end
def _remove(key, column_path, timestamp, consistency_level)
- client.remove(key, column_path, CassandraThrift::Clock.new(:timestamp => timestamp), consistency_level)
+ client.remove(key, column_path, timestamp, consistency_level)
end
def _count_columns(column_family, key, super_column, consistency)
View
288 vendor/0.7/gen-rb/cassandra.rb
@@ -14,7 +14,7 @@ class Client
def login(auth_request)
send_login(auth_request)
- return recv_login()
+ recv_login()
end
def send_login(auth_request)
@@ -23,10 +23,9 @@ def send_login(auth_request)
def recv_login()
result = receive_message(Login_result)
- return result.success unless result.success.nil?
raise result.authnx unless result.authnx.nil?
raise result.authzx unless result.authzx.nil?
- raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'login failed: unknown result')
+ return
end
def set_keyspace(keyspace)
@@ -117,13 +116,13 @@ def recv_multiget_slice()
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'multiget_slice failed: unknown result')
end
- def multiget_count(keyspace, keys, column_parent, predicate, consistency_level)
- send_multiget_count(keyspace, keys, column_parent, predicate, consistency_level)
+ def multiget_count(keys, column_parent, predicate, consistency_level)
+ send_multiget_count(keys, column_parent, predicate, consistency_level)
return recv_multiget_count()
end
- def send_multiget_count(keyspace, keys, column_parent, predicate, consistency_level)
- send_message('multiget_count', Multiget_count_args, :keyspace => keyspace, :keys => keys, :column_parent => column_parent, :predicate => predicate, :consistency_level => consistency_level)
+ def send_multiget_count(keys, column_parent, predicate, consistency_level)
+ send_message('multiget_count', Multiget_count_args, :keys => keys, :column_parent => column_parent, :predicate => predicate, :consistency_level => consistency_level)
end
def recv_multiget_count()
@@ -188,13 +187,13 @@ def recv_insert()
return
end
- def remove(key, column_path, clock, consistency_level)
- send_remove(key, column_path, clock, consistency_level)
+ def remove(key, column_path, timestamp, consistency_level)
+ send_remove(key, column_path, timestamp, consistency_level)
recv_remove()
end
- def send_remove(key, column_path, clock, consistency_level)
- send_message('remove', Remove_args, :key => key, :column_path => column_path, :clock => clock, :consistency_level => consistency_level)
+ def send_remove(key, column_path, timestamp, consistency_level)
+ send_message('remove', Remove_args, :key => key, :column_path => column_path, :timestamp => timestamp, :consistency_level => consistency_level)
end
def recv_remove()
@@ -238,20 +237,20 @@ def recv_truncate()
return
end
- def check_schema_agreement()
- send_check_schema_agreement()
- return recv_check_schema_agreement()
+ def describe_schema_versions()
+ send_describe_schema_versions()
+ return recv_describe_schema_versions()
end
- def send_check_schema_agreement()
- send_message('check_schema_agreement', Check_schema_agreement_args)
+ def send_describe_schema_versions()
+ send_message('describe_schema_versions', Describe_schema_versions_args)
end
- def recv_check_schema_agreement()
- result = receive_message(Check_schema_agreement_result)
+ def recv_describe_schema_versions()
+ result = receive_message(Describe_schema_versions_result)
return result.success unless result.success.nil?
raise result.ire unless result.ire.nil?
- raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'check_schema_agreement failed: unknown result')
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'describe_schema_versions failed: unknown result')
end
def describe_keyspaces()
@@ -330,6 +329,21 @@ def recv_describe_partitioner()
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'describe_partitioner failed: unknown result')
end
+ def describe_snitch()
+ send_describe_snitch()
+ return recv_describe_snitch()
+ end
+
+ def send_describe_snitch()
+ send_message('describe_snitch', Describe_snitch_args)
+ end
+
+ def recv_describe_snitch()
+ result = receive_message(Describe_snitch_result)
+ return result.success unless result.success.nil?
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'describe_snitch failed: unknown result')
+ end
+
def describe_keyspace(keyspace)
send_describe_keyspace(keyspace)
return recv_describe_keyspace()
@@ -346,13 +360,13 @@ def recv_describe_keyspace()
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'describe_keyspace failed: unknown result')
end
- def describe_splits(keyspace, cfName, start_token, end_token, keys_per_split)
- send_describe_splits(keyspace, cfName, start_token, end_token, keys_per_split)
+ def describe_splits(cfName, start_token, end_token, keys_per_split)
+ send_describe_splits(cfName, start_token, end_token, keys_per_split)
return recv_describe_splits()
end
- def send_describe_splits(keyspace, cfName, start_token, end_token, keys_per_split)
- send_message('describe_splits', Describe_splits_args, :keyspace => keyspace, :cfName => cfName, :start_token => start_token, :end_token => end_token, :keys_per_split => keys_per_split)
+ def send_describe_splits(cfName, start_token, end_token, keys_per_split)
+ send_message('describe_splits', Describe_splits_args, :cfName => cfName, :start_token => start_token, :end_token => end_token, :keys_per_split => keys_per_split)
end
def recv_describe_splits()
@@ -457,6 +471,38 @@ def recv_system_rename_keyspace()
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'system_rename_keyspace failed: unknown result')
end
+ def system_update_keyspace(ks_def)
+ send_system_update_keyspace(ks_def)
+ return recv_system_update_keyspace()
+ end
+
+ def send_system_update_keyspace(ks_def)
+ send_message('system_update_keyspace', System_update_keyspace_args, :ks_def => ks_def)
+ end
+
+ def recv_system_update_keyspace()
+ result = receive_message(System_update_keyspace_result)
+ return result.success unless result.success.nil?
+ raise result.ire unless result.ire.nil?
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'system_update_keyspace failed: unknown result')
+ end
+
+ def system_update_column_family(cf_def)
+ send_system_update_column_family(cf_def)
+ return recv_system_update_column_family()
+ end
+
+ def send_system_update_column_family(cf_def)
+ send_message('system_update_column_family', System_update_column_family_args, :cf_def => cf_def)
+ end
+
+ def recv_system_update_column_family()
+ result = receive_message(System_update_column_family_result)
+ return result.success unless result.success.nil?
+ raise result.ire unless result.ire.nil?
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'system_update_column_family failed: unknown result')
+ end
+
end
class Processor
@@ -466,7 +512,7 @@ def process_login(seqid, iprot, oprot)
args = read_args(iprot, Login_args)
result = Login_result.new()
begin
- result.success = @handler.login(args.auth_request)
+ @handler.login(args.auth_request)
rescue CassandraThrift::AuthenticationException => authnx
result.authnx = authnx
rescue CassandraThrift::AuthorizationException => authzx
@@ -552,7 +598,7 @@ def process_multiget_count(seqid, iprot, oprot)
args = read_args(iprot, Multiget_count_args)
result = Multiget_count_result.new()
begin
- result.success = @handler.multiget_count(args.keyspace, args.keys, args.column_parent, args.predicate, args.consistency_level)
+ result.success = @handler.multiget_count(args.keys, args.column_parent, args.predicate, args.consistency_level)
rescue CassandraThrift::InvalidRequestException => ire
result.ire = ire
rescue CassandraThrift::UnavailableException => ue
@@ -612,7 +658,7 @@ def process_remove(seqid, iprot, oprot)
args = read_args(iprot, Remove_args)
result = Remove_result.new()
begin
- @handler.remove(args.key, args.column_path, args.clock, args.consistency_level)
+ @handler.remove(args.key, args.column_path, args.timestamp, args.consistency_level)
rescue CassandraThrift::InvalidRequestException => ire
result.ire = ire
rescue CassandraThrift::UnavailableException => ue
@@ -651,15 +697,15 @@ def process_truncate(seqid, iprot, oprot)
write_result(result, oprot, 'truncate', seqid)
end
- def process_check_schema_agreement(seqid, iprot, oprot)
- args = read_args(iprot, Check_schema_agreement_args)
- result = Check_schema_agreement_result.new()
+ def process_describe_schema_versions(seqid, iprot, oprot)
+ args = read_args(iprot, Describe_schema_versions_args)
+ result = Describe_schema_versions_result.new()
begin
- result.success = @handler.check_schema_agreement()
+ result.success = @handler.describe_schema_versions()
rescue CassandraThrift::InvalidRequestException => ire
result.ire = ire
end
- write_result(result, oprot, 'check_schema_agreement', seqid)
+ write_result(result, oprot, 'describe_schema_versions', seqid)
end
def process_describe_keyspaces(seqid, iprot, oprot)
@@ -701,6 +747,13 @@ def process_describe_partitioner(seqid, iprot, oprot)
write_result(result, oprot, 'describe_partitioner', seqid)
end
+ def process_describe_snitch(seqid, iprot, oprot)
+ args = read_args(iprot, Describe_snitch_args)
+ result = Describe_snitch_result.new()
+ result.success = @handler.describe_snitch()
+ write_result(result, oprot, 'describe_snitch', seqid)
+ end
+
def process_describe_keyspace(seqid, iprot, oprot)
args = read_args(iprot, Describe_keyspace_args)
result = Describe_keyspace_result.new()
@@ -715,7 +768,7 @@ def process_describe_keyspace(seqid, iprot, oprot)
def process_describe_splits(seqid, iprot, oprot)
args = read_args(iprot, Describe_splits_args)
result = Describe_splits_result.new()
- result.success = @handler.describe_splits(args.keyspace, args.cfName, args.start_token, args.end_token, args.keys_per_split)
+ result.success = @handler.describe_splits(args.cfName, args.start_token, args.end_token, args.keys_per_split)
write_result(result, oprot, 'describe_splits', seqid)
end
@@ -785,6 +838,28 @@ def process_system_rename_keyspace(seqid, iprot, oprot)
write_result(result, oprot, 'system_rename_keyspace', seqid)
end
+ def process_system_update_keyspace(seqid, iprot, oprot)
+ args = read_args(iprot, System_update_keyspace_args)
+ result = System_update_keyspace_result.new()
+ begin
+ result.success = @handler.system_update_keyspace(args.ks_def)
+ rescue CassandraThrift::InvalidRequestException => ire
+ result.ire = ire
+ end
+ write_result(result, oprot, 'system_update_keyspace', seqid)
+ end
+
+ def process_system_update_column_family(seqid, iprot, oprot)
+ args = read_args(iprot, System_update_column_family_args)
+ result = System_update_column_family_result.new()
+ begin
+ result.success = @handler.system_update_column_family(args.cf_def)
+ rescue CassandraThrift::InvalidRequestException => ire
+ result.ire = ire
+ end
+ write_result(result, oprot, 'system_update_column_family', seqid)
+ end
+
end
# HELPER FUNCTIONS AND STRUCTURES
@@ -808,13 +883,11 @@ def validate
class Login_result
include ::Thrift::Struct
- SUCCESS = 0
AUTHNX = 1
AUTHZX = 2
- ::Thrift::Struct.field_accessor self, :success, :authnx, :authzx
+ ::Thrift::Struct.field_accessor self, :authnx, :authzx
FIELDS = {
- SUCCESS => {:type => ::Thrift::Types::I32, :name => 'success', :enum_class => CassandraThrift::AccessLevel},
AUTHNX => {:type => ::Thrift::Types::STRUCT, :name => 'authnx', :class => CassandraThrift::AuthenticationException},
AUTHZX => {:type => ::Thrift::Types::STRUCT, :name => 'authzx', :class => CassandraThrift::AuthorizationException}
}
@@ -822,9 +895,6 @@ class Login_result
def struct_fields; FIELDS; end
def validate
- unless @success.nil? || CassandraThrift::AccessLevel::VALID_VALUES.include?(@success)
- raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field success!')
- end
end
end
@@ -1067,15 +1137,13 @@ def validate
class Multiget_count_args
include ::Thrift::Struct
- KEYSPACE = 1
- KEYS = 2
- COLUMN_PARENT = 3
- PREDICATE = 4
- CONSISTENCY_LEVEL = 5
+ KEYS = 1
+ COLUMN_PARENT = 2
+ PREDICATE = 3
+ CONSISTENCY_LEVEL = 4
- ::Thrift::Struct.field_accessor self, :keyspace, :keys, :column_parent, :predicate, :consistency_level
+ ::Thrift::Struct.field_accessor self, :keys, :column_parent, :predicate, :consistency_level
FIELDS = {
- KEYSPACE => {:type => ::Thrift::Types::STRING, :name => 'keyspace'},
KEYS => {:type => ::Thrift::Types::LIST, :name => 'keys', :element => {:type => ::Thrift::Types::STRING}},
COLUMN_PARENT => {:type => ::Thrift::Types::STRUCT, :name => 'column_parent', :class => CassandraThrift::ColumnParent},
PREDICATE => {:type => ::Thrift::Types::STRUCT, :name => 'predicate', :class => CassandraThrift::SlicePredicate},
@@ -1085,7 +1153,6 @@ class Multiget_count_args
def struct_fields; FIELDS; end
def validate
- raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field keyspace is unset!') unless @keyspace
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field keys is unset!') unless @keys
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field column_parent is unset!') unless @column_parent
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field predicate is unset!') unless @predicate
@@ -1274,14 +1341,14 @@ class Remove_args
include ::Thrift::Struct
KEY = 1
COLUMN_PATH = 2
- CLOCK = 3
+ TIMESTAMP = 3
CONSISTENCY_LEVEL = 4
- ::Thrift::Struct.field_accessor self, :key, :column_path, :clock, :consistency_level
+ ::Thrift::Struct.field_accessor self, :key, :column_path, :timestamp, :consistency_level
FIELDS = {
KEY => {:type => ::Thrift::Types::STRING, :name => 'key'},
COLUMN_PATH => {:type => ::Thrift::Types::STRUCT, :name => 'column_path', :class => CassandraThrift::ColumnPath},
- CLOCK => {:type => ::Thrift::Types::STRUCT, :name => 'clock', :class => CassandraThrift::Clock},
+ TIMESTAMP => {:type => ::Thrift::Types::I64, :name => 'timestamp'},
CONSISTENCY_LEVEL => {:type => ::Thrift::Types::I32, :name => 'consistency_level', :default => 1, :enum_class => CassandraThrift::ConsistencyLevel}
}
@@ -1290,7 +1357,7 @@ def struct_fields; FIELDS; end
def validate
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field key is unset!') unless @key
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field column_path is unset!') unless @column_path
- raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field clock is unset!') unless @clock
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field timestamp is unset!') unless @timestamp
unless @consistency_level.nil? || CassandraThrift::ConsistencyLevel::VALID_VALUES.include?(@consistency_level)
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field consistency_level!')
end
@@ -1396,7 +1463,7 @@ def validate
end
- class Check_schema_agreement_args
+ class Describe_schema_versions_args
include ::Thrift::Struct
FIELDS = {
@@ -1410,7 +1477,7 @@ def validate
end
- class Check_schema_agreement_result
+ class Describe_schema_versions_result
include ::Thrift::Struct
SUCCESS = 0
IRE = 1
@@ -1448,7 +1515,7 @@ class Describe_keyspaces_result
::Thrift::Struct.field_accessor self, :success
FIELDS = {
- SUCCESS => {:type => ::Thrift::Types::SET, :name => 'success', :element => {:type => ::Thrift::Types::STRING}}
+ SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => CassandraThrift::KsDef}}
}
def struct_fields; FIELDS; end
@@ -1583,6 +1650,36 @@ def validate
end
+ class Describe_snitch_args
+ include ::Thrift::Struct
+
+ FIELDS = {
+
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ end
+
+ class Describe_snitch_result
+ include ::Thrift::Struct
+ SUCCESS = 0
+
+ ::Thrift::Struct.field_accessor self, :success
+ FIELDS = {
+ SUCCESS => {:type => ::Thrift::Types::STRING, :name => 'success'}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ end
+
class Describe_keyspace_args
include ::Thrift::Struct
KEYSPACE = 1
@@ -1607,7 +1704,7 @@ class Describe_keyspace_result
::Thrift::Struct.field_accessor self, :success, :nfe
FIELDS = {
- SUCCESS => {:type => ::Thrift::Types::MAP, :name => 'success', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::MAP, :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}}},
+ SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => CassandraThrift::KsDef},
NFE => {:type => ::Thrift::Types::STRUCT, :name => 'nfe', :class => CassandraThrift::NotFoundException}
}
@@ -1620,15 +1717,13 @@ def validate
class Describe_splits_args
include ::Thrift::Struct
- KEYSPACE = 1
- CFNAME = 2
- START_TOKEN = 3
- END_TOKEN = 4
- KEYS_PER_SPLIT = 5
+ CFNAME = 1
+ START_TOKEN = 2
+ END_TOKEN = 3
+ KEYS_PER_SPLIT = 4
- ::Thrift::Struct.field_accessor self, :keyspace, :cfName, :start_token, :end_token, :keys_per_split
+ ::Thrift::Struct.field_accessor self, :cfName, :start_token, :end_token, :keys_per_split
FIELDS = {
- KEYSPACE => {:type => ::Thrift::Types::STRING, :name => 'keyspace'},
CFNAME => {:type => ::Thrift::Types::STRING, :name => 'cfName'},
START_TOKEN => {:type => ::Thrift::Types::STRING, :name => 'start_token'},
END_TOKEN => {:type => ::Thrift::Types::STRING, :name => 'end_token'},
@@ -1638,7 +1733,6 @@ class Describe_splits_args
def struct_fields; FIELDS; end
def validate
- raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field keyspace is unset!') unless @keyspace
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field cfName is unset!') unless @cfName
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field start_token is unset!') unless @start_token
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field end_token is unset!') unless @end_token
@@ -1879,6 +1973,76 @@ def validate
end
+ class System_update_keyspace_args
+ include ::Thrift::Struct
+ KS_DEF = 1
+
+ ::Thrift::Struct.field_accessor self, :ks_def
+ FIELDS = {
+ KS_DEF => {:type => ::Thrift::Types::STRUCT, :name => 'ks_def', :class => CassandraThrift::KsDef}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field ks_def is unset!') unless @ks_def
+ end
+
+ end
+
+ class System_update_keyspace_result
+ include ::Thrift::Struct
+ SUCCESS = 0
+ IRE = 1
+
+ ::Thrift::Struct.field_accessor self, :success, :ire
+ FIELDS = {
+ SUCCESS => {:type => ::Thrift::Types::STRING, :name => 'success'},
+ IRE => {:type => ::Thrift::Types::STRUCT, :name => 'ire', :class => CassandraThrift::InvalidRequestException}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ end
+
+ class System_update_column_family_args
+ include ::Thrift::Struct
+ CF_DEF = 1
+
+ ::Thrift::Struct.field_accessor self, :cf_def
+ FIELDS = {
+ CF_DEF => {:type => ::Thrift::Types::STRUCT, :name => 'cf_def', :class => CassandraThrift::CfDef}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field cf_def is unset!') unless @cf_def
+ end
+
+ end
+
+ class System_update_column_family_result
+ include ::Thrift::Struct
+ SUCCESS = 0
+ IRE = 1
+
+ ::Thrift::Struct.field_accessor self, :success, :ire
+ FIELDS = {
+ SUCCESS => {:type => ::Thrift::Types::STRING, :name => 'success'},
+ IRE => {:type => ::Thrift::Types::STRUCT, :name => 'ire', :class => CassandraThrift::InvalidRequestException}
+ }
+
+ def struct_fields; FIELDS; end
+
+ def validate
+ end
+
+ end
+
end
end
View
2  vendor/0.7/gen-rb/cassandra_constants.rb
@@ -7,6 +7,6 @@
require 'cassandra_types'
module CassandraThrift
- VERSION = %q"10.0.0"
+ VERSION = %q"17.1.0"
end
View
79 vendor/0.7/gen-rb/cassandra_types.rb
@@ -20,17 +20,12 @@ module ConsistencyLevel
module IndexOperator
EQ = 0
- VALUE_MAP = {0 => "EQ"}
- VALID_VALUES = Set.new([EQ]).freeze
- end
-
- module AccessLevel
- NONE = 0
- READONLY = 16
- READWRITE = 32
- FULL = 64
- VALUE_MAP = {0 => "NONE", 16 => "READONLY", 32 => "READWRITE", 64 => "FULL"}
- VALID_VALUES = Set.new([NONE, READONLY, READWRITE, FULL]).freeze
+ GTE = 1
+ GT = 2
+ LTE = 3
+ LT = 4
+ VALUE_MAP = {0 => "EQ", 1 => "GTE", 2 => "GT", 3 => "LTE", 4 => "LT"}
+ VALID_VALUES = Set.new([EQ, GTE, GT, LTE, LT]).freeze
end
module IndexType
@@ -39,45 +34,23 @@ module IndexType
VALID_VALUES = Set.new([KEYS]).freeze
end
- # Encapsulate types of conflict resolution.
- #
- # @param timestamp. User-supplied timestamp. When two columns with this type of clock conflict, the one with the
- # highest timestamp is the one whose value the system will converge to. No other assumptions
- # are made about what the timestamp represents, but using microseconds-since-epoch is customary.
- class Clock
- include ::Thrift::Struct
- TIMESTAMP = 1
-
- ::Thrift::Struct.field_accessor self, :timestamp
- FIELDS = {
- TIMESTAMP => {:type => ::Thrift::Types::I64, :name => 'timestamp'}
- }
-
- def struct_fields; FIELDS; end
-
- def validate
- raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field timestamp is unset!') unless @timestamp
- end
-
- end
-
# Basic unit of data within a ColumnFamily.
# @param name, the name by which this column is set and retrieved. Maximum 64KB long.
# @param value. The data associated with the name. Maximum 2GB long, but in practice you should limit it to small numbers of MB (since Thrift must read the full value into memory to operate on it).
- # @param clock. The clock is used for conflict detection/resolution when two columns with same name need to be compared.
+ # @param timestamp. The timestamp is used for conflict detection/resolution when two columns with same name need to be compared.
# @param ttl. An optional, positive delay (in seconds) after which the column will be automatically deleted.
class Column
include ::Thrift::Struct
NAME = 1
VALUE = 2
- CLOCK = 3
+ TIMESTAMP = 3
TTL = 4
- ::Thrift::Struct.field_accessor self, :name, :value, :clock, :ttl
+ ::Thrift::Struct.field_accessor self, :name, :value, :timestamp, :ttl
FIELDS = {
NAME => {:type => ::Thrift::Types::STRING, :name => 'name'},
VALUE => {:type => ::Thrift::Types::STRING, :name => 'value'},
- CLOCK => {:type => ::Thrift::Types::STRUCT, :name => 'clock', :class => CassandraThrift::Clock},
+ TIMESTAMP => {:type => ::Thrift::Types::I64, :name => 'timestamp'},
TTL => {:type => ::Thrift::Types::I32, :name => 'ttl', :optional => true}
}
@@ -86,7 +59,7 @@ def struct_fields; FIELDS; end
def validate
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field name is unset!') unless @name
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field value is unset!') unless @value
- raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field clock is unset!') unless @clock
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field timestamp is unset!') unless @timestamp
end
end
@@ -509,13 +482,13 @@ def validate
class Deletion
include ::Thrift::Struct
- CLOCK = 1
+ TIMESTAMP = 1
SUPER_COLUMN = 2
PREDICATE = 3
- ::Thrift::Struct.field_accessor self, :clock, :super_column, :predicate
+ ::Thrift::Struct.field_accessor self, :timestamp, :super_column, :predicate
FIELDS = {
- CLOCK => {:type => ::Thrift::Types::STRUCT, :name => 'clock', :class => CassandraThrift::Clock},
+ TIMESTAMP => {:type => ::Thrift::Types::I64, :name => 'timestamp'},
SUPER_COLUMN => {:type => ::Thrift::Types::STRING, :name => 'super_column', :optional => true},
PREDICATE => {:type => ::Thrift::Types::STRUCT, :name => 'predicate', :class => CassandraThrift::SlicePredicate, :optional => true}
}
@@ -523,7 +496,7 @@ class Deletion
def struct_fields; FIELDS; end
def validate
- raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field clock is unset!') unless @clock
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field timestamp is unset!') unless @timestamp
end
end
@@ -572,7 +545,7 @@ def validate
end
- # Authentication requests can contain any data, dependent on the AuthenticationBackend used
+ # Authentication requests can contain any data, dependent on the IAuthenticator used
class AuthenticationRequest
include ::Thrift::Struct
CREDENTIALS = 1
@@ -622,10 +595,8 @@ class CfDef
KEYSPACE = 1
NAME = 2
COLUMN_TYPE = 3
- CLOCK_TYPE = 4
COMPARATOR_TYPE = 5
SUBCOMPARATOR_TYPE = 6
- RECONCILER = 7
COMMENT = 8
ROW_CACHE_SIZE = 9
PRELOAD_ROW_CACHE = 10
@@ -633,23 +604,29 @@ class CfDef
READ_REPAIR_CHANCE = 12
COLUMN_METADATA = 13
GC_GRACE_SECONDS = 14
+ DEFAULT_VALIDATION_CLASS = 15
+ ID = 16
+ MIN_COMPACTION_THRESHOLD = 17
+ MAX_COMPACTION_THRESHOLD = 18
- ::Thrift::Struct.field_accessor self, :keyspace, :name, :column_type, :clock_type, :comparator_type, :subcomparator_type, :reconciler, :comment, :row_cache_size, :preload_row_cache, :key_cache_size, :read_repair_chance, :column_metadata, :gc_grace_seconds
+ ::Thrift::Struct.field_accessor self, :keyspace, :name, :column_type, :comparator_type, :subcomparator_type, :comment, :row_cache_size, :preload_row_cache, :key_cache_size, :read_repair_chance, :column_metadata, :gc_grace_seconds, :default_validation_class, :id, :min_compaction_threshold, :max_compaction_threshold
FIELDS = {
KEYSPACE => {:type => ::Thrift::Types::STRING, :name => 'keyspace'},
NAME => {:type => ::Thrift::Types::STRING, :name => 'name'},
COLUMN_TYPE => {:type => ::Thrift::Types::STRING, :name => 'column_type', :default => %q"Standard", :optional => true},
- CLOCK_TYPE => {:type => ::Thrift::Types::STRING, :name => 'clock_type', :default => %q"Timestamp", :optional => true},
COMPARATOR_TYPE => {:type => ::Thrift::Types::STRING, :name => 'comparator_type', :default => %q"BytesType", :optional => true},
- SUBCOMPARATOR_TYPE => {:type => ::Thrift::Types::STRING, :name => 'subcomparator_type', :default => %q"", :optional => true},
- RECONCILER => {:type => ::Thrift::Types::STRING, :name => 'reconciler', :default => %q"", :optional => true},
- COMMENT => {:type => ::Thrift::Types::STRING, :name => 'comment', :default => %q"", :optional => true},
+ SUBCOMPARATOR_TYPE => {:type => ::Thrift::Types::STRING, :name => 'subcomparator_type', :optional => true},
+ COMMENT => {:type => ::Thrift::Types::STRING, :name => 'comment', :optional => true},
ROW_CACHE_SIZE => {:type => ::Thrift::Types::DOUBLE, :name => 'row_cache_size', :default => 0, :optional => true},
PRELOAD_ROW_CACHE => {:type => ::Thrift::Types::BOOL, :name => 'preload_row_cache', :default => false, :optional => true},
KEY_CACHE_SIZE => {:type => ::Thrift::Types::DOUBLE, :name => 'key_cache_size', :default => 200000, :optional => true},
READ_REPAIR_CHANCE => {:type => ::Thrift::Types::DOUBLE, :name => 'read_repair_chance', :default => 1, :optional => true},
COLUMN_METADATA => {:type => ::Thrift::Types::LIST, :name => 'column_metadata', :element => {:type => ::Thrift::Types::STRUCT, :class => CassandraThrift::ColumnDef}, :optional => true},
- GC_GRACE_SECONDS => {:type => ::Thrift::Types::I32, :name => 'gc_grace_seconds', :optional => true}
+ GC_GRACE_SECONDS => {:type => ::Thrift::Types::I32, :name => 'gc_grace_seconds', :optional => true},
+ DEFAULT_VALIDATION_CLASS => {:type => ::Thrift::Types::STRING, :name => 'default_validation_class', :optional => true},
+ ID => {:type => ::Thrift::Types::I32, :name => 'id', :optional => true},
+ MIN_COMPACTION_THRESHOLD => {:type => ::Thrift::Types::I32, :name => 'min_compaction_threshold', :optional => true},
+ MAX_COMPACTION_THRESHOLD => {:type => ::Thrift::Types::I32, :name => 'max_compaction_threshold', :optional => true}
}
def struct_fields; FIELDS; end
Please sign in to comment.
Something went wrong with that request. Please try again.