Class: FFI::Libfuse::FuseLoopConfig

Inherits:
Struct
  • Object
show all
Includes:
Accessors
Defined in:
lib/ffi/libfuse/fuse_loop_config.rb

Overview

For native fuse_loop_mt only

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Accessors

#ffi_attr_fill, #ffi_attr_reader_member, #ffi_attr_writer_member, #fill, #inspect, #to_h

Methods included from Accessors::ClassMethods

#attr_accessor, #attr_reader, #attr_writer, #ffi_attr_accessor, #ffi_attr_reader, #ffi_attr_reader_method, #ffi_attr_readers, #ffi_attr_writer, #ffi_attr_writer_method, #ffi_attr_writers, #ffi_bitflag_accessor, #ffi_bitflag_reader, #ffi_bitflag_writer, #ffi_public_attr_readers, #ffi_public_attr_writers

Instance Attribute Details

#clone_fd?=(value) ⇒ Boolean (writeonly)

whether to use separate device fds for each thread (may increase performance) Unused by ffi-libfuse as we do not call fuse_loop_mt

Returns:

  • (Boolean)


# File 'lib/ffi/libfuse/fuse_loop_config.rb', line 12

#max_idle_threads=(val) ⇒ Integer (writeonly)

Deprecated.

at Fuse 3.12. Use max_threads instead

The maximum number of available worker threads before they start to get deleted when they become idle. If not specified, the default is 10.

Adjusting this has performance implications; a very small number of threads in the pool will cause a lot of thread creation and deletion overhead and performance may suffer. When set to 0, a new thread will be created to service every operation.

Returns:

  • (Integer)

    the maximum number of threads to leave idle



# File 'lib/ffi/libfuse/fuse_loop_config.rb', line 17

Class Method Details

.create(clone_fd: false, max_idle_threads: 10, **_) ⇒ Object



61
62
63
64
65
66
67
68
# File 'lib/ffi/libfuse/fuse_loop_config.rb', line 61

def create(max_idle_threads: nil, max_threads: 10, clone_fd: false, **_)
  cfg = Libfuse.fuse_loop_cfg_create
  ObjectSpace.define_finalizer(cfg, finalizer(cfg.to_ptr))
  cfg.clone_fd = clone_fd
  cfg.max_idle_threads = max_idle_threads if max_idle_threads
  cfg.max_threads = max_threads if max_threads
  cfg
end

.finalizer(ptr) ⇒ Object



70
71
72
# File 'lib/ffi/libfuse/fuse_loop_config.rb', line 70

def finalizer(ptr)
  proc { |_| Libfuse.fuse_loop_cfg_destroy(ptr) }
end

Instance Method Details

#clone_fd=(bool_val) ⇒ Object



44
45
46
# File 'lib/ffi/libfuse/fuse_loop_config.rb', line 44

def clone_fd=(bool_val)
  Libfuse.fuse_loop_cfg_set_clone_fd(to_ptr, bool_val ? 1 : 0)
end

#max_threads=(val) ⇒ Object



56
57
58
# File 'lib/ffi/libfuse/fuse_loop_config.rb', line 56

def max_threads=(val)
  Libfuse.fuse_loop_cfg_set_max_threads(to_ptr, val) if val
end