vendor/gen-rb/cassandra.rb in cassandra-0.7 vs vendor/gen-rb/cassandra.rb in cassandra-0.7.1

- old
+ new

@@ -25,10 +25,11 @@ result = receive_message(Get_result) return result.success unless result.success.nil? raise result.ire unless result.ire.nil? raise result.nfe unless result.nfe.nil? raise result.ue unless result.ue.nil? + raise result.te unless result.te.nil? raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get failed: unknown result') end def get_slice(keyspace, key, column_parent, predicate, consistency_level) send_get_slice(keyspace, key, column_parent, predicate, consistency_level) @@ -41,12 +42,12 @@ def recv_get_slice() result = receive_message(Get_slice_result) return result.success unless result.success.nil? raise result.ire unless result.ire.nil? - raise result.nfe unless result.nfe.nil? raise result.ue unless result.ue.nil? + raise result.te unless result.te.nil? raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_slice failed: unknown result') end def multiget(keyspace, keys, column_path, consistency_level) send_multiget(keyspace, keys, column_path, consistency_level) @@ -60,10 +61,11 @@ def recv_multiget() result = receive_message(Multiget_result) return result.success unless result.success.nil? raise result.ire unless result.ire.nil? raise result.ue unless result.ue.nil? + raise result.te unless result.te.nil? raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'multiget failed: unknown result') end def multiget_slice(keyspace, keys, column_parent, predicate, consistency_level) send_multiget_slice(keyspace, keys, column_parent, predicate, consistency_level) @@ -77,10 +79,11 @@ def recv_multiget_slice() result = receive_message(Multiget_slice_result) return result.success unless result.success.nil? raise result.ire unless result.ire.nil? raise result.ue unless result.ue.nil? + raise result.te unless result.te.nil? raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'multiget_slice failed: unknown result') end def get_count(keyspace, key, column_parent, consistency_level) send_get_count(keyspace, key, column_parent, consistency_level) @@ -94,15 +97,15 @@ def recv_get_count() result = receive_message(Get_count_result) return result.success unless result.success.nil? raise result.ire unless result.ire.nil? raise result.ue unless result.ue.nil? + raise result.te unless result.te.nil? raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_count failed: unknown result') end def get_key_range(keyspace, column_family, start, finish, count, consistency_level) - send_get_key_range(keyspace, column_family, start, finish, count, consistency_level) return recv_get_key_range() end def send_get_key_range(keyspace, column_family, start, finish, count, consistency_level) @@ -112,13 +115,32 @@ def recv_get_key_range() result = receive_message(Get_key_range_result) return result.success unless result.success.nil? raise result.ire unless result.ire.nil? raise result.ue unless result.ue.nil? + raise result.te unless result.te.nil? raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_key_range failed: unknown result') end + def get_range_slice(keyspace, column_parent, predicate, start_key, finish_key, row_count, consistency_level) + send_get_range_slice(keyspace, column_parent, predicate, start_key, finish_key, row_count, consistency_level) + return recv_get_range_slice() + end + + def send_get_range_slice(keyspace, column_parent, predicate, start_key, finish_key, row_count, consistency_level) + send_message('get_range_slice', Get_range_slice_args, :keyspace => keyspace, :column_parent => column_parent, :predicate => predicate, :start_key => start_key, :finish_key => finish_key, :row_count => row_count, :consistency_level => consistency_level) + end + + def recv_get_range_slice() + result = receive_message(Get_range_slice_result) + return result.success unless result.success.nil? + raise result.ire unless result.ire.nil? + raise result.ue unless result.ue.nil? + raise result.te unless result.te.nil? + raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_range_slice failed: unknown result') + end + def insert(keyspace, key, column_path, value, timestamp, consistency_level) send_insert(keyspace, key, column_path, value, timestamp, consistency_level) recv_insert() end @@ -128,10 +150,11 @@ def recv_insert() result = receive_message(Insert_result) raise result.ire unless result.ire.nil? raise result.ue unless result.ue.nil? + raise result.te unless result.te.nil? return end def batch_insert(keyspace, key, cfmap, consistency_level) send_batch_insert(keyspace, key, cfmap, consistency_level) @@ -144,10 +167,11 @@ def recv_batch_insert() result = receive_message(Batch_insert_result) raise result.ire unless result.ire.nil? raise result.ue unless result.ue.nil? + raise result.te unless result.te.nil? return end def remove(keyspace, key, column_path, timestamp, consistency_level) send_remove(keyspace, key, column_path, timestamp, consistency_level) @@ -160,10 +184,11 @@ def recv_remove() result = receive_message(Remove_result) raise result.ire unless result.ire.nil? raise result.ue unless result.ue.nil? + raise result.te unless result.te.nil? return end def get_string_property(property) send_get_string_property(property) @@ -225,10 +250,12 @@ result.ire = ire rescue CassandraThrift::NotFoundException => nfe result.nfe = nfe rescue CassandraThrift::UnavailableException => ue result.ue = ue + rescue CassandraThrift::TimedOutException => te + result.te = te end write_result(result, oprot, 'get', seqid) end def process_get_slice(seqid, iprot, oprot) @@ -236,14 +263,14 @@ result = Get_slice_result.new() begin result.success = @handler.get_slice(args.keyspace, args.key, args.column_parent, args.predicate, args.consistency_level) rescue CassandraThrift::InvalidRequestException => ire result.ire = ire - rescue CassandraThrift::NotFoundException => nfe - result.nfe = nfe rescue CassandraThrift::UnavailableException => ue result.ue = ue + rescue CassandraThrift::TimedOutException => te + result.te = te end write_result(result, oprot, 'get_slice', seqid) end def process_multiget(seqid, iprot, oprot) @@ -253,10 +280,12 @@ result.success = @handler.multiget(args.keyspace, args.keys, args.column_path, args.consistency_level) rescue CassandraThrift::InvalidRequestException => ire result.ire = ire rescue CassandraThrift::UnavailableException => ue result.ue = ue + rescue CassandraThrift::TimedOutException => te + result.te = te end write_result(result, oprot, 'multiget', seqid) end def process_multiget_slice(seqid, iprot, oprot) @@ -266,10 +295,12 @@ result.success = @handler.multiget_slice(args.keyspace, args.keys, args.column_parent, args.predicate, args.consistency_level) rescue CassandraThrift::InvalidRequestException => ire result.ire = ire rescue CassandraThrift::UnavailableException => ue result.ue = ue + rescue CassandraThrift::TimedOutException => te + result.te = te end write_result(result, oprot, 'multiget_slice', seqid) end def process_get_count(seqid, iprot, oprot) @@ -279,10 +310,12 @@ result.success = @handler.get_count(args.keyspace, args.key, args.column_parent, args.consistency_level) rescue CassandraThrift::InvalidRequestException => ire result.ire = ire rescue CassandraThrift::UnavailableException => ue result.ue = ue + rescue CassandraThrift::TimedOutException => te + result.te = te end write_result(result, oprot, 'get_count', seqid) end def process_get_key_range(seqid, iprot, oprot) @@ -292,23 +325,42 @@ result.success = @handler.get_key_range(args.keyspace, args.column_family, args.start, args.finish, args.count, args.consistency_level) rescue CassandraThrift::InvalidRequestException => ire result.ire = ire rescue CassandraThrift::UnavailableException => ue result.ue = ue + rescue CassandraThrift::TimedOutException => te + result.te = te end write_result(result, oprot, 'get_key_range', seqid) end + def process_get_range_slice(seqid, iprot, oprot) + args = read_args(iprot, Get_range_slice_args) + result = Get_range_slice_result.new() + begin + result.success = @handler.get_range_slice(args.keyspace, args.column_parent, args.predicate, args.start_key, args.finish_key, args.row_count, args.consistency_level) + rescue CassandraThrift::InvalidRequestException => ire + result.ire = ire + rescue CassandraThrift::UnavailableException => ue + result.ue = ue + rescue CassandraThrift::TimedOutException => te + result.te = te + end + write_result(result, oprot, 'get_range_slice', seqid) + end + def process_insert(seqid, iprot, oprot) args = read_args(iprot, Insert_args) result = Insert_result.new() begin @handler.insert(args.keyspace, args.key, args.column_path, args.value, args.timestamp, args.consistency_level) rescue CassandraThrift::InvalidRequestException => ire result.ire = ire rescue CassandraThrift::UnavailableException => ue result.ue = ue + rescue CassandraThrift::TimedOutException => te + result.te = te end write_result(result, oprot, 'insert', seqid) end def process_batch_insert(seqid, iprot, oprot) @@ -318,10 +370,12 @@ @handler.batch_insert(args.keyspace, args.key, args.cfmap, args.consistency_level) rescue CassandraThrift::InvalidRequestException => ire result.ire = ire rescue CassandraThrift::UnavailableException => ue result.ue = ue + rescue CassandraThrift::TimedOutException => te + result.te = te end write_result(result, oprot, 'batch_insert', seqid) end def process_remove(seqid, iprot, oprot) @@ -331,10 +385,12 @@ @handler.remove(args.keyspace, args.key, args.column_path, args.timestamp, args.consistency_level) rescue CassandraThrift::InvalidRequestException => ire result.ire = ire rescue CassandraThrift::UnavailableException => ue result.ue = ue + rescue CassandraThrift::TimedOutException => te + result.te = te end write_result(result, oprot, 'remove', seqid) end def process_get_string_property(seqid, iprot, oprot) @@ -395,17 +451,19 @@ include ::Thrift::Struct SUCCESS = 0 IRE = 1 NFE = 2 UE = 3 + TE = 4 - ::Thrift::Struct.field_accessor self, :success, :ire, :nfe, :ue + ::Thrift::Struct.field_accessor self, :success, :ire, :nfe, :ue, :te FIELDS = { SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => CassandraThrift::ColumnOrSuperColumn}, IRE => {:type => ::Thrift::Types::STRUCT, :name => 'ire', :class => CassandraThrift::InvalidRequestException}, NFE => {:type => ::Thrift::Types::STRUCT, :name => 'nfe', :class => CassandraThrift::NotFoundException}, - UE => {:type => ::Thrift::Types::STRUCT, :name => 'ue', :class => CassandraThrift::UnavailableException} + UE => {:type => ::Thrift::Types::STRUCT, :name => 'ue', :class => CassandraThrift::UnavailableException}, + TE => {:type => ::Thrift::Types::STRUCT, :name => 'te', :class => CassandraThrift::TimedOutException} } def struct_fields; FIELDS; end def validate @@ -442,19 +500,19 @@ class Get_slice_result include ::Thrift::Struct SUCCESS = 0 IRE = 1 - NFE = 2 - UE = 3 + UE = 2 + TE = 3 - ::Thrift::Struct.field_accessor self, :success, :ire, :nfe, :ue + ::Thrift::Struct.field_accessor self, :success, :ire, :ue, :te FIELDS = { SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => CassandraThrift::ColumnOrSuperColumn}}, IRE => {:type => ::Thrift::Types::STRUCT, :name => 'ire', :class => CassandraThrift::InvalidRequestException}, - NFE => {:type => ::Thrift::Types::STRUCT, :name => 'nfe', :class => CassandraThrift::NotFoundException}, - UE => {:type => ::Thrift::Types::STRUCT, :name => 'ue', :class => CassandraThrift::UnavailableException} + UE => {:type => ::Thrift::Types::STRUCT, :name => 'ue', :class => CassandraThrift::UnavailableException}, + TE => {:type => ::Thrift::Types::STRUCT, :name => 'te', :class => CassandraThrift::TimedOutException} } def struct_fields; FIELDS; end def validate @@ -490,16 +548,18 @@ class Multiget_result include ::Thrift::Struct SUCCESS = 0 IRE = 1 UE = 2 + TE = 3 - ::Thrift::Struct.field_accessor self, :success, :ire, :ue + ::Thrift::Struct.field_accessor self, :success, :ire, :ue, :te FIELDS = { SUCCESS => {:type => ::Thrift::Types::MAP, :name => 'success', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRUCT, :class => CassandraThrift::ColumnOrSuperColumn}}, IRE => {:type => ::Thrift::Types::STRUCT, :name => 'ire', :class => CassandraThrift::InvalidRequestException}, - UE => {:type => ::Thrift::Types::STRUCT, :name => 'ue', :class => CassandraThrift::UnavailableException} + UE => {:type => ::Thrift::Types::STRUCT, :name => 'ue', :class => CassandraThrift::UnavailableException}, + TE => {:type => ::Thrift::Types::STRUCT, :name => 'te', :class => CassandraThrift::TimedOutException} } def struct_fields; FIELDS; end def validate @@ -537,16 +597,18 @@ class Multiget_slice_result include ::Thrift::Struct SUCCESS = 0 IRE = 1 UE = 2 + TE = 3 - ::Thrift::Struct.field_accessor self, :success, :ire, :ue + ::Thrift::Struct.field_accessor self, :success, :ire, :ue, :te FIELDS = { SUCCESS => {:type => ::Thrift::Types::MAP, :name => 'success', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::LIST, :element => {:type => ::Thrift::Types::STRUCT, :class => CassandraThrift::ColumnOrSuperColumn}}}, IRE => {:type => ::Thrift::Types::STRUCT, :name => 'ire', :class => CassandraThrift::InvalidRequestException}, - UE => {:type => ::Thrift::Types::STRUCT, :name => 'ue', :class => CassandraThrift::UnavailableException} + UE => {:type => ::Thrift::Types::STRUCT, :name => 'ue', :class => CassandraThrift::UnavailableException}, + TE => {:type => ::Thrift::Types::STRUCT, :name => 'te', :class => CassandraThrift::TimedOutException} } def struct_fields; FIELDS; end def validate @@ -582,16 +644,18 @@ class Get_count_result include ::Thrift::Struct SUCCESS = 0 IRE = 1 UE = 2 + TE = 3 - ::Thrift::Struct.field_accessor self, :success, :ire, :ue + ::Thrift::Struct.field_accessor self, :success, :ire, :ue, :te FIELDS = { SUCCESS => {:type => ::Thrift::Types::I32, :name => 'success'}, IRE => {:type => ::Thrift::Types::STRUCT, :name => 'ire', :class => CassandraThrift::InvalidRequestException}, - UE => {:type => ::Thrift::Types::STRUCT, :name => 'ue', :class => CassandraThrift::UnavailableException} + UE => {:type => ::Thrift::Types::STRUCT, :name => 'ue', :class => CassandraThrift::UnavailableException}, + TE => {:type => ::Thrift::Types::STRUCT, :name => 'te', :class => CassandraThrift::TimedOutException} } def struct_fields; FIELDS; end def validate @@ -631,25 +695,80 @@ class Get_key_range_result include ::Thrift::Struct SUCCESS = 0 IRE = 1 UE = 2 + TE = 3 - ::Thrift::Struct.field_accessor self, :success, :ire, :ue + ::Thrift::Struct.field_accessor self, :success, :ire, :ue, :te FIELDS = { SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRING}}, IRE => {:type => ::Thrift::Types::STRUCT, :name => 'ire', :class => CassandraThrift::InvalidRequestException}, - UE => {:type => ::Thrift::Types::STRUCT, :name => 'ue', :class => CassandraThrift::UnavailableException} + UE => {:type => ::Thrift::Types::STRUCT, :name => 'ue', :class => CassandraThrift::UnavailableException}, + TE => {:type => ::Thrift::Types::STRUCT, :name => 'te', :class => CassandraThrift::TimedOutException} } def struct_fields; FIELDS; end def validate end end + class Get_range_slice_args + include ::Thrift::Struct + KEYSPACE = 1 + COLUMN_PARENT = 2 + PREDICATE = 3 + START_KEY = 4 + FINISH_KEY = 5 + ROW_COUNT = 6 + CONSISTENCY_LEVEL = 7 + + ::Thrift::Struct.field_accessor self, :keyspace, :column_parent, :predicate, :start_key, :finish_key, :row_count, :consistency_level + FIELDS = { + KEYSPACE => {:type => ::Thrift::Types::STRING, :name => 'keyspace'}, + COLUMN_PARENT => {:type => ::Thrift::Types::STRUCT, :name => 'column_parent', :class => CassandraThrift::ColumnParent}, + PREDICATE => {:type => ::Thrift::Types::STRUCT, :name => 'predicate', :class => CassandraThrift::SlicePredicate}, + START_KEY => {:type => ::Thrift::Types::STRING, :name => 'start_key', :default => %q""}, + FINISH_KEY => {:type => ::Thrift::Types::STRING, :name => 'finish_key', :default => %q""}, + ROW_COUNT => {:type => ::Thrift::Types::I32, :name => 'row_count', :default => 100}, + CONSISTENCY_LEVEL => {:type => ::Thrift::Types::I32, :name => 'consistency_level', :default => 1, :enum_class => CassandraThrift::ConsistencyLevel} + } + + def struct_fields; FIELDS; end + + def validate + 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 + end + + end + + class Get_range_slice_result + include ::Thrift::Struct + SUCCESS = 0 + IRE = 1 + UE = 2 + TE = 3 + + ::Thrift::Struct.field_accessor self, :success, :ire, :ue, :te + FIELDS = { + SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => CassandraThrift::KeySlice}}, + IRE => {:type => ::Thrift::Types::STRUCT, :name => 'ire', :class => CassandraThrift::InvalidRequestException}, + UE => {:type => ::Thrift::Types::STRUCT, :name => 'ue', :class => CassandraThrift::UnavailableException}, + TE => {:type => ::Thrift::Types::STRUCT, :name => 'te', :class => CassandraThrift::TimedOutException} + } + + def struct_fields; FIELDS; end + + def validate + end + + end + class Insert_args include ::Thrift::Struct KEYSPACE = 1 KEY = 2 COLUMN_PATH = 3 @@ -679,15 +798,17 @@ class Insert_result include ::Thrift::Struct IRE = 1 UE = 2 + TE = 3 - ::Thrift::Struct.field_accessor self, :ire, :ue + ::Thrift::Struct.field_accessor self, :ire, :ue, :te FIELDS = { IRE => {:type => ::Thrift::Types::STRUCT, :name => 'ire', :class => CassandraThrift::InvalidRequestException}, - UE => {:type => ::Thrift::Types::STRUCT, :name => 'ue', :class => CassandraThrift::UnavailableException} + UE => {:type => ::Thrift::Types::STRUCT, :name => 'ue', :class => CassandraThrift::UnavailableException}, + TE => {:type => ::Thrift::Types::STRUCT, :name => 'te', :class => CassandraThrift::TimedOutException} } def struct_fields; FIELDS; end def validate @@ -722,15 +843,17 @@ class Batch_insert_result include ::Thrift::Struct IRE = 1 UE = 2 + TE = 3 - ::Thrift::Struct.field_accessor self, :ire, :ue + ::Thrift::Struct.field_accessor self, :ire, :ue, :te FIELDS = { IRE => {:type => ::Thrift::Types::STRUCT, :name => 'ire', :class => CassandraThrift::InvalidRequestException}, - UE => {:type => ::Thrift::Types::STRUCT, :name => 'ue', :class => CassandraThrift::UnavailableException} + UE => {:type => ::Thrift::Types::STRUCT, :name => 'ue', :class => CassandraThrift::UnavailableException}, + TE => {:type => ::Thrift::Types::STRUCT, :name => 'te', :class => CassandraThrift::TimedOutException} } def struct_fields; FIELDS; end def validate @@ -767,14 +890,16 @@ class Remove_result include ::Thrift::Struct IRE = 1 UE = 2 + TE = 3 - ::Thrift::Struct.field_accessor self, :ire, :ue + ::Thrift::Struct.field_accessor self, :ire, :ue, :te FIELDS = { IRE => {:type => ::Thrift::Types::STRUCT, :name => 'ire', :class => CassandraThrift::InvalidRequestException}, - UE => {:type => ::Thrift::Types::STRUCT, :name => 'ue', :class => CassandraThrift::UnavailableException} + UE => {:type => ::Thrift::Types::STRUCT, :name => 'ue', :class => CassandraThrift::UnavailableException}, + TE => {:type => ::Thrift::Types::STRUCT, :name => 'te', :class => CassandraThrift::TimedOutException} } def struct_fields; FIELDS; end def validate