Class: Fwd::Output
Constant Summary collapse
- RESCUABLE =
[ Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::EHOSTUNREACH, Errno::EPIPE, Errno::ENETUNREACH, Errno::ENETDOWN, Errno::EINVAL, Errno::ETIMEDOUT, IOError, EOFError ].freeze
Instance Attribute Summary collapse
-
#core ⇒ Object
readonly
Returns the value of attribute core.
-
#pool ⇒ Object
readonly
Returns the value of attribute pool.
Instance Method Summary collapse
-
#forward! ⇒ Object
Callback.
-
#initialize(core) ⇒ Output
constructor
Constructor.
- #write(data) ⇒ Object
Constructor Details
Instance Attribute Details
#core ⇒ Object (readonly)
Returns the value of attribute core.
11 12 13 |
# File 'lib/fwd/output.rb', line 11 def core @core end |
#pool ⇒ Object (readonly)
Returns the value of attribute pool.
11 12 13 |
# File 'lib/fwd/output.rb', line 11 def pool @pool end |
Instance Method Details
#forward! ⇒ Object
Callback
24 25 26 27 28 29 30 31 |
# File 'lib/fwd/output.rb', line 24 def forward! Dir[root.join("#{prefix}.*.closed")].each do |file| reserve(file) do |data| logger.debug { "Flushing #{File.basename(file)}, #{data.size.fdiv(1024).round} kB" } write(data) end end end |
#write(data) ⇒ Object
34 35 36 37 38 |
# File 'lib/fwd/output.rb', line 34 def write(data) pool.any? do |backend| forward(backend, data) end end |