You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by mc...@apache.org on 2015/06/18 22:30:21 UTC

[04/32] qpid-proton git commit: PROTON-781: Repackaged the Ruby Selectable class to Qpid::Proton.

PROTON-781: Repackaged the Ruby Selectable class to Qpid::Proton.

It's now a part of the core APIs and not part of the Messenger APIs.


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/ff348d0f
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/ff348d0f
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/ff348d0f

Branch: refs/heads/master
Commit: ff348d0f6a266a99c7096b175658cb376d826c70
Parents: 5d062e7
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Tue Feb 24 13:31:51 2015 -0500
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Thu Jun 18 16:28:43 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/ruby/lib/core/selectable.rb   | 118 +++++++++++++++++++
 .../bindings/ruby/lib/messenger/selectable.rb   | 118 -------------------
 proton-c/bindings/ruby/lib/qpid_proton.rb       |   2 +-
 3 files changed, 119 insertions(+), 119 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ff348d0f/proton-c/bindings/ruby/lib/core/selectable.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/core/selectable.rb b/proton-c/bindings/ruby/lib/core/selectable.rb
new file mode 100644
index 0000000..8a5b223
--- /dev/null
+++ b/proton-c/bindings/ruby/lib/core/selectable.rb
@@ -0,0 +1,118 @@
+#--
+# 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.
+#++
+
+module Qpid::Proton
+
+  # Selectable enables accessing the underlying file descriptors
+  # for Messenger.
+  #
+  # @private
+  class Selectable
+
+
+    def initialize(messenger, impl) # :nodoc:
+      @messenger = messenger
+      @impl = impl
+      @io = nil
+      @freed = false
+    end
+
+    # Returns the underlying file descriptor.
+    #
+    # This can be used in conjunction with the IO class.
+    #
+    def fileno
+      Cproton.pn_selectable_get_fd(@impl)
+    end
+
+    def to_io
+      @io ||= IO.new(fileno)
+    end
+
+    # The number of bytes the selectable is capable of consuming.
+    #
+    #def capacity
+    #  Cproton.pn_selectable_capacity(@impl)
+    #end
+
+    # The number of bytes waiting to be written to the file descriptor.
+    #
+    def pending
+      Cproton.pn_selectable_pending(@impl)
+    end
+
+    # The future expiry time at which control will be returned to the
+    # selectable.
+    #
+    def deadline
+      tstamp = Cproton.pn_selectable_deadline(@impl)
+      tstamp.nil? ? nil : tstamp / 1000
+    end
+
+    def readable
+      Cproton.pn_selectable_readable(@impl)
+    end
+
+    def writable
+      Cproton.pn_selectable_writable(@impl)
+    end
+
+    def expired?
+      Cproton.pn_selectable_expired(@impl)
+    end
+
+    def registered=(registered)
+      Cproton.pn_selectable_set_registered(@impl, registered)
+    end
+
+    def registered?
+      Cproton.pn_selectable_is_registered(@impl)
+    end
+
+    def terminal?
+      return true if @impl.nil?
+      Cproton.pn_selectable_is_terminal(@impl)
+    end
+
+    def to_s
+      "fileno=#{self.fileno} registered=#{self.registered?} terminal=#{self.terminal?}"
+    end
+
+    def free
+      return if @freed
+      @freed = true
+      @messenger.unregister_selectable(fileno)
+      @io.close unless @io.nil?
+      Cproton.pn_selectable_free(@impl)
+      @impl = nil
+    end
+
+    def freed? # :nodoc:
+      @freed
+    end
+
+    private
+
+    def check_is_initialized
+      raise RuntimeError.new("selectable freed") if @impl.nil?
+    end
+
+  end
+
+end

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ff348d0f/proton-c/bindings/ruby/lib/messenger/selectable.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/messenger/selectable.rb b/proton-c/bindings/ruby/lib/messenger/selectable.rb
deleted file mode 100644
index da1a3d5..0000000
--- a/proton-c/bindings/ruby/lib/messenger/selectable.rb
+++ /dev/null
@@ -1,118 +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.
-#++
-
-module Qpid::Proton::Messenger
-
-  # Selectable enables accessing the underlying file descriptors
-  # for Messenger.
-  #
-  # @private
-  class Selectable
-
-
-    def initialize(messenger, impl) # :nodoc:
-      @messenger = messenger
-      @impl = impl
-      @io = nil
-      @freed = false
-    end
-
-    # Returns the underlying file descriptor.
-    #
-    # This can be used in conjunction with the IO class.
-    #
-    def fileno
-      Cproton.pn_selectable_get_fd(@impl)
-    end
-
-    def to_io
-      @io ||= IO.new(fileno)
-    end
-
-    # The number of bytes the selectable is capable of consuming.
-    #
-    #def capacity
-    #  Cproton.pn_selectable_capacity(@impl)
-    #end
-
-    # The number of bytes waiting to be written to the file descriptor.
-    #
-    def pending
-      Cproton.pn_selectable_pending(@impl)
-    end
-
-    # The future expiry time at which control will be returned to the
-    # selectable.
-    #
-    def deadline
-      tstamp = Cproton.pn_selectable_deadline(@impl)
-      tstamp.nil? ? nil : tstamp / 1000
-    end
-
-    def readable
-      Cproton.pn_selectable_readable(@impl)
-    end
-
-    def writable
-      Cproton.pn_selectable_writable(@impl)
-    end
-
-    def expired?
-      Cproton.pn_selectable_expired(@impl)
-    end
-
-    def registered=(registered)
-      Cproton.pn_selectable_set_registered(@impl, registered)
-    end
-
-    def registered?
-      Cproton.pn_selectable_is_registered(@impl)
-    end
-
-    def terminal?
-      return true if @impl.nil?
-      Cproton.pn_selectable_is_terminal(@impl)
-    end
-
-    def to_s
-      "fileno=#{self.fileno} registered=#{self.registered?} terminal=#{self.terminal?}"
-    end
-
-    def free
-      return if @freed
-      @freed = true
-      @messenger.unregister_selectable(fileno)
-      @io.close unless @io.nil?
-      Cproton.pn_selectable_free(@impl)
-      @impl = nil
-    end
-
-    def freed? # :nodoc:
-      @freed
-    end
-
-    private
-
-    def check_is_initialized
-      raise RuntimeError.new("selectable freed") if @impl.nil?
-    end
-
-  end
-
-end

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ff348d0f/proton-c/bindings/ruby/lib/qpid_proton.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/qpid_proton.rb b/proton-c/bindings/ruby/lib/qpid_proton.rb
index 21f96a1..a4b3391 100644
--- a/proton-c/bindings/ruby/lib/qpid_proton.rb
+++ b/proton-c/bindings/ruby/lib/qpid_proton.rb
@@ -58,6 +58,7 @@ require "event/event"
 require "event/collector"
 
 # Main Proton classes
+require "core/selectable"
 require "core/message"
 require "core/endpoint"
 require "core/session"
@@ -78,7 +79,6 @@ require "core/transport"
 require "messenger/subscription"
 require "messenger/tracker_status"
 require "messenger/tracker"
-require "messenger/selectable"
 require "messenger/messenger"
 
 # Handler classes


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org