Exception: Smith::PersistenceVersionConflict

Inherits:
Error
  • Object
show all
Defined in:
lib/smith/errors.rb

Overview

Raised when an adapter’s optimistic-lock check detects a concurrent write: another process modified the key between this process’s restore and persist. Hosts can rescue + restore + retry, or fail the workflow run with explicit conflict semantics.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key:, expected:, actual:) ⇒ PersistenceVersionConflict

Returns a new instance of PersistenceVersionConflict.



111
112
113
114
115
116
# File 'lib/smith/errors.rb', line 111

def initialize(key:, expected:, actual:)
  @key = key
  @expected = expected
  @actual = actual
  super("persistence version conflict for #{key.inspect}: expected v#{expected}, got #{actual.inspect}")
end

Instance Attribute Details

#actualObject (readonly)

Returns the value of attribute actual.



109
110
111
# File 'lib/smith/errors.rb', line 109

def actual
  @actual
end

#expectedObject (readonly)

Returns the value of attribute expected.



109
110
111
# File 'lib/smith/errors.rb', line 109

def expected
  @expected
end

#keyObject (readonly)

Returns the value of attribute key.



109
110
111
# File 'lib/smith/errors.rb', line 109

def key
  @key
end