Class: Async::Background::Queue::StoreOptions
- Inherits:
-
Data
- Object
- Data
- Async::Background::Queue::StoreOptions
- Defined in:
- lib/async/background/queue/options.rb
Instance Attribute Summary collapse
-
#mmap ⇒ Object
readonly
Returns the value of attribute mmap.
-
#synchronous ⇒ Object
readonly
Returns the value of attribute synchronous.
-
#wal_autocheckpoint ⇒ Object
readonly
Returns the value of attribute wal_autocheckpoint.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(mmap:, synchronous:, wal_autocheckpoint:) ⇒ StoreOptions
constructor
A new instance of StoreOptions.
- #mmap_size ⇒ Object
- #pragma_sql ⇒ Object
- #synchronous_pragma ⇒ Object
Constructor Details
#initialize(mmap:, synchronous:, wal_autocheckpoint:) ⇒ StoreOptions
Returns a new instance of StoreOptions.
22 23 24 25 26 27 28 |
# File 'lib/async/background/queue/options.rb', line 22 def initialize(mmap:, synchronous:, wal_autocheckpoint:) validate_mmap!(mmap) validate_synchronous!(synchronous) validate_wal_autocheckpoint!(wal_autocheckpoint) super end |
Instance Attribute Details
#mmap ⇒ Object (readonly)
Returns the value of attribute mmap
15 16 17 |
# File 'lib/async/background/queue/options.rb', line 15 def mmap @mmap end |
#synchronous ⇒ Object (readonly)
Returns the value of attribute synchronous
15 16 17 |
# File 'lib/async/background/queue/options.rb', line 15 def synchronous @synchronous end |
#wal_autocheckpoint ⇒ Object (readonly)
Returns the value of attribute wal_autocheckpoint
15 16 17 |
# File 'lib/async/background/queue/options.rb', line 15 def wal_autocheckpoint @wal_autocheckpoint end |
Class Method Details
.build(value = {}) ⇒ Object
16 17 18 19 20 |
# File 'lib/async/background/queue/options.rb', line 16 def self.build(value = {}) return value if value.is_a?(self) new(**DEFAULT_STORE_OPTIONS, **value) end |
Instance Method Details
#mmap_size ⇒ Object
31 |
# File 'lib/async/background/queue/options.rb', line 31 def mmap_size = mmap ? MMAP_SIZE : 0 |
#pragma_sql ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/async/background/queue/options.rb', line 33 def pragma_sql <<~SQL PRAGMA journal_mode = WAL; PRAGMA synchronous = #{synchronous_pragma}; PRAGMA mmap_size = #{mmap_size}; PRAGMA cache_size = -16000; PRAGMA temp_store = MEMORY; PRAGMA journal_size_limit = 67108864; PRAGMA wal_autocheckpoint = #{wal_autocheckpoint}; SQL end |
#synchronous_pragma ⇒ Object
30 |
# File 'lib/async/background/queue/options.rb', line 30 def synchronous_pragma = SYNCHRONOUS_LEVELS.fetch(synchronous) |