Class: BBFS::ContentServer::Stream
- Inherits:
-
Object
- Object
- BBFS::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.
19 20 21 22 23 24 |
# File 'lib/content_server/file_streamer.rb', line 19 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.
18 19 20 |
# File 'lib/content_server/file_streamer.rb', line 18 def checksum @checksum end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
18 19 20 |
# File 'lib/content_server/file_streamer.rb', line 18 def file @file end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
18 19 20 |
# File 'lib/content_server/file_streamer.rb', line 18 def path @path end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
18 19 20 |
# File 'lib/content_server/file_streamer.rb', line 18 def size @size end |
#tmp_path ⇒ Object (readonly)
Returns the value of attribute tmp_path.
18 19 20 |
# File 'lib/content_server/file_streamer.rb', line 18 def tmp_path @tmp_path end |
Class Method Details
.close_delete_stream(checksum, streams_hash) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/content_server/file_streamer.rb', line 26 def self.close_delete_stream(checksum, streams_hash) if streams_hash.key?(checksum) Log.info("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 |