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 16:03:47 UTC
[40/50] qpid-proton git commit: PROTON-781: Added the set of
LinkOption classes to Ruby.
PROTON-781: Added the set of LinkOption classes to Ruby.
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/c84aace4
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/c84aace4
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/c84aace4
Branch: refs/heads/PROTON-781-ruby-reactor-apis
Commit: c84aace4e1de46b413fc7861a3f823851b758c14
Parents: e721358
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Mon May 4 13:26:26 2015 -0400
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Thu Jun 18 09:27:21 2015 -0400
----------------------------------------------------------------------
proton-c/bindings/ruby/lib/qpid_proton.rb | 1 +
.../bindings/ruby/lib/reactor/link_option.rb | 90 ++++++++++++++++++++
2 files changed, 91 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c84aace4/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 ba1e66e..1d614a4 100644
--- a/proton-c/bindings/ruby/lib/qpid_proton.rb
+++ b/proton-c/bindings/ruby/lib/qpid_proton.rb
@@ -107,6 +107,7 @@ require "reactor/connector"
require "reactor/backoff"
require "reactor/session_per_connection"
require "reactor/container"
+require "reactor/link_option"
module Qpid::Proton
# @private
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c84aace4/proton-c/bindings/ruby/lib/reactor/link_option.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/reactor/link_option.rb b/proton-c/bindings/ruby/lib/reactor/link_option.rb
new file mode 100644
index 0000000..628a811
--- /dev/null
+++ b/proton-c/bindings/ruby/lib/reactor/link_option.rb
@@ -0,0 +1,90 @@
+#--
+# 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::Reactor
+
+ class LinkOption
+ def apply(link)
+ end
+
+ # Subclasses should override this to selectively apply an option.
+ def test(link)
+ true
+ end
+ end
+
+ class AtMostOne < LinkOption
+ def apply(link)
+ link.snd_settle_mod = Link::SND_SETTLED
+ end
+ end
+
+ class AtLeastOnce < LinkOption
+ def apply(link)
+ link.snd_settle_mode = Link::SND_UNSETTLED
+ link.rcv_settle_mode = Link::RCV_FIRST
+ end
+ end
+
+ class SenderOption < LinkOption
+ def test(link)
+ link.sender?
+ end
+ end
+
+ class ReceiverOption < LinkOption
+ def test(link)
+ link.receiver?
+ end
+ end
+
+ class DynamicNodeProperties < LinkOption
+ def initialize(properties = {})
+ @properties = []
+ properties.each do |property|
+ @properties << property.to_sym
+ end
+ end
+
+ def apply(link)
+ if link.receiver?
+ link.source.properties.dict = @properties
+ else
+ link.target.properties.dict = @properties
+ end
+ end
+ end
+
+ class Filter < ReceiverOption
+ def initialize(filter_set = {})
+ @filter_set = filter_set
+ end
+
+ def apply(receiver)
+ receiver.source.filter.dict = @filter_set
+ end
+ end
+
+ #class Selector < Filter
+ # def initialize(value, name = 'selector')
+ #
+ # end
+ #end
+
+end
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org