Module: Familia::Settings
- Included in:
- Familia, DataType, 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.
-
#pipelined_mode(val = nil) ⇒ Symbol
Controls pipeline behavior when connection handlers don't support pipelines.
- #pipelined_mode=(val) ⇒ Object
Instance Attribute Details
#current_key_version(val = nil) ⇒ Object
61 62 63 64 |
# File 'lib/familia/settings.rb', line 61 def current_key_version(val = nil) @current_key_version = val if val @current_key_version end |
#default_expiration(v = nil) ⇒ Object
39 40 41 42 |
# File 'lib/familia/settings.rb', line 39 def default_expiration(v = nil) @default_expiration = v unless v.nil? @default_expiration end |
#delim(val = nil) ⇒ Object
24 25 26 27 |
# File 'lib/familia/settings.rb', line 24 def delim(val = nil) @delim = val if val @delim end |
#encryption_keys(val = nil) ⇒ Object
56 57 58 59 |
# File 'lib/familia/settings.rb', line 56 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
77 78 79 80 81 82 83 84 |
# File 'lib/familia/settings.rb', line 77 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
44 45 46 47 48 |
# File 'lib/familia/settings.rb', line 44 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
29 30 31 32 |
# File 'lib/familia/settings.rb', line 29 def prefix(val = nil) @prefix = val if val @prefix end |
#suffix(val = nil) ⇒ Object
34 35 36 37 |
# File 'lib/familia/settings.rb', line 34 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
101 102 103 104 105 106 107 108 109 |
# File 'lib/familia/settings.rb', line 101 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
156 157 158 159 |
# File 'lib/familia/settings.rb', line 156 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.
52 53 54 |
# File 'lib/familia/settings.rb', line 52 def default_suffix suffix end |
#pipelined_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
126 127 128 129 130 131 132 133 134 |
# File 'lib/familia/settings.rb', line 126 def pipelined_mode(val = nil) if val unless [:strict, :warn, :permissive].include?(val) raise ArgumentError, 'Pipeline mode must be :strict, :warn, or :permissive' end @pipelined_mode = val end @pipelined_mode || :warn # default to warn mode end |
#pipelined_mode=(val) ⇒ Object
136 137 138 139 140 141 |
# File 'lib/familia/settings.rb', line 136 def pipelined_mode=(val) unless [:strict, :warn, :permissive].include?(val) raise ArgumentError, 'Pipeline mode must be :strict, :warn, or :permissive' end @pipelined_mode = val end |