Permalink
Browse files

update thrift bindings for cassandra server 0.7beta2

  • Loading branch information...
1 parent f10eae8 commit 47aa9dd34878f120e8cc71ad1b0a24be7f90f4ce Matt Conway committed Oct 3, 2010
@@ -1,15 +1,3 @@
-# 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
@@ -43,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
)
)
@@ -59,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
)
}
@@ -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)
@@ -187,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()
@@ -329,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()
@@ -643,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
@@ -732,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()
@@ -1071,7 +1093,7 @@ class Multiget_slice_args
::Thrift::Struct.field_accessor self, :keys, :column_parent, :predicate, :consistency_level
FIELDS = {
- KEYS => {:type => ::Thrift::Types::SET, :name => 'keys', :element => {:type => ::Thrift::Types::STRING}},
+ 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},
CONSISTENCY_LEVEL => {:type => ::Thrift::Types::I32, :name => 'consistency_level', :default => 1, :enum_class => CassandraThrift::ConsistencyLevel}
@@ -1122,7 +1144,7 @@ class Multiget_count_args
::Thrift::Struct.field_accessor self, :keys, :column_parent, :predicate, :consistency_level
FIELDS = {
- KEYS => {:type => ::Thrift::Types::SET, :name => 'keys', :element => {:type => ::Thrift::Types::STRING}},
+ 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},
CONSISTENCY_LEVEL => {:type => ::Thrift::Types::I32, :name => 'consistency_level', :default => 1, :enum_class => CassandraThrift::ConsistencyLevel}
@@ -1319,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}
}
@@ -1335,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
@@ -1628,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
@@ -7,6 +7,6 @@
require 'cassandra_types'
module CassandraThrift
- VERSION = %q"14.0.0"
+ VERSION = %q"17.1.0"
end
@@ -34,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}
}
@@ -81,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
@@ -504,21 +482,21 @@ 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}
}
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
@@ -617,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
@@ -630,25 +606,27 @@ class CfDef
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, :default_validation_class, :id
+ ::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},
DEFAULT_VALIDATION_CLASS => {:type => ::Thrift::Types::STRING, :name => 'default_validation_class', :optional => true},
- ID => {:type => ::Thrift::Types::I32, :name => 'id', :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

0 comments on commit 47aa9dd

Please sign in to comment.