diff options
author | Bryan Duxbury <bryanduxbury@apache.org> | 2009-03-24 05:23:52 +0000 |
---|---|---|
committer | Bryan Duxbury <bryanduxbury@apache.org> | 2009-03-24 05:23:52 +0000 |
commit | e8ae5d3728de07e880d6477db0f63ed9a7c65415 (patch) | |
tree | 3b55ef7506d405e597aaf053d78b1dd00f279c2f /lib/rb/lib | |
parent | 127d01cb0635dcf9c4650c00ef822b9f6bd7be85 (diff) | |
download | thrift-e8ae5d3728de07e880d6477db0f63ed9a7c65415.tar.gz |
THRIFT-275. rb: Remove deprecated classes from Ruby library
This patch removes all the deprecation stuff and the t*.rb classes that were only placeholders. In addition, I've changed the implementations of some "abstract" methods to throw NotImplementedError instead of returning nil, and fixed the test accordingly. Finally, I removed the no longer required borrow and consume methods from all the transport implementations that had them. (Borrow and consume have been supplanted by the thrift_native package.)
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@757668 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'lib/rb/lib')
22 files changed, 14 insertions, 482 deletions
diff --git a/lib/rb/lib/thrift.rb b/lib/rb/lib/thrift.rb index fef7045b2..df447a043 100644 --- a/lib/rb/lib/thrift.rb +++ b/lib/rb/lib/thrift.rb @@ -24,7 +24,6 @@ module Thrift DEPRECATION = false unless const_defined? :DEPRECATION end -require 'thrift/deprecation' require 'thrift/exceptions' require 'thrift/types' require 'thrift/processor' diff --git a/lib/rb/lib/thrift/client.rb b/lib/rb/lib/thrift/client.rb index 5934eea33..5b30f0150 100644 --- a/lib/rb/lib/thrift/client.rb +++ b/lib/rb/lib/thrift/client.rb @@ -59,5 +59,4 @@ module Thrift end end end - deprecate_module! :ThriftClient => Client end diff --git a/lib/rb/lib/thrift/deprecation.rb b/lib/rb/lib/thrift/deprecation.rb deleted file mode 100644 index 8b15a169e..000000000 --- a/lib/rb/lib/thrift/deprecation.rb +++ /dev/null @@ -1,174 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -# provide a backwards-compatible wrapper API and deprecate it - -module Thrift - DEPRECATION = true unless const_defined?(:DEPRECATION) -end - -class Module - # Wraps the given methods to print a warning and call the real method - # Example: - # deprecate! :readAll => :read_all - #-- - # Yeah, this is ugly, passing a string to module_eval, but unfortunately - # using a block removes the ability to pass blocks to the defined method - # and breaks spec - def deprecate!(methods) - return unless Thrift::DEPRECATION - methods.each_pair do |old, new| - module_eval <<-EOF - def #{old}(*args, &block) - old, new = #{[old,new].inspect} - STDERR.puts "Warning: calling deprecated method \#{self.is_a?(Module) ? "\#{self}." : "\#{self.class}#"}\#{old}" - STDERR.puts " from \#{caller.first}" - target = (self.is_a?(Module) ? (class << self;self;end) : self.class) - target.send :define_method, old, target.instance_method(new) # unwrap - target.instance_method(new).bind(self).call(*args, &block) - end - EOF - end - end -end - -module Thrift::DeprecationProxy # :nodoc: - # there's a really weird bug in Ruby where class variables behave wrong - # when used in a Class.new or #class_eval rather than in a class foo block. - CLASS_MAPPING = {} - MODULE_MAPPING = {} - def self.new_class(obj, name) - klass_id = CLASS_MAPPING.size - CLASS_MAPPING[klass_id] = [obj, name, true] - klass = Class.new(obj) do - klass = self - instance_methods.sort.reject { |x| [:__id__,:__send__].include? x.to_sym }.each do |sym| - undef_method sym - end - define_method :__thrift_deprecation_proxy_klass_id do - klass_id - end - def method_missing(sym, *args, &block) - klass_id = __thrift_deprecation_proxy_klass_id - obj, name, warned = CLASS_MAPPING[klass_id] - obj.instance_method(sym).bind(self).call(*args, &block) - end - (class << self;self;end).class_eval do - instance_methods.sort.reject { |x| [:__id__,:__send__].include? x.to_sym }.each do |sym| - undef_method sym - end - define_method :__thrift_deprecation_proxy_klass do - [klass, klass_id] - end - def method_missing(sym, *args, &block) - klass, klass_id = __thrift_deprecation_proxy_klass - obj, name, warned = CLASS_MAPPING[klass_id] - unless warned - STDERR.puts "Warning: class #{name} is deprecated" - STDERR.puts " from #{Thrift::DeprecationProxy.process_caller(caller)}" - CLASS_MAPPING[klass_id][2] = true - end - if klass.__id__ == self.__id__ - obj.send sym, *args, &block - else - obj.method(sym).unbind.bind(self).call(*args, &block) - end - end - end - end - CLASS_MAPPING[klass_id][2] = false - klass - end - def self.new_module(obj, name) - mod_id = MODULE_MAPPING.size - MODULE_MAPPING[mod_id] = [obj, name, true] - mod = Module.new do - include obj - instance_methods.sort.reject { |x| [:__id__,:__send__].include? x.to_sym }.each do |sym| - undef_method sym - end - define_method :__thrift_deprecation_proxy_module_id do - mod_id - end - def method_missing(sym, *args, &block) - mod_id = __thrift_deprecation_proxy_module_id - obj, name, warned = MODULE_MAPPING[mod_id] - unless warned - STDERR.puts "Warning: module #{name} is deprecated" - STDERR.puts " from #{Thrift::DeprecationProxy.process_caller(caller)}" - MODULE_MAPPING[mod_id][2] = true - end - obj.instance_method(sym).bind(self).call(*args, &block) - end - (class << self;self;end).class_eval do - instance_methods.sort.reject { |x| [:__id__,:__send__].include? x.to_sym }.each do |sym| - undef_method sym - end - define_method :__thrift_deprecation_proxy_module_id do - mod_id - end - def method_missing(sym, *args, &block) - mod_id = __thrift_deprecation_proxy_module_id - obj, name, warned = MODULE_MAPPING[mod_id] - unless warned - STDERR.puts "Warning: module #{name} is deprecated" - STDERR.puts " from #{Thrift::DeprecationProxy.process_caller(caller)}" - MODULE_MAPPING[mod_id][2] = true - end - obj.send sym, *args, &block - end - end - end - MODULE_MAPPING[mod_id][2] = false - mod - end - def self.process_caller(stack) - dir = File.dirname(__FILE__) - stack.find { |frame| frame[0,dir.size] != dir } - end - def self.reset_deprecation_warnings - CLASS_MAPPING.each { |k,v| v[2] = false } - MODULE_MAPPING.each { |k,v| v[2] = false } - end -end - -module Kernel - # Provides an alternate name for the class for deprecation purposes - # Example: - # deprecate_class! :TBinaryProtocol => Thrift::BinaryProtocol - #-- - # at the moment this only works for creating top-level constants - # if necessary, this can be extended to take something like :'Thrift::TBinaryProtocol' - # alternately, Module can be extended with a similar method - def deprecate_class!(klasses) - return unless Thrift::DEPRECATION - klasses.each_pair do |old, new| - raise "deprecate_class! expected Class, called with #{new}" unless new.is_a? Class - Object.const_set old, Thrift::DeprecationProxy.new_class(new, old) - end - end - - # like deprecate_class! but for Modules - def deprecate_module!(modules) - return unless Thrift::DEPRECATION - modules.each_pair do |old, new| - Object.const_set old, Thrift::DeprecationProxy.new_module(new, old) - end - end -end diff --git a/lib/rb/lib/thrift/exceptions.rb b/lib/rb/lib/thrift/exceptions.rb index 90afe8eb7..dda70894b 100644 --- a/lib/rb/lib/thrift/exceptions.rb +++ b/lib/rb/lib/thrift/exceptions.rb @@ -26,7 +26,6 @@ module Thrift attr_reader :message end - deprecate_class! :TException => Exception class ApplicationException < Exception @@ -80,5 +79,4 @@ module Thrift end end - deprecate_class! :TApplicationException => ApplicationException end
\ No newline at end of file diff --git a/lib/rb/lib/thrift/processor.rb b/lib/rb/lib/thrift/processor.rb index 4ec819a3b..5d9e0a11c 100644 --- a/lib/rb/lib/thrift/processor.rb +++ b/lib/rb/lib/thrift/processor.rb @@ -54,5 +54,4 @@ module Thrift oprot.trans.flush end end - deprecate_module! :TProcessor => Processor end diff --git a/lib/rb/lib/thrift/protocol.rb b/lib/rb/lib/thrift/protocol.rb index e5ae4aaae..adeddefda 100644 --- a/lib/rb/lib/thrift/protocol.rb +++ b/lib/rb/lib/thrift/protocol.rb @@ -37,7 +37,6 @@ module Thrift end end - deprecate_class! :TProtocolException => ProtocolException class Protocol @@ -55,173 +54,134 @@ module Thrift def write_message_begin(name, type, seqid) raise NotImplementedError end - deprecate! :writeMessageBegin => :write_message_begin def write_message_end; nil; end - deprecate! :writeMessageEnd => :write_message_end def write_struct_begin(name) raise NotImplementedError end - deprecate! :writeStructBegin => :write_struct_begin def write_struct_end; nil; end - deprecate! :writeStructEnd => :write_struct_end def write_field_begin(name, type, id) raise NotImplementedError end - deprecate! :writeFieldBegin => :write_field_begin def write_field_end; nil; end - deprecate! :writeFieldEnd => :write_field_end def write_field_stop raise NotImplementedError end - deprecate! :writeFieldStop => :write_field_stop def write_map_begin(ktype, vtype, size) raise NotImplementedError end - deprecate! :writeMapBegin => :write_map_begin def write_map_end; nil; end - deprecate! :writeMapEnd => :write_map_end def write_list_begin(etype, size) raise NotImplementedError end - deprecate! :writeListBegin => :write_list_begin def write_list_end; nil; end - deprecate! :writeListEnd => :write_list_end def write_set_begin(etype, size) raise NotImplementedError end - deprecate! :writeSetBegin => :write_set_begin def write_set_end; nil; end - deprecate! :writeSetEnd => :write_set_end def write_bool(bool) raise NotImplementedError end - deprecate! :writeBool => :write_bool def write_byte(byte) raise NotImplementedError end - deprecate! :writeByte => :write_byte def write_i16(i16) raise NotImplementedError end - deprecate! :writeI16 => :write_i16 def write_i32(i32) raise NotImplementedError end - deprecate! :writeI32 => :write_i32 def write_i64(i64) raise NotImplementedError end - deprecate! :writeI64 => :write_i64 def write_double(dub) raise NotImplementedError end - deprecate! :writeDouble => :write_double def write_string(str) raise NotImplementedError end - deprecate! :writeString => :write_string def read_message_begin raise NotImplementedError end - deprecate! :readMessageBegin => :read_message_begin def read_message_end; nil; end - deprecate! :readMessageEnd => :read_message_end def read_struct_begin raise NotImplementedError end - deprecate! :readStructBegin => :read_struct_begin def read_struct_end; nil; end - deprecate! :readStructEnd => :read_struct_end def read_field_begin raise NotImplementedError end - deprecate! :readFieldBegin => :read_field_begin def read_field_end; nil; end - deprecate! :readFieldEnd => :read_field_end def read_map_begin raise NotImplementedError end - deprecate! :readMapBegin => :read_map_begin def read_map_end; nil; end - deprecate! :readMapEnd => :read_map_end def read_list_begin raise NotImplementedError end - deprecate! :readListBegin => :read_list_begin def read_list_end; nil; end - deprecate! :readListEnd => :read_list_end def read_set_begin raise NotImplementedError end - deprecate! :readSetBegin => :read_set_begin def read_set_end; nil; end - deprecate! :readSetEnd => :read_set_end def read_bool raise NotImplementedError end - deprecate! :readBool => :read_bool def read_byte raise NotImplementedError end - deprecate! :readByte => :read_byte def read_i16 raise NotImplementedError end - deprecate! :readI16 => :read_i16 def read_i32 raise NotImplementedError end - deprecate! :readI32 => :read_i32 def read_i64 raise NotImplementedError end - deprecate! :readI64 => :read_i64 def read_double raise NotImplementedError end - deprecate! :readDouble => :read_double def read_string raise NotImplementedError end - deprecate! :readString => :read_string def write_field(name, type, fid, value) write_field_begin(name, type, fid) @@ -323,11 +283,10 @@ module Thrift end end - deprecate_class! :TProtocol => Protocol class ProtocolFactory - def get_protocol(trans); nil; end - deprecate! :getProtocol => :get_protocol + def get_protocol(trans) + raise NotImplementedError + end end - deprecate_class! :TProtocolFactory => ProtocolFactory end diff --git a/lib/rb/lib/thrift/protocol/binaryprotocol.rb b/lib/rb/lib/thrift/protocol/binaryprotocol.rb index 9a7a60128..dd963f2c5 100644 --- a/lib/rb/lib/thrift/protocol/binaryprotocol.rb +++ b/lib/rb/lib/thrift/protocol/binaryprotocol.rb @@ -216,12 +216,10 @@ module Thrift end end - deprecate_class! :TBinaryProtocol => BinaryProtocol class BinaryProtocolFactory < ProtocolFactory def get_protocol(trans) return Thrift::BinaryProtocol.new(trans) end end - deprecate_class! :TBinaryProtocolFactory => BinaryProtocolFactory end diff --git a/lib/rb/lib/thrift/protocol/tbinaryprotocol.rb b/lib/rb/lib/thrift/protocol/tbinaryprotocol.rb deleted file mode 100644 index 32211b786..000000000 --- a/lib/rb/lib/thrift/protocol/tbinaryprotocol.rb +++ /dev/null @@ -1,21 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -require 'thrift/deprecation' -require 'thrift/protocol/binaryprotocol' diff --git a/lib/rb/lib/thrift/protocol/tprotocol.rb b/lib/rb/lib/thrift/protocol/tprotocol.rb deleted file mode 100644 index 2bd1de755..000000000 --- a/lib/rb/lib/thrift/protocol/tprotocol.rb +++ /dev/null @@ -1,21 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -require 'thrift/deprecation' -require 'thrift/protocol' diff --git a/lib/rb/lib/thrift/server.rb b/lib/rb/lib/thrift/server.rb index 841a3fc15..bd4285492 100644 --- a/lib/rb/lib/thrift/server.rb +++ b/lib/rb/lib/thrift/server.rb @@ -32,7 +32,6 @@ module Thrift def serve; nil; end end - deprecate_class! :TServer => Server class SimpleServer < Server def serve @@ -56,7 +55,6 @@ module Thrift end end end - deprecate_class! :TSimpleServer => SimpleServer end # do *not* use fastthread @@ -88,7 +86,6 @@ module Thrift end end end - deprecate_class! :TThreadedServer => ThreadedServer class ThreadPoolServer < Server def initialize(processor, serverTransport, transportFactory=nil, protocolFactory=nil, num=20) @@ -142,5 +139,4 @@ module Thrift end end end - deprecate_class! :TThreadPoolServer => ThreadPoolServer end diff --git a/lib/rb/lib/thrift/server/httpserver.rb b/lib/rb/lib/thrift/server/httpserver.rb index c75d631c3..f26329f45 100644 --- a/lib/rb/lib/thrift/server/httpserver.rb +++ b/lib/rb/lib/thrift/server/httpserver.rb @@ -59,5 +59,4 @@ module Thrift @server.run.join end end - deprecate_class! :TSimpleMongrelHTTPServer => SimpleMongrelHTTPServer end diff --git a/lib/rb/lib/thrift/server/thttpserver.rb b/lib/rb/lib/thrift/server/thttpserver.rb deleted file mode 100644 index f0abf0d32..000000000 --- a/lib/rb/lib/thrift/server/thttpserver.rb +++ /dev/null @@ -1,21 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -require 'thrift/deprecation' -require 'thrift/server/httpserver' diff --git a/lib/rb/lib/thrift/server/tserver.rb b/lib/rb/lib/thrift/server/tserver.rb deleted file mode 100644 index 4066d4253..000000000 --- a/lib/rb/lib/thrift/server/tserver.rb +++ /dev/null @@ -1,21 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -require 'thrift/deprecation' -require 'thrift/server' diff --git a/lib/rb/lib/thrift/struct.rb b/lib/rb/lib/thrift/struct.rb index 625badf2f..9789a41e3 100644 --- a/lib/rb/lib/thrift/struct.rb +++ b/lib/rb/lib/thrift/struct.rb @@ -292,5 +292,4 @@ module Thrift :element => field[:element] } end end - deprecate_module! :ThriftStruct => Struct end diff --git a/lib/rb/lib/thrift/thrift.rb b/lib/rb/lib/thrift/thrift.rb deleted file mode 100644 index cb5581c71..000000000 --- a/lib/rb/lib/thrift/thrift.rb +++ /dev/null @@ -1,33 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -# This file kept for backwards compatability -# require File.join(File.dirname(__FILE__), '../thrift') -$:.unshift File.dirname(File.dirname(__FILE__)) -require 'thrift/deprecation' -require 'thrift/types' -require 'thrift/processor' -require 'thrift/exceptions' -require 'thrift/client' -require 'thrift/struct' -begin - require "thrift_native" -rescue - puts "Could not load thrift_native libraries. Using pure ruby version." -end
\ No newline at end of file diff --git a/lib/rb/lib/thrift/transport.rb b/lib/rb/lib/thrift/transport.rb index 00c5bee0f..6c75ce865 100644 --- a/lib/rb/lib/thrift/transport.rb +++ b/lib/rb/lib/thrift/transport.rb @@ -32,15 +32,10 @@ module Thrift @type = type end end - deprecate_class! :TTransportException => TransportException -# Transport is basically an abstract class, but isn't raising NotImplementedError -# TODO: Think about if this is the right thing - Kevin Clark - 3/27/08 class Transport def open?; end - deprecate! :isOpen => :open? - deprecate! :is_open? => :open? - + def open; end def close; end @@ -59,33 +54,34 @@ module Thrift buf end - deprecate! :readAll => :read_all def write(buf); end alias_method :<<, :write def flush; end end - deprecate_class! :TTransport => Transport class ServerTransport - def listen; nil; end - - def accept; nil; end + def listen + raise NotImplementedError + end + def accept + raise NotImplementedError + end + def close; nil; end - def closed?; nil; end + def closed? + raise NotImplementedError + end end - deprecate_class! :TServerTransport => ServerTransport class TransportFactory def get_transport(trans) return trans end - deprecate! :getTransport => :get_transport end - deprecate_class! :TTransportFactory => TransportFactory class BufferedTransport < Transport DEFAULT_BUFFER = 4096 @@ -131,34 +127,13 @@ module Thrift @transport.flush end - - def borrow(requested_length = 0) - # $stderr.puts "#{Time.now.to_f} Have #{@rbuf.length} asking for #{requested_length.inspect}" - return @rbuf if @rbuf.length > requested_length - - if @rbuf.length < DEFAULT_BUFFER - @rbuf << @transport.read([requested_length, DEFAULT_BUFFER].max) - end - - if @rbuf.length < requested_length - @rbuf << @transport.read_all(requested_length - @rbuf.length) - end - - @rbuf - end - - def consume!(size) - @rbuf.slice!(0...size) - end end - deprecate_class! :TBufferedTransport => BufferedTransport class BufferedTransportFactory < TransportFactory def get_transport(transport) return BufferedTransport.new(transport) end end - deprecate_class! :TBufferedTransportFactory => BufferedTransportFactory class FramedTransport < Transport def initialize(transport, read=true, write=true) @@ -211,17 +186,6 @@ module Thrift @wbuf = '' end - def borrow(requested_length = 0) - read_frame if @rbuf.empty? - # there isn't any more coming, so if it's not enough, it's an error. - raise EOFError if requested_length > @rbuf.size - @rbuf - end - - def consume!(size) - @rbuf.slice!(0...size) - end - private def read_frame @@ -230,14 +194,12 @@ module Thrift @rbuf = @transport.read_all(sz).dup # protect against later #slice! end end - deprecate_class! :TFramedTransport => FramedTransport class FramedTransportFactory < TransportFactory def get_transport(transport) return FramedTransport.new(transport) end end - deprecate_class! :TFramedTransportFactory => FramedTransportFactory class MemoryBuffer < Transport GARBAGE_BUFFER_SIZE = 4*(2**10) # 4kB @@ -294,19 +256,6 @@ module Thrift def flush end - # For fast binary protocol access - def borrow(size = nil) - if size.nil? - @buf[@index..-1] - else - if size > available - raise EOFError # Memory buffers only get one shot. - else - @buf[@index, size] - end - end - end - def inspect_buffer out = [] for idx in 0...(@buf.size) @@ -322,10 +271,7 @@ module Thrift end out.join(" ") end - - alias_method :consume!, :read end - deprecate_class! :TMemoryBuffer => MemoryBuffer ## Very very simple implementation of wrapping two objects, one with a #read ## method and one with a #write method, into a transport for thrift. @@ -343,5 +289,4 @@ module Thrift def close; @input.close; @output.close end def to_io; @input end # we're assuming this is used in a IO.select for reading end - deprecate_class! :TIOStreamTransport => IOStreamTransport end diff --git a/lib/rb/lib/thrift/transport/httpclient.rb b/lib/rb/lib/thrift/transport/httpclient.rb index b6b1e94af..8a62ca201 100644 --- a/lib/rb/lib/thrift/transport/httpclient.rb +++ b/lib/rb/lib/thrift/transport/httpclient.rb @@ -44,5 +44,4 @@ module Thrift @outbuf = "" end end - deprecate_class! :THttpClient => HTTPClient end diff --git a/lib/rb/lib/thrift/transport/socket.rb b/lib/rb/lib/thrift/transport/socket.rb index d4ba3a749..49247ce4b 100644 --- a/lib/rb/lib/thrift/transport/socket.rb +++ b/lib/rb/lib/thrift/transport/socket.rb @@ -132,7 +132,6 @@ module Thrift @handle end end - deprecate_class! :TSocket => Socket class ServerSocket < ServerTransport # call-seq: initialize(host = nil, port) @@ -173,5 +172,4 @@ module Thrift alias to_io handle end - deprecate_class! :TServerSocket => ServerSocket end diff --git a/lib/rb/lib/thrift/transport/thttpclient.rb b/lib/rb/lib/thrift/transport/thttpclient.rb deleted file mode 100644 index 9bb425625..000000000 --- a/lib/rb/lib/thrift/transport/thttpclient.rb +++ /dev/null @@ -1,21 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -require 'thrift/deprecation' -require 'thrift/transport/httpclient' diff --git a/lib/rb/lib/thrift/transport/tsocket.rb b/lib/rb/lib/thrift/transport/tsocket.rb deleted file mode 100644 index e58fedd8f..000000000 --- a/lib/rb/lib/thrift/transport/tsocket.rb +++ /dev/null @@ -1,21 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -require 'thrift/deprecation' -require 'thrift/transport/socket' diff --git a/lib/rb/lib/thrift/transport/ttransport.rb b/lib/rb/lib/thrift/transport/ttransport.rb deleted file mode 100644 index 4b74ed06e..000000000 --- a/lib/rb/lib/thrift/transport/ttransport.rb +++ /dev/null @@ -1,21 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -require 'thrift/deprecation' -require 'thrift/transport' diff --git a/lib/rb/lib/thrift/types.rb b/lib/rb/lib/thrift/types.rb index 6d027ce4c..6d70eb587 100644 --- a/lib/rb/lib/thrift/types.rb +++ b/lib/rb/lib/thrift/types.rb @@ -35,7 +35,6 @@ module Thrift SET = 14 LIST = 15 end - deprecate_module! :TType => Types class << self attr_accessor :type_checking @@ -96,7 +95,6 @@ module Thrift REPLY = 2 EXCEPTION = 3 end - deprecate_module! :TMessageType => MessageTypes end Thrift.type_checking = false if Thrift.type_checking.nil? |