Class: Rubcask::Config
- Inherits:
-
Struct
- Object
- Struct
- Rubcask::Config
- Defined in:
- lib/rubcask/config.rb,
lib/rubcask/config.rb
Overview
Server runner config
Constant Summary collapse
- DEFAULT_SERVER_CONFIG =
configure { |c| c.io_strategy = :os }
Instance Attribute Summary collapse
-
#io_strategy ⇒ :ruby, ...
Guarantees; listed fastest first.
-
#max_file_size ⇒ Integer
Maximum single file size.
-
#threadsafe ⇒ boolean
Set to true if you want to use Rubcask with many threads concurrently.
-
#worker ⇒ :direct, ...
Type of worker used for async jobs.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize {|config| ... } ⇒ Config
constructor
A new instance of Config.
Constructor Details
Instance Attribute Details
#io_strategy ⇒ :ruby, ...
Guarantees; listed fastest first
:ruby is safe as long as you exit gracefully
:os is safe as long as no os or hardware failures occures
:os_sync is always safe
Default :ruby
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/rubcask/config.rb', line 36 Config = Struct.new(:max_file_size, :io_strategy, :threadsafe, :worker) do # @yieldparam [self] config def initialize self.max_file_size = Bytes::GIGABYTE * 2 self.io_strategy = :ruby self.threadsafe = true self.worker = :direct yield(self) if block_given? end def self.configure(&block) new(&block).freeze end end |
#max_file_size ⇒ Integer
Maximum single file size.
New file is created after the current file is larger than this field
Default: Bytes::GIGABYTE * 2
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/rubcask/config.rb', line 36 Config = Struct.new(:max_file_size, :io_strategy, :threadsafe, :worker) do # @yieldparam [self] config def initialize self.max_file_size = Bytes::GIGABYTE * 2 self.io_strategy = :ruby self.threadsafe = true self.worker = :direct yield(self) if block_given? end def self.configure(&block) new(&block).freeze end end |
#threadsafe ⇒ boolean
Set to true if you want to use Rubcask with many threads concurrently
Default: true
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/rubcask/config.rb', line 36 Config = Struct.new(:max_file_size, :io_strategy, :threadsafe, :worker) do # @yieldparam [self] config def initialize self.max_file_size = Bytes::GIGABYTE * 2 self.io_strategy = :ruby self.threadsafe = true self.worker = :direct yield(self) if block_given? end def self.configure(&block) new(&block).freeze end end |
#worker ⇒ :direct, ...
Type of worker used for async jobs
Currently it is only used for deleting files after merge
Default: :direct
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/rubcask/config.rb', line 36 Config = Struct.new(:max_file_size, :io_strategy, :threadsafe, :worker) do # @yieldparam [self] config def initialize self.max_file_size = Bytes::GIGABYTE * 2 self.io_strategy = :ruby self.threadsafe = true self.worker = :direct yield(self) if block_given? end def self.configure(&block) new(&block).freeze end end |
Class Method Details
.configure(&block) ⇒ Object
47 48 49 |
# File 'lib/rubcask/config.rb', line 47 def self.configure(&block) new(&block).freeze end |