Repository: qpid-proton Updated Branches: refs/heads/master b57acda83 -> 8166c2977
PROTON-1537: Rename Tracker#modified to Tracker#modifications Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/8166c297 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/8166c297 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/8166c297 Branch: refs/heads/master Commit: 8166c2977bf5805b9d30ac1caab88203156cf525 Parents: b57acda Author: Alan Conway <[email protected]> Authored: Fri Dec 8 10:34:09 2017 -0500 Committer: Alan Conway <[email protected]> Committed: Fri Dec 8 10:43:15 2017 -0500 ---------------------------------------------------------------------- proton-c/bindings/ruby/.yardopts | 5 ++- proton-c/bindings/ruby/CMakeLists.txt | 2 +- proton-c/bindings/ruby/lib/core/delivery.rb | 48 ++++++++++++------------ proton-c/bindings/ruby/lib/core/tracker.rb | 12 +++--- proton-c/bindings/ruby/lib/core/transfer.rb | 6 +-- 5 files changed, 36 insertions(+), 37 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8166c297/proton-c/bindings/ruby/.yardopts ---------------------------------------------------------------------- diff --git a/proton-c/bindings/ruby/.yardopts b/proton-c/bindings/ruby/.yardopts index bea5abe..00217af 100644 --- a/proton-c/bindings/ruby/.yardopts +++ b/proton-c/bindings/ruby/.yardopts @@ -1 +1,4 @@ ---no-private lib/**/*.rb +-r README.rdoc +--no-private +--default-return "" +--hide-void-return http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8166c297/proton-c/bindings/ruby/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/proton-c/bindings/ruby/CMakeLists.txt b/proton-c/bindings/ruby/CMakeLists.txt index 4df738d..8ff1323 100644 --- a/proton-c/bindings/ruby/CMakeLists.txt +++ b/proton-c/bindings/ruby/CMakeLists.txt @@ -132,7 +132,7 @@ if (YARD_EXE) add_custom_command( OUTPUT ${bin}/doc WORKING_DIRECTORY ${src} - COMMAND ${YARD_EXE} -q -o ${bin}/doc -b ${bin}/.yardoc --no-progress --no-private -r README.rdoc + COMMAND ${YARD_EXE} -q -o ${bin}/doc -b ${bin}/.yardoc --no-progress --yardopts ${src}/.yardopts DEPENDS ${RUBY_SRC} ) add_custom_target(docs-ruby DEPENDS ${bin}/doc) http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8166c297/proton-c/bindings/ruby/lib/core/delivery.rb ---------------------------------------------------------------------- diff --git a/proton-c/bindings/ruby/lib/core/delivery.rb b/proton-c/bindings/ruby/lib/core/delivery.rb index b08c667..b240784 100644 --- a/proton-c/bindings/ruby/lib/core/delivery.rb +++ b/proton-c/bindings/ruby/lib/core/delivery.rb @@ -24,38 +24,36 @@ module Qpid::Proton # Accept the receiveed message. def accept() settle ACCEPTED; end - # Reject a received message that is considered invalid and should never - # be delivered again to this or any other receiver. + # Reject a message, indicating to the sender that is invalid and should + # never be delivered again to this or any other receiver. def reject() settle REJECTED; end - # Release a received message. It may be delivered again to this or another - # receiver. + # Release a message, indicating to the sender that it was not processed + # but may be delivered again to this or another receiver. # - # @option opts [Boolean] :failed (default true) If true - # {Message#delivery_count} will be increased so future receivers will know - # there was a failed delivery. If false, {Message#delivery_count} will not - # be increased. + # @param mods [Hash] Instructions to the sender to modify re-delivery. + # To allow re-delivery with no modifications at all use +release(nil)+ # - # @option opts [Boolean] :undeliverable (default false) If true the message - # will not be re-delivered to this receiver. It may be delivered tbo other - # receivers. + # @option mods [Boolean] :failed Instruct the sender to increase + # {Message#delivery_count} so future receivers will know there was a + # previous failed delivery. # - # @option opts [Hash] :annotations Annotations to be added to - # {Message#annotations} before re-delivery. Entries with the same key - # replace existing entries in {Message#annotations} - def release(opts = nil) - opts = { :failed => true } if opts == true # Backwards compatibility - failed = opts ? opts.fetch(:failed, true) : true - undeliverable = opts && opts[:undeliverable] - annotations = opts && opts[:annotations] - if failed || undeliverable || annotations + # @option mods [Boolean] :undeliverable Instruct the sender that this + # message should never be re-delivered to this receiver, although it may be + # delivered other receivers. + # + # @option mods [Hash] :annotations Instruct the sender to update the + # {Message#annotations} with these +key=>value+ pairs before re-delivery. + def release(mods = {:failed=>true}) + mods = { :failed => true } if mods == true # Backwards compatibility + if !mods || mods.empty? + settle(RELEASED) + else d = Cproton.pn_delivery_local(@impl) - Cproton.pn_disposition_set_failed(d) if failed - Cproton.pn_disposition_set_undeliverable(d) if undeliverable - Data.from_object(Cproton.pn_disposition_annotations(d), annotations) if annotations + Cproton.pn_disposition_set_failed(mods[:failed]) + Cproton.pn_disposition_set_undeliverable(mods[:undeliverable]) + Data.from_object(Cproton.pn_disposition_annotations(d), mods[:annotations]) if mods.key? :annotations settle(MODIFIED) - else - settle(RELEASED) end end http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8166c297/proton-c/bindings/ruby/lib/core/tracker.rb ---------------------------------------------------------------------- diff --git a/proton-c/bindings/ruby/lib/core/tracker.rb b/proton-c/bindings/ruby/lib/core/tracker.rb index 7363e3a..79620de 100644 --- a/proton-c/bindings/ruby/lib/core/tracker.rb +++ b/proton-c/bindings/ruby/lib/core/tracker.rb @@ -18,17 +18,15 @@ module Qpid::Proton - # Tracks the status of a sent message. + # Track the {Transfer::State} of a sent message. class Tracker < Transfer # @return [Sender] The parent {Sender} link. def sender() link; end - # If {#state} == {MODIFIED} this method returns additional information - # about re-delivery from the receiver's call to {Delivery#release} - # - # @return [Hash] See {Delivery#release} options for the meaning of hash entries. - def modified() - return unless (state == MODIFIED) && (d = Cproton.pn_delivery_remote(@impl)) + # Re-delivery modifications provided by the receiver in {Delivery#release} + # @return [Hash] See the {Delivery#release} +mods+ parameter. + def modifications() + return {} unless (state == MODIFIED) && (d = Cproton.pn_delivery_remote(@impl)) { :failed => Cproton.pn_disposition_get_failed(d), :undeliverable => Cproton.pn_disposition_get_undeliverable(d), http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8166c297/proton-c/bindings/ruby/lib/core/transfer.rb ---------------------------------------------------------------------- diff --git a/proton-c/bindings/ruby/lib/core/transfer.rb b/proton-c/bindings/ruby/lib/core/transfer.rb index db2a03e..7c3a502 100644 --- a/proton-c/bindings/ruby/lib/core/transfer.rb +++ b/proton-c/bindings/ruby/lib/core/transfer.rb @@ -43,7 +43,7 @@ module Qpid::Proton public - # States of a transfer + # AMQP Delivery States describing the outcome of a message transfer module State # Message was successfully processed by the receiver ACCEPTED = Cproton::PN_ACCEPTED @@ -55,8 +55,8 @@ module Qpid::Proton # acceptable if re-delivered to another receiver RELEASED = Cproton::PN_RELEASED - # Like {RELEASED}, but {Tracker#modified} has modifications to be made to - # the message before re-delivery + # Like {RELEASED}, but there are modifications (see {Tracker#modifications}) + # that must be applied to the message by the {Sender} before re-delivering it. MODIFIED = Cproton::PN_MODIFIED # Partial message data received. Only used during link recovery. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
