Class: ContentServer::Stream
- Inherits:
-
Object
- Object
- ContentServer::Stream
- Defined in:
- lib/content_server/file_streamer.rb
Instance Attribute Summary collapse
-
#checksum ⇒ Object
readonly
Returns the value of attribute checksum.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#tmp_path ⇒ Object
readonly
Returns the value of attribute tmp_path.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(checksum, path, file, size) ⇒ Stream
constructor
A new instance of Stream.
Constructor Details
#initialize(checksum, path, file, size) ⇒ Stream
Returns a new instance of Stream.
20 21 22 23 24 25 |
# File 'lib/content_server/file_streamer.rb', line 20 def initialize(checksum, path, file, size) @checksum = checksum @path = path @file = file @size = size end |
Instance Attribute Details
#checksum ⇒ Object (readonly)
Returns the value of attribute checksum.
19 20 21 |
# File 'lib/content_server/file_streamer.rb', line 19 def checksum @checksum end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
19 20 21 |
# File 'lib/content_server/file_streamer.rb', line 19 def file @file end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
19 20 21 |
# File 'lib/content_server/file_streamer.rb', line 19 def path @path end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
19 20 21 |
# File 'lib/content_server/file_streamer.rb', line 19 def size @size end |
#tmp_path ⇒ Object (readonly)
Returns the value of attribute tmp_path.
19 20 21 |
# File 'lib/content_server/file_streamer.rb', line 19 def tmp_path @tmp_path end |
Class Method Details
.close_delete_stream(checksum, streams_hash) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/content_server/file_streamer.rb', line 27 def self.close_delete_stream(checksum, streams_hash) if streams_hash.key?(checksum) Log.debug1("close_delete_stream #{streams_hash[checksum].file}") begin streams_hash[checksum].file.close() rescue IOError => e Log.warning("While closing stream, could not close file #{streams_hash[checksum].path}." \ " #{e.to_s}") end streams_hash.delete(checksum) end end |