class HaveAPI::Fs::Components::RemoteControlFile
This file serves as an IPC between the file system and outer processes, mainly executables from the file system itself.
It does not behave like a regular file, it's more like a local socket. The process opens the file, writes a message with a command and then reads a message with a response.
Messages are formatted in YAML and separated by {MSG_DELIMITER}.
Constants
- MSG_DELIMITER
Public Instance Methods
raw_close(path, handle = nil)
click to toggle source
# File lib/haveapi/fs/components/remote_control_file.rb, line 88 def raw_close(path, handle = nil) nil end
raw_open(path, mode, rfusefs = nil)
click to toggle source
# File lib/haveapi/fs/components/remote_control_file.rb, line 52 def raw_open(path, mode, rfusefs = nil) FileHandle.new end
raw_read(path, offset, size, handle = nil)
click to toggle source
# File lib/haveapi/fs/components/remote_control_file.rb, line 56 def raw_read(path, offset, size, handle = nil) handle.read(offset, size) end
raw_sync(path, datasync, handle = nil)
click to toggle source
# File lib/haveapi/fs/components/remote_control_file.rb, line 80 def raw_sync(path, datasync, handle = nil) nil end
raw_truncate(path, offset, handle = nil)
click to toggle source
# File lib/haveapi/fs/components/remote_control_file.rb, line 84 def raw_truncate(path, offset, handle = nil) true end
raw_write(path, offset, size, buf, handle = nil)
click to toggle source
# File lib/haveapi/fs/components/remote_control_file.rb, line 60 def raw_write(path, offset, size, buf, handle = nil) handle.write(offset, size, buf) if handle.complete? cmd = handle.parse case cmd[:action] when :execute ret = HaveAPI::Fs::RemoteControl.execute(context, cmd[:path]) else raise Errno::EIO, "unsupported action '#{cmd[:action]}'" end handle.read_buf = YAML.dump(ret) end size end
size()
click to toggle source
# File lib/haveapi/fs/components/remote_control_file.rb, line 47 def size # The size limits the maximum amount of data that can be read from this file 4096 end
writable?()
click to toggle source
# File lib/haveapi/fs/components/remote_control_file.rb, line 43 def writable? true end