Class: ActiveEvent::EventSourceServer
- Inherits:
-
Object
- Object
- ActiveEvent::EventSourceServer
- Includes:
- Singleton
- Defined in:
- lib/active_event/event_source_server.rb
Defined Under Namespace
Classes: Status
Class Method Summary collapse
- .after_event_projection(event_id, projection, &block) ⇒ Object
- .projection_status(projection) ⇒ Object
Instance Method Summary collapse
Class Method Details
.after_event_projection(event_id, projection, &block) ⇒ Object
14 15 16 |
# File 'lib/active_event/event_source_server.rb', line 14 def after_event_projection(event_id, projection, &block) instance.after_event_projection(event_id, projection, &block) end |
.projection_status(projection) ⇒ Object
18 19 20 |
# File 'lib/active_event/event_source_server.rb', line 18 def projection_status(projection) instance.projection_status(projection) end |
Instance Method Details
#after_event_projection(event_id, projection) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/active_event/event_source_server.rb', line 23 def after_event_projection(event_id, projection) mutex.synchronize do projection_status = status[projection] if projection_status.event_id < event_id cv = ConditionVariable.new begin projection_status.waiters[event_id] << cv cv.wait(mutex) ensure projection_status.waiters[event_id].delete cv end end raise ProjectionException, projection_status.error, projection_status.backtrace if projection_status.error end yield end |
#projection_status(projection) ⇒ Object
40 41 42 43 44 45 |
# File 'lib/active_event/event_source_server.rb', line 40 def projection_status(projection) mutex.synchronize do projection_status = status[projection] raise ProjectionException, projection_status.error, projection_status.backtrace if projection_status.error end end |