Class: ActiveRecord::Materialized::DataVerificationResult

Inherits:
Data
  • Object
show all
Defined in:
lib/activerecord/materialized/data_verification_result.rb

Overview

The outcome of a DataVerifier run: the partition keys whose materialized contents diverge from the source relation, plus how much was checked.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#checked_partition_countObject (readonly)

Returns the value of attribute checked_partition_count

Returns:

  • (Object)

    the current value of checked_partition_count



7
8
9
# File 'lib/activerecord/materialized/data_verification_result.rb', line 7

def checked_partition_count
  @checked_partition_count
end

#extra_keysObject (readonly)

Returns the value of attribute extra_keys

Returns:

  • (Object)

    the current value of extra_keys



7
8
9
# File 'lib/activerecord/materialized/data_verification_result.rb', line 7

def extra_keys
  @extra_keys
end

#mismatched_keysObject (readonly)

Returns the value of attribute mismatched_keys

Returns:

  • (Object)

    the current value of mismatched_keys



7
8
9
# File 'lib/activerecord/materialized/data_verification_result.rb', line 7

def mismatched_keys
  @mismatched_keys
end

#missing_keysObject (readonly)

Returns the value of attribute missing_keys

Returns:

  • (Object)

    the current value of missing_keys



7
8
9
# File 'lib/activerecord/materialized/data_verification_result.rb', line 7

def missing_keys
  @missing_keys
end

#modeObject (readonly)

Returns the value of attribute mode

Returns:

  • (Object)

    the current value of mode



7
8
9
# File 'lib/activerecord/materialized/data_verification_result.rb', line 7

def mode
  @mode
end

#total_partition_countObject (readonly)

Returns the value of attribute total_partition_count

Returns:

  • (Object)

    the current value of total_partition_count



7
8
9
# File 'lib/activerecord/materialized/data_verification_result.rb', line 7

def total_partition_count
  @total_partition_count
end

#view_nameObject (readonly)

Returns the value of attribute view_name

Returns:

  • (Object)

    the current value of view_name



7
8
9
# File 'lib/activerecord/materialized/data_verification_result.rb', line 7

def view_name
  @view_name
end

Class Method Details

.empty(view_name:, mode:) ⇒ Object

A clean result covering nothing — for a view that isn't materialized yet.



23
24
25
26
27
28
# File 'lib/activerecord/materialized/data_verification_result.rb', line 23

def self.empty(view_name:, mode:)
  new(
    view_name: view_name, mode: mode, total_partition_count: 0, checked_partition_count: 0,
    missing_keys: [], extra_keys: [], mismatched_keys: []
  )
end

Instance Method Details

#divergent_keysObject

Every diverging partition key, however it diverged — the set a reconciliation re-maintains (see Reconciler).



36
37
38
# File 'lib/activerecord/materialized/data_verification_result.rb', line 36

def divergent_keys
  (missing_keys + extra_keys + mismatched_keys).uniq
end

#drifted?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/activerecord/materialized/data_verification_result.rb', line 30

def drifted?
  missing_keys.any? || extra_keys.any? || mismatched_keys.any?
end