Exception: Familia::IndexedFieldFastWriteError

Inherits:
PersistenceError show all
Defined in:
lib/familia/errors.rb

Overview

Raised when a fast-write method is asked to write a field that backs a class-level index. Fast writers issue a single HMSET with no surrounding claim, so they cannot maintain index consistency without violating the fail-closed ordering in ADR-0002. Use multi_field_update, save_fields, or save for indexed fields.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(field, index_name, offenders: nil) ⇒ IndexedFieldFastWriteError

Returns a new instance of IndexedFieldFastWriteError.

Parameters:

  • field (Symbol)

    the (first) offending field

  • index_name (Symbol)

    the index that field backs

  • offenders (Array<Array(Symbol, Symbol)>, nil) (defaults to: nil)

    every (field, index_name) pair the caller found. The message names them all, so a batch write with several indexed fields is diagnosed in one pass instead of one retry per field. field/index_name stay the first pair for callers that predate the batch guard.



140
141
142
143
144
145
# File 'lib/familia/errors.rb', line 140

def initialize(field, index_name, offenders: nil)
  @field = field
  @index_name = index_name
  @offenders = offenders || [[field, index_name]]
  super(build_message)
end

Instance Attribute Details

#fieldObject (readonly)

Returns the value of attribute field.



131
132
133
# File 'lib/familia/errors.rb', line 131

def field
  @field
end

#index_nameObject (readonly)

Returns the value of attribute index_name.



131
132
133
# File 'lib/familia/errors.rb', line 131

def index_name
  @index_name
end

#offendersObject (readonly)

Returns the value of attribute offenders.



131
132
133
# File 'lib/familia/errors.rb', line 131

def offenders
  @offenders
end