Class: HotCell::Input

Inherits:
Descriptor show all
Defined in:
lib/hot_cell/descriptors.rb

Constant Summary collapse

ACCESS_MODE =
Fcntl::O_RDONLY

Constants inherited from Descriptor

Descriptor::MODES

Instance Attribute Summary

Attributes inherited from Descriptor

#io

Instance Method Summary collapse

Methods inherited from Descriptor

#close, #fd_path, #initialize, #staged?, #to_io

Constructor Details

This class inherits a constructor from HotCell::Descriptor

Instance Method Details

#pathObject

Copies the bytes onto the worker's own scratch on the first call and returns the filename. This is the fallback, for an operation that genuinely needs a real file. Prefer fd_path, which reads the descriptor in place: staging is a write, so RLIMIT_FSIZE bounds it, and an input larger than the operation's file_size dies here as a permanent fsize verdict — a ceiling Rails does not have. The Active Storage operations all read fd_path for exactly that reason; nothing should reach for path without a specific need for a distinct on-disk copy.

On call rather than up front, so an operation that never asks for a staged path never pays for the copy.



103
104
105
# File 'lib/hot_cell/descriptors.rb', line 103

def path
  @path ||= copied_to(scratch_path)
end