Module: Familia::Settings
- Included in:
- Familia, Horreum::DefinitionMethods
- Defined in:
- lib/familia/settings.rb
Overview
Familia::Settings
Instance Attribute Summary collapse
- #current_key_version(val = nil) ⇒ Object
- #default_expiration(v = nil) ⇒ Object
- #delim(val = nil) ⇒ Object
- #encryption_keys(val = nil) ⇒ Object
-
#encryption_personalization(val = nil) ⇒ String
Personalization string for BLAKE2b key derivation in XChaCha20Poly1305.
- #logical_database(v = nil) ⇒ Object
- #prefix(val = nil) ⇒ Object
- #suffix(val = nil) ⇒ Object
-
#transaction_mode(val = nil) ⇒ Symbol
Controls transaction behavior when connection handlers don't support transactions.
Instance Method Summary collapse
-
#configure {|Settings| ... } ⇒ Settings
(also: #config)
Configure Familia settings.
-
#default_suffix ⇒ Object
We define this do-nothing method because it reads better than simply Familia.suffix in some contexts.
-
#pipeline_mode(val = nil) ⇒ Symbol
Controls pipeline behavior when connection handlers don't support pipelines.
- #pipeline_mode=(val) ⇒ Object
Instance Attribute Details
#current_key_version(val = nil) ⇒ Object
59 60 61 62 |
# File 'lib/familia/settings.rb', line 59 def current_key_version(val = nil) @current_key_version = val if val @current_key_version end |
#default_expiration(v = nil) ⇒ Object
37 38 39 40 |
# File 'lib/familia/settings.rb', line 37 def default_expiration(v = nil) @default_expiration = v unless v.nil? @default_expiration end |
#delim(val = nil) ⇒ Object
22 23 24 25 |
# File 'lib/familia/settings.rb', line 22 def delim(val = nil) @delim = val if val @delim end |
#encryption_keys(val = nil) ⇒ Object
54 55 56 57 |
# File 'lib/familia/settings.rb', line 54 def encryption_keys(val = nil) @encryption_keys = val if val @encryption_keys end |
#encryption_personalization(val = nil) ⇒ String
Personalization string for BLAKE2b key derivation in XChaCha20Poly1305. This provides cryptographic domain separation, ensuring derived keys are unique per application even with identical master keys and contexts. Must be 16 bytes or less (automatically padded with null bytes).
end
75 76 77 78 79 80 81 82 |
# File 'lib/familia/settings.rb', line 75 def encryption_personalization(val = nil) if val raise ArgumentError, 'Personalization string cannot exceed 16 bytes' if val.bytesize > 16 @encryption_personalization = val end @encryption_personalization end |
#logical_database(v = nil) ⇒ Object
42 43 44 45 46 |
# File 'lib/familia/settings.rb', line 42 def logical_database(v = nil) Familia.trace :DB, nil, "#{@logical_database} #{v}" if Familia.debug? @logical_database = v unless v.nil? @logical_database end |
#prefix(val = nil) ⇒ Object
27 28 29 30 |
# File 'lib/familia/settings.rb', line 27 def prefix(val = nil) @prefix = val if val @prefix end |
#suffix(val = nil) ⇒ Object
32 33 34 35 |
# File 'lib/familia/settings.rb', line 32 def suffix(val = nil) @suffix = val if val @suffix end |
#transaction_mode(val = nil) ⇒ Symbol
Controls transaction behavior when connection handlers don't support transactions
Available modes:
- :warn (default): Log warning and execute commands individually
- :strict: Raise OperationModeError when transaction unavailable
- :permissive: Silently execute commands individually
99 100 101 102 103 104 105 106 107 |
# File 'lib/familia/settings.rb', line 99 def transaction_mode(val = nil) if val unless [:strict, :warn, :permissive].include?(val) raise ArgumentError, 'Transaction mode must be :strict, :warn, or :permissive' end @transaction_mode = val end @transaction_mode || :warn # default to warn mode end |
Instance Method Details
#configure {|Settings| ... } ⇒ Settings Also known as: config
Configure Familia settings
154 155 156 157 |
# File 'lib/familia/settings.rb', line 154 def configure yield self if block_given? self end |
#default_suffix ⇒ Object
We define this do-nothing method because it reads better than simply Familia.suffix in some contexts.
50 51 52 |
# File 'lib/familia/settings.rb', line 50 def default_suffix suffix end |
#pipeline_mode(val = nil) ⇒ Symbol
Controls pipeline behavior when connection handlers don't support pipelines
Available modes:
- :warn (default): Log warning and execute commands individually
- :strict: Raise OperationModeError when pipeline unavailable
- :permissive: Silently execute commands individually
124 125 126 127 128 129 130 131 132 |
# File 'lib/familia/settings.rb', line 124 def pipeline_mode(val = nil) if val unless [:strict, :warn, :permissive].include?(val) raise ArgumentError, 'Pipeline mode must be :strict, :warn, or :permissive' end @pipeline_mode = val end @pipeline_mode || :warn # default to warn mode end |
#pipeline_mode=(val) ⇒ Object
134 135 136 137 138 139 |
# File 'lib/familia/settings.rb', line 134 def pipeline_mode=(val) unless [:strict, :warn, :permissive].include?(val) raise ArgumentError, 'Pipeline mode must be :strict, :warn, or :permissive' end @pipeline_mode = val end |