Sha256: 3af8dd551f429e86402db67f486cbab968a73c1a9fda7be98c1571527bd0a391

Contents?: true

Size: 637 Bytes

Versions: 24

Compression:

Stored size: 637 Bytes

Contents

# -*- encoding: binary -*-
# :enddoc:

# Used to keep track of file offsets in IO#trysendfile + evented
# models.  We always maintain our own file offsets in userspace because
# because sendfile() implementations offer pread()-like idempotency for
# concurrency (multiple clients can read the same underlying file handle).
class Rainbows::StreamFile
  attr_reader :to_io
  attr_accessor :offset, :count

  def initialize(offset, count, io, body)
    @offset, @count, @to_io, @body = offset, count, io, body
  end

  def close
    @body.close if @body.respond_to?(:close)
    @to_io.close unless @to_io.closed?
    @to_io = nil
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
rainbows-5.2.1 lib/rainbows/stream_file.rb
rainbows-5.2.0 lib/rainbows/stream_file.rb
rainbows-5.1.1 lib/rainbows/stream_file.rb
rainbows-5.1.0 lib/rainbows/stream_file.rb
rainbows-5.0.0.5.ge717 lib/rainbows/stream_file.rb
rainbows-5.0.0 lib/rainbows/stream_file.rb
rainbows-4.7.0 lib/rainbows/stream_file.rb
rainbows-4.6.2 lib/rainbows/stream_file.rb
rainbows-4.6.1 lib/rainbows/stream_file.rb
rainbows-4.6.0.4.g4108 lib/rainbows/stream_file.rb
rainbows-4.6.0 lib/rainbows/stream_file.rb
rainbows-4.5.0 lib/rainbows/stream_file.rb
rainbows-4.4.3 lib/rainbows/stream_file.rb
rainbows-4.4.2 lib/rainbows/stream_file.rb
rainbows-4.4.1.1.gd5c8c lib/rainbows/stream_file.rb
rainbows-4.4.1 lib/rainbows/stream_file.rb
rainbows-4.4.0 lib/rainbows/stream_file.rb
rainbows-4.3.1 lib/rainbows/stream_file.rb
rainbows-4.3.0 lib/rainbows/stream_file.rb
rainbows-4.2.0 lib/rainbows/stream_file.rb