Class: Sequent::Support::ViewProjection
- Inherits:
-
Object
- Object
- Sequent::Support::ViewProjection
- Defined in:
- lib/sequent/support/view_projection.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#schema_definition ⇒ Object
readonly
Returns the value of attribute schema_definition.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #build! ⇒ Object
-
#initialize(options) ⇒ ViewProjection
constructor
A new instance of ViewProjection.
- #schema_name ⇒ Object
Constructor Details
#initialize(options) ⇒ ViewProjection
Returns a new instance of ViewProjection.
10 11 12 13 14 15 |
# File 'lib/sequent/support/view_projection.rb', line 10 def initialize() @name = .fetch(:name) @version = .fetch(:version) @schema_definition = .fetch(:definition) @replay_event_handlers = .fetch(:event_handlers) end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/sequent/support/view_projection.rb', line 8 def name @name end |
#schema_definition ⇒ Object (readonly)
Returns the value of attribute schema_definition.
8 9 10 |
# File 'lib/sequent/support/view_projection.rb', line 8 def schema_definition @schema_definition end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
8 9 10 |
# File 'lib/sequent/support/view_projection.rb', line 8 def version @version end |
Instance Method Details
#build! ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/sequent/support/view_projection.rb', line 17 def build! with_default_configuration do Sequent.configuration.event_handlers = @replay_event_handlers load schema_definition event_store = Sequent.configuration.event_store ordering = Events::ORDERED_BY_STREAM event_store.replay_events_from_cursor( block_size: 10_000, get_events: -> { ordering[event_store] }, ) end end |
#schema_name ⇒ Object
31 32 33 |
# File 'lib/sequent/support/view_projection.rb', line 31 def schema_name "#{name}_#{version}" end |