Module: Smith::PersistenceAdapters::ActiveRecordExactStore

Included in:
ActiveRecordStore
Defined in:
lib/smith/persistence_adapters/active_record_exact_store.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#persistence_identityObject (readonly)

Returns the value of attribute persistence_identity.



6
7
8
# File 'lib/smith/persistence_adapters/active_record_exact_store.rb', line 6

def persistence_identity
  @persistence_identity
end

Instance Method Details

#replace_exact(key, payload, expected_payload:, ttl: nil) ⇒ Object

rubocop:disable Lint/UnusedMethodArgument



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/smith/persistence_adapters/active_record_exact_store.rb', line 8

def replace_exact(key, payload, expected_payload:, ttl: nil) # rubocop:disable Lint/UnusedMethodArgument
  ensure_version_column!
  ensure_locking_configuration!
  model = model_class
  ensure_exact_schema!(model)
  ActiveRecordExactWrite.new(
    model: model,
    key_column: @key_column,
    payload_column: @payload_column,
    version_column: @version_column,
    key: key,
    payload: payload,
    expected_payload: expected_payload
  ).call
rescue *ActiveRecordConnectionErrors.classes => e
  raise Smith::PersistenceIOError.new(operation: :replace_exact, cause: e)
end