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.
7 8 9 10 11 12 |
# File 'lib/sequent/support/view_projection.rb', line 7 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.
6 7 8 |
# File 'lib/sequent/support/view_projection.rb', line 6 def name @name end |
#schema_definition ⇒ Object (readonly)
Returns the value of attribute schema_definition.
6 7 8 |
# File 'lib/sequent/support/view_projection.rb', line 6 def schema_definition @schema_definition end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
6 7 8 |
# File 'lib/sequent/support/view_projection.rb', line 6 def version @version end |
Instance Method Details
#build! ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/sequent/support/view_projection.rb', line 14 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
28 29 30 |
# File 'lib/sequent/support/view_projection.rb', line 28 def schema_name "#{name}_#{version}" end |