Module: Sequent::Core::SnapshotConfiguration::ClassMethods

Defined in:
lib/sequent/core/aggregate_root.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#snapshot_default_thresholdObject (readonly)

Returns the value of attribute snapshot_default_threshold.



25
26
27
# File 'lib/sequent/core/aggregate_root.rb', line 25

def snapshot_default_threshold
  @snapshot_default_threshold
end

Instance Method Details

#enable_snapshots(default_threshold: 20) ⇒ Object

Enable snapshots for this aggregate. The aggregate instance must define the take_snapshot methods.



17
18
19
# File 'lib/sequent/core/aggregate_root.rb', line 17

def enable_snapshots(default_threshold: 20)
  @snapshot_default_threshold = default_threshold
end

#snapshots_enabled?Boolean

Returns:



21
22
23
# File 'lib/sequent/core/aggregate_root.rb', line 21

def snapshots_enabled?
  !snapshot_default_threshold.nil?
end