Class: Qpid::Proton::Transport Deprecated
- Inherits:
-
Object
- Object
- Qpid::Proton::Transport
- Includes:
- Util::Deprecation, Util::ErrorHandler, Util::Wrapper
- Defined in:
- lib/core/transport.rb
Overview
all important features are available from #Connection
Constant Summary collapse
- PROTON_METHOD_PREFIX =
"pn_transport"
- TRACE_OFF =
Turn logging off entirely.
Cproton::PN_TRACE_OFF
- TRACE_RAW =
Log raw binary data into/out of the transport.
Cproton::PN_TRACE_RAW
- TRACE_FRM =
Log frames into/out of the transport.
Cproton::PN_TRACE_FRM
- TRACE_DRV =
Log driver related events; i.e., initialization, end of stream, etc.
Cproton::PN_TRACE_DRV
Constants included from Util::Deprecation
Util::Deprecation::DEPRECATE_FULL_TRACE, Util::Deprecation::MATCH_DIR
Instance Attribute Summary collapse
-
#capacity ⇒ Integer
readonly
If the engine is in an exception state such as encountering an error condition or reaching the end of stream state, a negative value will be returned indicating the condition.
-
#channel_max ⇒ Integer
The maximum allowed channel.
-
#closed? ⇒ Boolean
readonly
A transport is defined to be closed when both the tail and the head are closed.
-
#frames_input ⇒ Integer
readonly
The number of frames input by a transport.
-
#frames_output ⇒ Integer
readonly
The number of frames output by a transport.
-
#head ⇒ String
readonly
This referneces queued output data.
-
#idle_timeout ⇒ Integer
deprecated
Deprecated.
use Connection#open with the
:idle_timeout
option to set -
#max_frame_size ⇒ Integer
The maximum frame size.
-
#pending ⇒ Integer
readonly
If the ending is in an exceptional state, such as encountering an error condition or reachign the end of the stream state, a negative value will be returned indicating the condition.
-
#remote_channel_max ⇒ Integer
readonly
The maximum allowed channel of a transport’s remote peer.
-
#remote_idle_timeout in milliseconds ⇒ Integer
readonly
deprecated
Deprecated.
Use Connection#idle_timeout to query the remote timeout.
-
#remote_max_frame_size ⇒ Integer
readonly
The maximum frame size of the transport’s remote peer.
-
#tail ⇒ String
readonly
The amount of free space following this data is reported by #capacity.
Attributes included from Util::Wrapper
Class Method Summary collapse
Instance Method Summary collapse
-
#apply(opts) ⇒ Object
Options are documented Connection#open, keep that consistent with this.
-
#bind(connection) ⇒ Object
Binds to the given connection.
-
#close_head ⇒ Object
Indicate that the output has closed.
-
#close_tail ⇒ Object
Indicate that the input has reached EOS (end of stream).
-
#condition ⇒ Condition?
Transport error condition or nil if there is no error.
-
#condition=(c) ⇒ Object
Set the error condition for the transport.
-
#connection ⇒ Connection?
Return the AMQP connection associated with the transport.
-
#initialize(impl = Cproton.pn_transport) ⇒ Transport
constructor
Creates a new transport instance.
-
#log(message) ⇒ Object
Log a message to the transport’s logging mechanism.
-
#peek(size) ⇒ String
Returns the specified number of bytes from the transport’s buffers.
-
#pop(size) ⇒ Object
Removes the specified number of bytes from the pending output queue following the transport’s head pointer.
-
#process(size) ⇒ Object
Process input data following the tail pointer.
-
#push(data) ⇒ Integer
Pushes the supplied bytes into the tail of the transport.
-
#quiesced? ⇒ Boolean
Returns whether the transport has any buffered data.
-
#sasl ⇒ SASL
Create, or return existing, SSL object for the transport.
-
#set_server ⇒ Object
Set server mode for this tranport - enables protocol detection and server-side authentication for incoming connections.
-
#ssl(domain = nil, session_details = nil) ⇒ SSL
Creates, or returns an existing, SSL object for the transport.
- #ssl? ⇒ Boolean
-
#tick(now) ⇒ Integer
Process any pending transport timer events.
-
#trace(level) ⇒ Object
Updates the transports trace flags.
-
#unbind ⇒ Object
Unbinds from the previous connection.
Methods included from Util::ErrorHandler
#can_raise_error, #check_for_error, #create_exception_handler_wrapper, included
Methods included from Util::Wrapper
included, #inspect, registry, #to_s
Methods included from Util::Deprecation
deprecated, #deprecated, included
Constructor Details
#initialize(impl = Cproton.pn_transport) ⇒ Transport
Creates a new transport instance.
171 172 173 174 175 |
# File 'lib/core/transport.rb', line 171 def initialize(impl = Cproton.pn_transport) @impl = impl @ssl = nil self.class.store_instance(self, :pn_transport_attachments) end |
Instance Attribute Details
#capacity ⇒ Integer (readonly)
If the engine is in an exception state such as encountering an error condition or reaching the end of stream state, a negative value will be returned indicating the condition.
If an error is indicated, further deteails can be obtained from #error.
Calls to #process may alter the value of this value. See #process for more details
transport’s tail pointer.
100 |
# File 'lib/core/transport.rb', line 100 proton_caller :capacity |
#channel_max ⇒ Integer
Returns The maximum allowed channel.
45 |
# File 'lib/core/transport.rb', line 45 proton_set_get :channel_max |
#closed? ⇒ Boolean (readonly)
A transport is defined to be closed when both the tail and the head are closed. In other words, when both #capacity < 0 and #pending < 0.
146 |
# File 'lib/core/transport.rb', line 146 proton_caller :closed? |
#frames_input ⇒ Integer (readonly)
Returns The number of frames input by a transport.
158 |
# File 'lib/core/transport.rb', line 158 proton_get :frames_input |
#frames_output ⇒ Integer (readonly)
Returns The number of frames output by a transport.
152 |
# File 'lib/core/transport.rb', line 152 proton_get :frames_output |
#head ⇒ String (readonly)
This referneces queued output data. It reports the bytes of output data.
Calls to #pop may alter this attribute, and any data it references.
110 |
# File 'lib/core/transport.rb', line 110 proton_caller :head |
#idle_timeout ⇒ Integer
use Connection#open with the :idle_timeout
option to set
the timeout, and Connection#idle_timeout to query the remote timeout.
The Connection timeout values are in seconds and are automatically converted.
75 |
# File 'lib/core/transport.rb', line 75 proton_set_get :idle_timeout |
#max_frame_size ⇒ Integer
Returns The maximum frame size.
56 |
# File 'lib/core/transport.rb', line 56 proton_set_get :max_frame |
#pending ⇒ Integer (readonly)
If the ending is in an exceptional state, such as encountering an error condition or reachign the end of the stream state, a negative value will be returned indicating the condition.
If an error is indicated, further details can be obtained from #error.
Calls to #pop may alter the value of this pointer as well.
pointer.
137 |
# File 'lib/core/transport.rb', line 137 proton_caller :pending |
#remote_channel_max ⇒ Integer (readonly)
Returns The maximum allowed channel of a transport’s remote peer.
51 |
# File 'lib/core/transport.rb', line 51 proton_caller :remote_channel_max |
#remote_idle_timeout in milliseconds ⇒ Integer (readonly)
Use Qpid::Proton::Connection#idle_timeout to query the remote timeout.
Returns The idle timeout for the transport’s remote peer.
83 |
# File 'lib/core/transport.rb', line 83 proton_set_get :remote_idle_timeout |
#remote_max_frame_size ⇒ Integer (readonly)
Returns The maximum frame size of the transport’s remote peer.
63 |
# File 'lib/core/transport.rb', line 63 proton_get :remote_max_frame_size |
#tail ⇒ String (readonly)
The amount of free space following this data is reported by #capacity.
Calls to #process may alter the value of this attribute.
120 |
# File 'lib/core/transport.rb', line 120 proton_caller :tail |
Class Method Details
Instance Method Details
#apply(opts) ⇒ Object
Options are documented Connection#open, keep that consistent with this
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 |
# File 'lib/core/transport.rb', line 358 def apply opts sasl if opts[:sasl_enabled] # Explicitly enabled unless opts.include?(:sasl_enabled) && !opts[:sasl_enabled] # Not explicitly disabled sasl.allowed_mechs = opts[:sasl_allowed_mechs] if opts.include? :sasl_allowed_mechs sasl.allow_insecure_mechs = opts[:sasl_allow_insecure_mechs] if opts.include? :sasl_allow_insecure_mechs end self.channel_max= opts[:max_sessions] if opts.include? :max_sessions self.max_frame = opts[:max_frame_size] if opts.include? :max_frame_size # NOTE: The idle_timeout option is in Numeric *seconds*, can be Integer, Float or Rational. # This is consistent with idiomatic ruby. # The transport #idle_timeout property is in *milliseconds* passed direct to C. # Direct use of the transport is deprecated. self.idle_timeout= (opts[:idle_timeout]*1000).round if opts.include? :idle_timeout self.ssl(opts[:ssl_domain]) if opts[:ssl_domain] end |
#bind(connection) ⇒ Object
Binds to the given connection.
204 205 206 |
# File 'lib/core/transport.rb', line 204 def bind(connection) Cproton.pn_transport_bind(@impl, connection.impl) end |
#close_head ⇒ Object
Indicate that the output has closed.
Tells the transport that no more output will be popped.
311 312 313 |
# File 'lib/core/transport.rb', line 311 def close_head Cproton.pn_transport_close_head(@impl) end |
#close_tail ⇒ Object
Indicate that the input has reached EOS (end of stream).
This tells the transport that no more input will be forthcoming.
277 278 279 |
# File 'lib/core/transport.rb', line 277 def close_tail Cproton.pn_transport_close_tail(@impl) end |
#condition ⇒ Condition?
Returns transport error condition or nil if there is no error.
190 191 192 |
# File 'lib/core/transport.rb', line 190 def condition Condition.convert(Cproton.pn_transport_condition(@impl)) end |
#condition=(c) ⇒ Object
Set the error condition for the transport.
196 197 198 |
# File 'lib/core/transport.rb', line 196 def condition=(c) Condition.assign(Cproton.pn_transport_condition(@impl), c) end |
#connection ⇒ Connection?
Return the AMQP connection associated with the transport.
231 232 233 |
# File 'lib/core/transport.rb', line 231 def connection Connection.wrap(Cproton.pn_transport_connection(@impl)) end |
#log(message) ⇒ Object
Log a message to the transport’s logging mechanism.
This can be using in a debugging scenario as the message will be prepended with the transport’s identifier.
242 243 244 |
# File 'lib/core/transport.rb', line 242 def log() Cproton.pn_transport_log(@impl, ) end |
#peek(size) ⇒ String
Returns the specified number of bytes from the transport’s buffers.
289 290 291 292 293 294 |
# File 'lib/core/transport.rb', line 289 def peek(size) cd, out = Cproton.pn_transport_peek(@impl, size) return nil if cd == Qpid::Proton::Error::EOS raise TransportError.new if cd < -1 out end |
#pop(size) ⇒ Object
Removes the specified number of bytes from the pending output queue following the transport’s head pointer.
301 302 303 |
# File 'lib/core/transport.rb', line 301 def pop(size) Cproton.pn_transport_pop(@impl, size) end |
#process(size) ⇒ Object
Process input data following the tail pointer.
Calling this function will cause the transport to consume the specified number of bytes of input occupying the free space following the tail pointer. It may also change the value for #tail, as well as the amount of free space reported by #capacity.
267 268 269 |
# File 'lib/core/transport.rb', line 267 def process(size) Cproton.pn_transport_process(@impl, size) end |
#push(data) ⇒ Integer
Pushes the supplied bytes into the tail of the transport.
252 253 254 |
# File 'lib/core/transport.rb', line 252 def push(data) Cproton.pn_transport_push(@impl, data, data.length) end |
#quiesced? ⇒ Boolean
Returns whether the transport has any buffered data.
185 186 187 |
# File 'lib/core/transport.rb', line 185 def quiesced? Cproton.pn_transport_quiesced(@impl) end |
#sasl ⇒ SASL
Create, or return existing, SSL object for the transport.
336 337 338 |
# File 'lib/core/transport.rb', line 336 def sasl SASL.new(self) end |
#set_server ⇒ Object
Set server mode for this tranport - enables protocol detection and server-side authentication for incoming connections
179 |
# File 'lib/core/transport.rb', line 179 def set_server() Cproton.pn_transport_set_server(@impl); end |
#ssl(domain = nil, session_details = nil) ⇒ SSL
Creates, or returns an existing, SSL object for the transport.
347 348 349 |
# File 'lib/core/transport.rb', line 347 def ssl(domain = nil, session_details = nil) @ssl ||= SSL.create(self, domain, session_details) end |
#ssl? ⇒ Boolean
352 353 354 |
# File 'lib/core/transport.rb', line 352 def ssl? !@ssl.nil? end |
#tick(now) ⇒ Integer
Process any pending transport timer events.
This method should be called after all pending input has been processed by the transport (see #input), and before generating output (see #output).
It returns the deadline for the next pending timer event, if any art present.
330 331 332 |
# File 'lib/core/transport.rb', line 330 def tick(now) Cproton.pn_transport_tick(@impl, now) end |
#trace(level) ⇒ Object
Updates the transports trace flags.
223 224 225 |
# File 'lib/core/transport.rb', line 223 def trace(level) Cproton.pn_transport_trace(@impl, level) end |
#unbind ⇒ Object
Unbinds from the previous connection.
210 211 212 |
# File 'lib/core/transport.rb', line 210 def unbind Cproton.pn_transport_unbind(@impl) end |