Skip to content
Browse files

Merge branch 'projections-deleted-stream' into dev

  • Loading branch information...
2 parents 7466e47 + 7eb4eea commit bd283f8db240643182ea27c9d975ff286c046a24 @ysw ysw committed Feb 21, 2014
Showing with 6,456 additions and 796 deletions.
  1. +1 −1 src/EventStore/EventStore.ClientAPI/Common/SystemNames.cs
  2. +5 −0 src/EventStore/EventStore.ClientAPI/ProjectionsClient.cs
  3. +24 −1 src/EventStore/EventStore.ClientAPI/ProjectionsManager.cs
  4. +15 −0 src/EventStore/EventStore.ClientAPI/RecordedEvent.cs
  5. +1 −1 src/EventStore/EventStore.ClientAPI/ResolvedEvent.cs
  6. +1 −1 src/EventStore/EventStore.Core.Tests/ClientAPI/Helpers/TestEvent.cs
  7. +62 −0 src/EventStore/EventStore.Core.Tests/ClientAPI/SpecificationWithMiniNode.cs
  8. +2 −18 src/EventStore/EventStore.Core.Tests/ClientAPI/read_all_events_backward_should.cs
  9. +2 −18 src/EventStore/EventStore.Core.Tests/ClientAPI/read_all_events_forward_should.cs
  10. +82 −0 ...tStore/EventStore.Core.Tests/ClientAPI/read_all_events_forward_with_hard_deleted_stream_should.cs
  11. +84 −0 ...tStore/EventStore.Core.Tests/ClientAPI/read_all_events_forward_with_soft_deleted_stream_should.cs
  12. +2 −20 src/EventStore/EventStore.Core.Tests/ClientAPI/read_event_should.cs
  13. +81 −0 src/EventStore/EventStore.Core.Tests/ClientAPI/read_stream_events_with_unresolved_linkto.cs
  14. +80 −98 src/EventStore/EventStore.Core.Tests/ClientAPI/when_having_truncatebefore_set_for_stream.cs
  15. +4 −0 src/EventStore/EventStore.Core.Tests/EventStore.Core.Tests.csproj
  16. +24 −5 src/EventStore/EventStore.Core.Tests/Helpers/ManualQueue.cs
  17. +69 −22 src/EventStore/EventStore.Core.Tests/Helpers/TestFixtureWithExistingEvents.cs
  18. +3 −2 src/EventStore/EventStore.Core.Tests/Helpers/TestFixtureWithReadWriteDispatchers.cs
  19. +1 −1 src/EventStore/EventStore.Core.Tests/Services/UserManagementService/user_management_service.cs
  20. +102 −0 src/EventStore/EventStore.Core/Bus/QueueStatsCollector.cs
  21. +6 −0 src/EventStore/EventStore.Core/Bus/QueuedHandlerAutoReset.cs
  22. +6 −0 src/EventStore/EventStore.Core/Bus/QueuedHandlerMRES.cs
  23. +6 −0 src/EventStore/EventStore.Core/Bus/QueuedHandlerPulse.cs
  24. +6 −0 src/EventStore/EventStore.Core/Bus/QueuedHandlerSleep.cs
  25. +6 −0 src/EventStore/EventStore.Core/Bus/QueuedHandlerThreadPool.cs
  26. +15 −3 src/EventStore/EventStore.Core/Data/ResolvedEvent.cs
  27. +77 −67 src/EventStore/EventStore.Core/Data/StreamMetadata.cs
  28. +9 −3 src/EventStore/EventStore.Core/Services/Storage/StorageReaderWorker.cs
  29. +10 −5 src/EventStore/EventStore.Core/Services/SubscriptionsService.cs
  30. +8 −2 src/EventStore/EventStore.Core/Services/Transport/Http/Convert.cs
  31. +3 −0 src/EventStore/EventStore.Core/SingleVNode.cs
  32. +2 −1 src/EventStore/EventStore.Core/TransactionLog/Checkpoint/FileCheckpoint.cs
  33. +113 −0 src/EventStore/EventStore.Projections.Core.Tests/ClientAPI/event_by_type_index.cs
  34. +82 −0 ...ore.Projections.Core.Tests/ClientAPI/event_by_type_index/when_reverting_after_index_catches_up.cs
  35. +260 −0 ...e/EventStore.Projections.Core.Tests/ClientAPI/specification_with_standard_projections_runnning.cs
  36. +77 −0 ...rom_all_any_foreach_projection/recovery/when_running_and_a_stream_gets_deleted_before_recovery.cs
  37. +77 −0 ...ndling_delete/with_from_all_any_foreach_projection/recovery/when_running_and_events_are_posted.cs
  38. +72 −0 .../when_handling_delete/with_from_all_any_foreach_projection/when_running_and_events_are_indexed.cs
  39. +72 −0 ...I/when_handling_delete/with_from_all_any_foreach_projection/when_running_and_events_are_posted.cs
  40. +75 −0 ...any_foreach_projection/when_running_and_events_are_posted_but_a_stream_and_tombstone_postponed.cs
  41. +71 −0 ...g_delete/with_from_all_any_foreach_projection/when_running_and_events_are_posted_but_tombstone.cs
  42. +75 −0 ...te/with_from_all_any_foreach_projection/when_running_and_events_are_posted_including_tombstone.cs
  43. +78 −0 ..._from_all_any_foreach_projection/when_running_and_then_other_events_tombstone_ant_other_events.cs
  44. +84 −0 ..._handling_delete/with_from_all_foreach_projection/recovery/when_running_and_events_are_indexed.cs
  45. +84 −0 .../with_from_all_foreach_projection/recovery/when_running_and_events_get_indexed_before_recovery.cs
  46. +86 −0 ...tAPI/when_handling_delete/with_from_all_foreach_projection/when_running_and_events_are_indexed.cs
  47. +87 −0 ...ith_from_all_foreach_projection/when_running_and_events_are_indexed_but_a_stream_and_tombstone.cs
  48. +88 −0 ..._from_all_foreach_projection/when_running_and_events_are_indexed_but_more_events_and_tombstone.cs
  49. +87 −0 ...ling_delete/with_from_all_foreach_projection/when_running_and_events_are_indexed_but_tombstone.cs
  50. +73 −0 ...s/ClientAPI/when_handling_delete/with_from_all_foreach_projection/when_running_and_no_indexing.cs
  51. +79 −0 ...handling_delete/with_from_all_foreach_projection/when_running_and_no_indexing_and_other_events.cs
  52. +80 −0 ...ling_delete/with_from_category_foreach_projection/recovery/when_running_and_events_are_indexed.cs
  53. +80 −0 ..._from_category_foreach_projection/recovery/when_running_and_events_get_indexed_before_recovery.cs
  54. +74 −0 ...when_handling_delete/with_from_category_foreach_projection/when_running_and_events_are_indexed.cs
  55. +83 −0 ...ry_foreach_projection/when_running_and_events_are_indexed_but_a_stream_and_tombstone_postponed.cs
  56. +74 −0 ...delete/with_from_category_foreach_projection/when_running_and_events_are_indexed_but_tombstone.cs
  57. +76 −0 .../with_from_category_foreach_projection/when_running_and_events_are_indexed_including_tombstone.cs
  58. +81 −0 ...from_category_foreach_projection/when_running_and_then_other_events_tombstone_ant_other_events.cs
  59. +121 −0 src/EventStore/EventStore.Projections.Core.Tests/ClientAPI/with_standard_projections_running.cs
  60. +58 −18 src/EventStore/EventStore.Projections.Core.Tests/EventStore.Projections.Core.Tests.csproj
  61. +116 −0 ...entStore.Projections.Core.Tests/Integration/scenarios/when_deleting_already_categorized_stream.cs
  62. +8 −1 src/EventStore/EventStore.Projections.Core.Tests/Integration/specification_with_a_v8_query_posted.cs
  63. +1 −1 ...entStore.Projections.Core.Tests/Integration/system_projections/when_running_system_projections.cs
  64. +1 −0 src/EventStore/EventStore.Projections.Core.Tests/Services/TestFixtureWithProjectionCoreService.cs
  65. +45 −0 src/EventStore/EventStore.Projections.Core.Tests/Services/awake_reader_service/when_creating.cs
  66. +86 −0 ...e/EventStore.Projections.Core.Tests/Services/awake_reader_service/when_handling_comitted_event.cs
  67. +186 −0 ...tions.Core.Tests/Services/awake_reader_service/when_handling_committed_event_after_unsybscribe.cs
  68. +170 −0 ...ctions.Core.Tests/Services/awake_reader_service/when_handling_committed_event_with_subscribers.cs
  69. +93 −0 .../EventStore.Projections.Core.Tests/Services/awake_reader_service/when_handling_subscribe_awake.cs
  70. +153 −0 ...vices/awake_reader_service/when_subscribing_before_last_position_with_already_committed_events.cs
  71. +9 −0 ...re.Projections.Core.Tests/Services/checkpoint_tag/checkpoint_tag_by_event_type_index_positions.cs
  72. +5 −0 src/EventStore/EventStore.Projections.Core.Tests/Services/core_projection/FakeProjectionHandler.cs
  73. +10 −0 ...Store/EventStore.Projections.Core.Tests/Services/core_projection/TestFixtureWithExistingEvents.cs
  74. +1 −0 ...EventStore.Projections.Core.Tests/Services/core_projection/TestFixtureWithReadWriteDispatchers.cs
  75. +1 −0 ...sts/Services/core_projection/checkpoint_manager/TestFixtureWithCoreProjectionCheckpointManager.cs
  76. +1 −1 ...ed_stream/another_epoch/when_handling_emits_with_previously_written_events_in_different_epochs.cs
  77. +27 −1 ...sts/Services/core_projection/emitted_stream/when_handling_emits_with_previously_written_events.cs
  78. +1 −1 ...jection/emitted_stream/when_handling_emits_with_previously_written_events_at_the_same_position.cs
  79. +2 −1 ...Core.Tests/Services/core_projection/multi_phase/specification_with_multi_phase_core_projection.cs
  80. +1 −0 ...entStore/EventStore.Projections.Core.Tests/Services/core_projection/when_starting_a_projection.cs
  81. +9 −0 ...tStore/EventStore.Projections.Core.Tests/Services/event_filter/include_everything_event_filter.cs
  82. +26 −22 ...re.Tests/Services/event_filter/include_everything_handling_deleted_notifications_event_filter.cs}
  83. +2 −1 ...tore/EventStore.Projections.Core.Tests/Services/event_reader/TestFixtureWithEventReaderService.cs
  84. +2 −2 ...ections.Core.Tests/Services/event_reader/all_streams_catalog_event_reader/when_reading_catalog.cs
  85. +3 −3 ...tions.Core.Tests/Services/event_reader/event_by_type_index_reader/catching_up/index_checkpoint.cs
  86. +13 −0 ...Store.Projections.Core.Tests/Services/event_reader/heading_event_reader/FakeReaderSubscription.cs
  87. +2 −2 ...ore.Tests/Services/event_reader/multi_stream_reader/when_handling_read_completed_and_no_stream.cs
  88. +2 −11 ...ervices/event_reader/multi_stream_reader/when_handling_read_completed_for_all_streams_and_eofs.cs
  89. +18 −6 ...e.Projections.Core.Tests/Services/event_reader/stream_reader/when_creating_stream_event_reader.cs
  90. +2 −1 ...tore.Projections.Core.Tests/Services/event_reader/stream_reader/when_handling_eof_and_idle_eof.cs
  91. +4 −12 .../EventStore.Projections.Core.Tests/Services/event_reader/stream_reader/when_handling_no_stream.cs
  92. +9 −15 ...rojections.Core.Tests/Services/event_reader/stream_reader/when_handling_read_completed_and_eof.cs
  93. +6 −5 ...ore.Tests/Services/event_reader/stream_reader/when_handling_read_completed_stream_event_reader.cs
  94. +6 −5 ...ore.Tests/Services/event_reader/stream_reader/when_handling_read_completed_then_pause_then_eof.cs
  95. +1 −1 ...ore.Projections.Core.Tests/Services/event_reader/stream_reader/when_onetime_reader_handles_eof.cs
  96. +2 −1 ...Projections.Core.Tests/Services/event_reader/stream_reader/when_paused_then_handling_no_stream.cs
  97. +2 −1 ...e.Projections.Core.Tests/Services/event_reader/stream_reader/when_resuming_stream_event_reader.cs
  98. +2 −1 ...tions.Core.Tests/Services/event_reader/stream_reader/when_stream_event_reader_has_been_created.cs
  99. +9 −6 ...ctions.Core.Tests/Services/event_reader/transaction_file_reader/when_handling_eof_and_idle_eof.cs
  100. +101 −0 ...ons.Core.Tests/Services/event_reader/transaction_file_reader/when_handling_stream_hard_deleted.cs
  101. +103 −0 ...ons.Core.Tests/Services/event_reader/transaction_file_reader/when_handling_stream_soft_deleted.cs
  102. +2 −0 ....Projections.Core.Tests/Services/projection_subscription/TestFixtureWithProjectionSubscription.cs
  103. +5 −0 ...ventStore/EventStore.Projections.Core.Tests/Services/projections_manager/FakeBiStateProjection.cs
  104. +5 −0 ...ore/EventStore.Projections.Core.Tests/Services/projections_manager/FakeForeachStreamProjection.cs
  105. +5 −0 ...EventStore.Projections.Core.Tests/Services/projections_manager/FakeFromCatalogStreamProjection.cs
  106. +5 −0 src/EventStore/EventStore.Projections.Core.Tests/Services/projections_manager/FakeProjection.cs
  107. +6 −1 ...ons.Core.Tests/Services/projections_manager/TestFixtureWithProjectionCoreAndManagementServices.cs
  108. +6 −2 ...ntStore.Projections.Core.Tests/Services/projections_manager/continuous/a_new_posted_projection.cs
  109. +1 −1 ...ctions_manager/managed_projection/when_starting_a_managed_projection_without_slave_projections.cs
  110. +1 −1 ....Projections.Core.Tests/Services/projections_manager/query/a_running_foreach_stream_projection.cs
  111. +1 −1 ...tore/EventStore.Projections.Core.Tests/Services/projections_manager/query/a_running_projection.cs
  112. +10 −1 ...tions.Core.Tests/Services/projections_manager/specification_with_projection_management_service.cs
  113. +1 −5 ...EventStore/EventStore.Projections.Core.Tests/Services/{projections_manager → }/v8/v8_internals.cs
  114. +1 −1 ...Store.Projections.Core.Tests/Services/{projections_manager → }/v8/when_compiling_v8_projection.cs
  115. +2 −2 ...tStore.Projections.Core.Tests/Services/{projections_manager → }/v8/when_creating_v8_projection.cs
  116. +38 −3 ...tore.Projections.Core.Tests/Services/{projections_manager → }/v8/when_defining_a_v8_projection.cs
  117. +3 −2 ...EventStore.Projections.Core.Tests/Services/{projections_manager → }/v8/when_initializing_state.cs
  118. +2 −1 ...ons.Core.Tests/Services/{projections_manager → }/v8/when_not_returning_state_from_a_js_handler.cs
  119. +2 −1 ...e.Projections.Core.Tests/Services/{projections_manager → }/v8/when_partitioning_by_custom_rule.cs
  120. +2 −1 ...jections.Core.Tests/Services/{projections_manager → }/v8/when_running_a_faulting_v8_projection.cs
  121. +3 −2 ...Core.Tests/Services/{projections_manager → }/v8/when_running_a_v8_projection_emitting_metadata.cs
  122. +2 −2 ....Tests/Services/{projections_manager → }/v8/when_running_a_v8_projection_emitting_stream_links.cs
  123. +2 −1 ...s/Services/{projections_manager → }/v8/when_running_a_v8_projection_with_not_passing_filter_by.cs
  124. +2 −1 ...Core.Tests/Services/{projections_manager → }/v8/when_running_a_v8_projection_with_transform_by.cs
  125. +2 −2 ...rojections.Core.Tests/Services/{projections_manager → }/v8/when_running_bi_state_v8_projection.cs
  126. +2 −1 ...ons.Core.Tests/Services/{projections_manager → }/v8/when_running_body_reflecting_v8_projection.cs
  127. +2 −1 ...rojections.Core.Tests/Services/{projections_manager → }/v8/when_running_counting_v8_projection.cs
  128. +2 −2 ...rojections.Core.Tests/Services/{projections_manager → }/v8/when_running_emitting_v8_projection.cs
  129. +2 −1 ...jections.Core.Tests/Services/{projections_manager → }/v8/when_running_reflecting_v8_projection.cs
  130. +2 −1 ...e.Projections.Core.Tests/Services/{projections_manager → }/v8/when_v8_projection_loading_state.cs
  131. +6 −3 src/EventStore/EventStore.Projections.Core/EventStore.Projections.Core.csproj
  132. +80 −0 src/EventStore/EventStore.Projections.Core/Messages/AwakeReaderServiceMessage.cs
  133. +29 −0 src/EventStore/EventStore.Projections.Core/Messages/EventReaderSubscriptionMessage.cs
  134. +2 −0 src/EventStore/EventStore.Projections.Core/Messages/IQuerySources.cs
  135. +19 −0 src/EventStore/EventStore.Projections.Core/Messages/ProjectionManagementMessage.cs
  136. +6 −0 src/EventStore/EventStore.Projections.Core/Messages/QuerySourcesDefinition.cs
  137. +3 −0 src/EventStore/EventStore.Projections.Core/Messages/QuerySourcesDefinitionOptions.cs
  138. +61 −0 src/EventStore/EventStore.Projections.Core/Messages/ReaderSubscriptionMessage.cs
  139. +3 −0 src/EventStore/EventStore.Projections.Core/Prelude/1Prelude.js
  140. +43 −4 src/EventStore/EventStore.Projections.Core/Prelude/Projections.js
  141. +1 −0 src/EventStore/EventStore.Projections.Core/ProjectionManagerNode.cs
  142. +2 −0 src/EventStore/EventStore.Projections.Core/ProjectionWorkerNode.cs
  143. +13 −1 src/EventStore/EventStore.Projections.Core/Projections.cs
  144. +116 −0 src/EventStore/EventStore.Projections.Core/Services/AwakeReaderService/AwakeReaderService.cs
  145. +12 −0 src/EventStore/EventStore.Projections.Core/Services/Http/ProjectionsController.cs
  146. +6 −0 src/EventStore/EventStore.Projections.Core/Services/IProjectionStateHandler.cs
  147. +42 −4 src/EventStore/EventStore.Projections.Core/Services/Management/ManagedProjection.cs
  148. +14 −0 src/EventStore/EventStore.Projections.Core/Services/Management/ProjectionManager.cs
  149. +20 −10 src/EventStore/EventStore.Projections.Core/Services/Processing/AllStreamsCatalogEventReader.cs
  150. +5 −0 src/EventStore/EventStore.Projections.Core/Services/Processing/ByHandleStatePartitionSelector.cs
  151. +10 −1 ...ntStore/EventStore.Projections.Core/Services/Processing/ByPositionStreamStatePartitionSelector.cs
  152. +17 −18 src/EventStore/EventStore.Projections.Core/Services/Processing/ByStreamCatalogEventReader.cs
  153. +11 −1 src/EventStore/EventStore.Projections.Core/Services/Processing/ByStreamStatePartitionSelector.cs
  154. +6 −1 src/EventStore/EventStore.Projections.Core/Services/Processing/BypassingEventFilter.cs
  155. +5 −0 src/EventStore/EventStore.Projections.Core/Services/Processing/CatalogStreamPositionTagger.cs
  156. +6 −1 src/EventStore/EventStore.Projections.Core/Services/Processing/CategoryEventFilter.cs
  157. +10 −1 src/EventStore/EventStore.Projections.Core/Services/Processing/CoreProjection.cs
  158. +1 −10 src/EventStore/EventStore.Projections.Core/Services/Processing/CoreProjectionCheckpointManager.cs
  159. +2 −2 src/EventStore/EventStore.Projections.Core/Services/Processing/CoreProjectionQueue.cs
  160. +1 −0 src/EventStore/EventStore.Projections.Core/Services/Processing/EmittedEvent.cs
  161. +6 −2 src/EventStore/EventStore.Projections.Core/Services/Processing/EmittedLinkToWithRecategorization.cs
  162. +43 −21 src/EventStore/EventStore.Projections.Core/Services/Processing/EmittedStream.cs
  163. +9 −2 src/EventStore/EventStore.Projections.Core/Services/Processing/EventByTypeIndexEventFilter.cs
  164. +137 −65 src/EventStore/EventStore.Projections.Core/Services/Processing/EventByTypeIndexEventReader.cs
  165. +32 −7 src/EventStore/EventStore.Projections.Core/Services/Processing/EventByTypeIndexPositionTagger.cs
  166. +16 −3 src/EventStore/EventStore.Projections.Core/Services/Processing/EventFilter.cs
  167. +8 −1 src/EventStore/EventStore.Projections.Core/Services/Processing/EventProcessedResult.cs
  168. +120 −2 ...Store/EventStore.Projections.Core/Services/Processing/EventProcessingProjectionProcessingPhase.cs
  169. +16 −4 src/EventStore/EventStore.Projections.Core/Services/Processing/EventReader.cs
  170. +13 −0 src/EventStore/EventStore.Projections.Core/Services/Processing/EventReaderCoreService.cs
  171. +6 −1 src/EventStore/EventStore.Projections.Core/Services/Processing/EventReorderingReaderSubscription.cs
  172. +29 −2 ...ventStore.Projections.Core/Services/Processing/EventSubscriptionBasedProjectionProcessingPhase.cs
  173. +17 −18 src/EventStore/EventStore.Projections.Core/Services/Processing/ExternallyFedByStreamEventReader.cs
  174. +106 −12 src/EventStore/EventStore.Projections.Core/Services/Processing/HeadingEventReader.cs
  175. +2 −0 src/EventStore/EventStore.Projections.Core/Services/Processing/IEventProcessingPhase.cs
  176. +2 −1 src/EventStore/EventStore.Projections.Core/Services/Processing/IProjectionProcessingPhase.cs
  177. +1 −0 src/EventStore/EventStore.Projections.Core/Services/Processing/IReaderSubscription.cs
  178. +6 −1 src/EventStore/EventStore.Projections.Core/Services/Processing/MultiStreamEventFilter.cs
  179. +52 −33 src/EventStore/EventStore.Projections.Core/Services/Processing/MultiStreamEventReader.cs
  180. +5 −0 src/EventStore/EventStore.Projections.Core/Services/Processing/MultiStreamPositionTagger.cs
  181. +5 −0 src/EventStore/EventStore.Projections.Core/Services/Processing/NoopStatePartitionSelector.cs
  182. +2 −1 src/EventStore/EventStore.Projections.Core/Services/Processing/ParallelQueryMasterReaderStrategy.cs
  183. +96 −0 src/EventStore/EventStore.Projections.Core/Services/Processing/PartitionDeletedWorkItem.cs
  184. +6 −1 src/EventStore/EventStore.Projections.Core/Services/Processing/PhasePositionTagger.cs
  185. +7 −2 src/EventStore/EventStore.Projections.Core/Services/Processing/PositionTagger.cs
  186. +1 −0 src/EventStore/EventStore.Projections.Core/Services/Processing/PositionTracker.cs
  187. +13 −0 src/EventStore/EventStore.Projections.Core/Services/Processing/PreTaggedPositionTagger.cs
  188. +11 −2 src/EventStore/EventStore.Projections.Core/Services/Processing/PreparePositionTagger.cs
  189. +6 −0 src/EventStore/EventStore.Projections.Core/Services/Processing/ProjectionSourceDefinition.cs
  190. +28 −13 src/EventStore/EventStore.Projections.Core/Services/Processing/ReaderStrategy.cs
  191. +9 −1 src/EventStore/EventStore.Projections.Core/Services/Processing/ReaderSubscription.cs
  192. +15 −6 ....Projections.Core/Services/Processing/{ProjectionSubscriptionBase.cs → ReaderSubscriptionBase.cs}
  193. +102 −7 src/EventStore/EventStore.Projections.Core/Services/Processing/ResolvedEvent.cs
  194. +8 −4 src/EventStore/EventStore.Projections.Core/Services/Processing/ResultWriter.cs
  195. +4 −2 src/EventStore/EventStore.Projections.Core/Services/Processing/SlaveResultWriter.cs
  196. +13 −0 src/EventStore/EventStore.Projections.Core/Services/Processing/SourceDefinitionBuilder.cs
  197. +1 −0 src/EventStore/EventStore.Projections.Core/Services/Processing/StatePartitionSelector.cs
  198. +6 −1 src/EventStore/EventStore.Projections.Core/Services/Processing/StreamEventFilter.cs
  199. +58 −25 src/EventStore/EventStore.Projections.Core/Services/Processing/StreamEventReader.cs
  200. +18 −1 src/EventStore/EventStore.Projections.Core/Services/Processing/StreamPositionTagger.cs
  201. +13 −3 src/EventStore/EventStore.Projections.Core/Services/Processing/TransactionFileEventFilter.cs
  202. +33 −34 src/EventStore/EventStore.Projections.Core/Services/Processing/TransactionFileEventReader.cs
  203. +12 −0 src/EventStore/EventStore.Projections.Core/Services/Processing/TransactionFilePositionTagger.cs
  204. +2 −1 .../EventStore.Projections.Core/Services/Processing/WriteQueryResultProjectionProcessingPhaseBase.cs
  205. +15 −0 src/EventStore/EventStore.Projections.Core/Services/v8/V8ProjectionStateHandler.cs
  206. +14 −2 src/EventStore/EventStore.Projections.Core/Standard/CategorizeEventsByStreamPath.cs
  207. +5 −0 src/EventStore/EventStore.Projections.Core/Standard/CategorizeStreamByPath.cs
  208. +21 −3 src/EventStore/EventStore.Projections.Core/Standard/IndexEventsByEventType.cs
  209. +5 −0 src/EventStore/EventStore.Projections.Core/Standard/IndexStreams.cs
  210. +100 −0 src/EventStore/EventStore.Projections.Core/Standard/StreamDeletedHelper.cs
  211. +5 −0 src/EventStore/EventStore.Projections.Core/Standard/StubHandler.cs
  212. +10 −23 ...ojections.Core/{Services/Processing/IndexedEventTypeEventFilter.cs → Utils/EncodingExtensions.cs}
  213. +0 −3 src/EventStore/EventStore.Projections.Core/Utils/EnumExtensions.cs
  214. +12 −0 src/EventStore/EventStore.Projections.Core/v8/QueryScript.cs
  215. +4 −0 src/EventStore/EventStore.Projections.v8Integration/EventStore.Projections.v8Integration.vcxproj
  216. +1 −1 src/EventStore/EventStore.SingleNode.Web/singlenode-web/js/es.debug.projection.js
  217. +5 −0 src/EventStore/EventStore.Web/Users/IndexUsersProjectionHandler.cs
  218. +5 −3 src/EventStore/Projections.Dev.WindowsOnly.sln
  219. +1 −0 src/ReformatOptions.DotSettings
View
2 src/EventStore/EventStore.ClientAPI/Common/SystemNames.cs
@@ -68,7 +68,7 @@ static class SystemMetadata
public const string SystemStreamAcl = "$systemStreamAcl";
}
- static class SystemEventTypes
+ public static class SystemEventTypes
{
public const string StreamDeleted = "$streamDeleted";
public const string StatsCollection = "$statsCollected";
View
5 src/EventStore/EventStore.ClientAPI/ProjectionsClient.cs
@@ -55,6 +55,11 @@ public Task Disable(IPEndPoint endPoint, string name, UserCredentials userCreden
return SendPost(endPoint.ToHttpUrl("/projection/{0}/command/disable", name), string.Empty, userCredentials, HttpStatusCode.OK);
}
+ public Task Abort(IPEndPoint endPoint, string name, UserCredentials userCredentials = null)
+ {
+ return SendPost(endPoint.ToHttpUrl("/projection/{0}/command/abort", name), string.Empty, userCredentials, HttpStatusCode.OK);
+ }
+
public Task CreateOneTime(IPEndPoint endPoint, string query, UserCredentials userCredentials = null)
{
return SendPost(endPoint.ToHttpUrl("/projections/onetime?type=JS"), query, userCredentials, HttpStatusCode.Created);
View
25 src/EventStore/EventStore.ClientAPI/ProjectionsManager.cs
@@ -90,7 +90,7 @@ public void Disable(string name, UserCredentials userCredentials = null)
}
/// <summary>
- /// Asynchronously disables a projection.
+ /// Asynchronously aborts and disables a projection without writing a checkpoint.
/// </summary>
/// <param name="name">The name of the projection.</param>
/// <param name="userCredentials">Credentials for a user with permission to disable a projection.</param>
@@ -102,6 +102,29 @@ public Task DisableAsync(string name, UserCredentials userCredentials = null)
}
/// <summary>
+ /// Synchronously avborts and disables a projection without writing a checkpoint.
+ /// </summary>
+ /// <param name="name">The name of the projection.</param>
+ /// <param name="userCredentials">Credentials for a user with permission to disable a projection.</param>
+ public void Abort(string name, UserCredentials userCredentials = null)
+ {
+ Ensure.NotNullOrEmpty(name, "name");
+ AbortAsync(name, userCredentials).Wait();
+ }
+
+ /// <summary>
+ /// Asynchronously disables a projection.
+ /// </summary>
+ /// <param name="name">The name of the projection.</param>
+ /// <param name="userCredentials">Credentials for a user with permission to disable a projection.</param>
+ /// <returns>A task representing the operation.</returns>
+ public Task AbortAsync(string name, UserCredentials userCredentials = null)
+ {
+ Ensure.NotNullOrEmpty(name, "name");
+ return _client.Abort(_httpEndPoint, name, userCredentials);
+ }
+
+ /// <summary>
/// Synchronously creates a one-time query.
/// </summary>
/// <param name="query">The JavaScript source code for the query.</param>
View
15 src/EventStore/EventStore.ClientAPI/RecordedEvent.cs
@@ -26,6 +26,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
using System;
+using System.Text;
using EventStore.ClientAPI.Messages;
namespace EventStore.ClientAPI
@@ -65,6 +66,20 @@ public class RecordedEvent
/// </summary>
public readonly byte[] Metadata;
+
+#if DEBUG
+ public string DebugDataView
+ {
+ get { return Encoding.UTF8.GetString(Data); }
+ }
+
+ public string DebugMetadataView
+ {
+ get { return Encoding.UTF8.GetString(Metadata); }
+ }
+#endif
+
+
internal RecordedEvent(ClientMessage.EventRecord systemRecord)
{
EventStreamId = systemRecord.EventStreamId;
View
2 src/EventStore/EventStore.ClientAPI/ResolvedEvent.cs
@@ -79,7 +79,7 @@ internal ResolvedEvent(ClientMessage.ResolvedEvent evnt)
internal ResolvedEvent(ClientMessage.ResolvedIndexedEvent evnt)
{
- Event = new RecordedEvent(evnt.Event);
+ Event = evnt.Event == null ? null : new RecordedEvent(evnt.Event);
Link = evnt.Link == null ? null : new RecordedEvent(evnt.Link);
OriginalPosition = null;
}
View
2 src/EventStore/EventStore.Core.Tests/ClientAPI/Helpers/TestEvent.cs
@@ -33,7 +33,7 @@
namespace EventStore.Core.Tests.ClientAPI.Helpers
{
- internal class TestEvent
+ public class TestEvent
{
public static EventData NewTestEvent(string data = null, string metadata = null)
{
View
62 src/EventStore/EventStore.Core.Tests/ClientAPI/SpecificationWithMiniNode.cs
@@ -0,0 +1,62 @@
+// Copyright (c) 2012, Event Store LLP
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// Neither the name of the Event Store LLP nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+
+using EventStore.ClientAPI;
+using EventStore.Core.Tests.ClientAPI.Helpers;
+using EventStore.Core.Tests.Helpers;
+using NUnit.Framework;
+
+namespace EventStore.Core.Tests.ClientAPI
+{
+ public abstract class SpecificationWithMiniNode : SpecificationWithDirectoryPerTestFixture
+ {
+ private MiniNode _node;
+ protected IEventStoreConnection _conn;
+
+ protected abstract void When();
+
+ [TestFixtureSetUp]
+ public override void TestFixtureSetUp()
+ {
+ base.TestFixtureSetUp();
+ _node = new MiniNode(PathName, skipInitializeStandardUsersCheck: false);
+ _node.Start();
+ _conn = TestConnection.Create(_node.TcpEndPoint);
+ _conn.Connect();
+ When();
+ }
+
+ [TestFixtureTearDown]
+ public override void TestFixtureTearDown()
+ {
+ _conn.Close();
+ _node.Shutdown();
+ base.TestFixtureTearDown();
+ }
+ }
+}
View
20 src/EventStore/EventStore.Core.Tests/ClientAPI/read_all_events_backward_should.cs
@@ -39,20 +39,12 @@
namespace EventStore.Core.Tests.ClientAPI
{
[TestFixture, Category("LongRunning")]
- public class read_all_events_backward_should: SpecificationWithDirectoryPerTestFixture
+ public class read_all_events_backward_should: SpecificationWithMiniNode
{
- private MiniNode _node;
- private IEventStoreConnection _conn;
private EventData[] _testEvents;
- [TestFixtureSetUp]
- public override void TestFixtureSetUp()
+ protected override void When()
{
- base.TestFixtureSetUp();
- _node = new MiniNode(PathName, skipInitializeStandardUsersCheck: false);
- _node.Start();
- _conn = TestConnection.Create(_node.TcpEndPoint);
- _conn.Connect();
_conn.SetStreamMetadata("$all", -1,
StreamMetadata.Build().SetReadRole(SystemRoles.All),
new UserCredentials(SystemUsers.Admin, SystemUsers.DefaultAdminPassword));
@@ -61,14 +53,6 @@ public override void TestFixtureSetUp()
_conn.AppendToStream("stream", ExpectedVersion.EmptyStream, _testEvents);
}
- [TestFixtureTearDown]
- public override void TestFixtureTearDown()
- {
- _conn.Close();
- _node.Shutdown();
- base.TestFixtureTearDown();
- }
-
[Test, Category("LongRunning")]
public void return_empty_slice_if_asked_to_read_from_start()
{
View
20 src/EventStore/EventStore.Core.Tests/ClientAPI/read_all_events_forward_should.cs
@@ -40,20 +40,12 @@
namespace EventStore.Core.Tests.ClientAPI
{
[TestFixture, Category("LongRunning")]
- public class read_all_events_forward_should: SpecificationWithDirectoryPerTestFixture
+ public class read_all_events_forward_should: SpecificationWithMiniNode
{
- private MiniNode _node;
- private IEventStoreConnection _conn;
private EventData[] _testEvents;
- [TestFixtureSetUp]
- public override void TestFixtureSetUp()
+ protected override void When()
{
- base.TestFixtureSetUp();
- _node = new MiniNode(PathName, skipInitializeStandardUsersCheck: false);
- _node.Start();
- _conn = TestConnection.Create(_node.TcpEndPoint);
- _conn.Connect();
_conn.SetStreamMetadata("$all", -1,
StreamMetadata.Build().SetReadRole(SystemRoles.All),
new UserCredentials(SystemUsers.Admin, SystemUsers.DefaultAdminPassword));
@@ -62,14 +54,6 @@ public override void TestFixtureSetUp()
_conn.AppendToStream("stream", ExpectedVersion.EmptyStream, _testEvents);
}
- [TestFixtureTearDown]
- public override void TestFixtureTearDown()
- {
- _conn.Close();
- _node.Shutdown();
- base.TestFixtureTearDown();
- }
-
[Test, Category("LongRunning")]
public void return_empty_slice_if_asked_to_read_from_end()
{
View
82 ...ventStore.Core.Tests/ClientAPI/read_all_events_forward_with_hard_deleted_stream_should.cs
@@ -0,0 +1,82 @@
+// Copyright (c) 2012, Event Store LLP
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// Neither the name of the Event Store LLP nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+
+using System.Linq;
+using EventStore.ClientAPI;
+using EventStore.ClientAPI.SystemData;
+using EventStore.Core.Data;
+using EventStore.Core.Services;
+using EventStore.Core.Tests.ClientAPI.Helpers;
+using EventStore.Core.Tests.Helpers;
+using NUnit.Framework;
+using ExpectedVersion = EventStore.ClientAPI.ExpectedVersion;
+using StreamMetadata = EventStore.ClientAPI.StreamMetadata;
+
+namespace EventStore.Core.Tests.ClientAPI
+{
+ [TestFixture, Category("LongRunning")]
+ public class read_all_events_forward_with_hard_deleted_stream_should : SpecificationWithMiniNode
+ {
+ private EventData[] _testEvents;
+
+ protected override void When()
+ {
+ _conn.SetStreamMetadata(
+ "$all", -1, StreamMetadata.Build().SetReadRole(SystemRoles.All),
+ new UserCredentials(SystemUsers.Admin, SystemUsers.DefaultAdminPassword));
+
+ _testEvents = Enumerable.Range(0, 20).Select(x => TestEvent.NewTestEvent(x.ToString())).ToArray();
+ _conn.AppendToStream("stream", ExpectedVersion.EmptyStream, _testEvents);
+ _conn.DeleteStream("stream", ExpectedVersion.Any, hardDelete: true);
+ }
+
+ [Test, Category("LongRunning")]
+ public void ensure_deleted_stream()
+ {
+ var res = _conn.ReadStreamEventsForward("stream", 0, 100, false);
+ Assert.AreEqual(SliceReadStatus.StreamDeleted, res.Status);
+ Assert.AreEqual(0, res.Events.Length);
+ }
+
+ [Test, Category("LongRunning")]
+ public void returns_all_events_including_tombstone()
+ {
+ AllEventsSlice read = _conn.ReadAllEventsForward(Position.Start, _testEvents.Length + 10, false);
+ Assert.That(
+ EventDataComparer.Equal(
+ _testEvents.ToArray(),
+ read.Events.Skip(read.Events.Length - _testEvents.Length - 1)
+ .Take(_testEvents.Length)
+ .Select(x => x.Event)
+ .ToArray()));
+ var lastEvent = read.Events.Last().Event;
+ Assert.AreEqual("stream", lastEvent.EventStreamId);
+ Assert.AreEqual(SystemEventTypes.StreamDeleted, lastEvent.EventType);
+ }
+ }
+}
View
84 ...ventStore.Core.Tests/ClientAPI/read_all_events_forward_with_soft_deleted_stream_should.cs
@@ -0,0 +1,84 @@
+// Copyright (c) 2012, Event Store LLP
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// Neither the name of the Event Store LLP nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+
+using System.Collections.Generic;
+using System.Linq;
+using EventStore.ClientAPI;
+using EventStore.ClientAPI.SystemData;
+using EventStore.Core.Data;
+using EventStore.Core.Services;
+using EventStore.Core.Tests.ClientAPI.Helpers;
+using NUnit.Framework;
+using ExpectedVersion = EventStore.ClientAPI.ExpectedVersion;
+using StreamMetadata = EventStore.ClientAPI.StreamMetadata;
+
+namespace EventStore.Core.Tests.ClientAPI
+{
+ [TestFixture, Category("LongRunning")]
+ public class read_all_events_forward_with_soft_deleted_stream_should : SpecificationWithMiniNode
+ {
+ private EventData[] _testEvents;
+
+ protected override void When()
+ {
+ _conn.SetStreamMetadata(
+ "$all", -1, StreamMetadata.Build().SetReadRole(SystemRoles.All),
+ new UserCredentials(SystemUsers.Admin, SystemUsers.DefaultAdminPassword));
+
+ _testEvents = Enumerable.Range(0, 20).Select(x => TestEvent.NewTestEvent(x.ToString())).ToArray();
+ _conn.AppendToStream("stream", ExpectedVersion.EmptyStream, _testEvents);
+ _conn.DeleteStream("stream", ExpectedVersion.Any);
+ }
+
+ [Test, Category("LongRunning")]
+ public void ensure_deleted_stream()
+ {
+ var res = _conn.ReadStreamEventsForward("stream", 0, 100, false);
+ Assert.AreEqual(SliceReadStatus.StreamNotFound, res.Status);
+ Assert.AreEqual(0, res.Events.Length);
+ }
+
+ [Test, Category("LongRunning")]
+ public void returns_all_events_including_tombstone()
+ {
+ AllEventsSlice read = _conn.ReadAllEventsForward(Position.Start, _testEvents.Length + 10, false);
+ Assert.That(
+ EventDataComparer.Equal(
+ _testEvents.ToArray(),
+ read.Events.Skip(read.Events.Length - _testEvents.Length - 1)
+ .Take(_testEvents.Length)
+ .Select(x => x.Event)
+ .ToArray()));
+ var lastEvent = read.Events.Last().Event;
+ Assert.AreEqual("$$stream", lastEvent.EventStreamId);
+ Assert.AreEqual(SystemEventTypes.StreamMetadata, lastEvent.EventType);
+ var metadata = StreamMetadata.FromJsonBytes(lastEvent.Data);
+ Assert.AreEqual(EventNumber.DeletedStream, metadata.TruncateBefore);
+ }
+ }
+}
View
22 src/EventStore/EventStore.Core.Tests/ClientAPI/read_event_should.cs
@@ -35,23 +35,13 @@
namespace EventStore.Core.Tests.ClientAPI
{
[TestFixture, Category("LongRunning")]
- public class read_event_should: SpecificationWithDirectoryPerTestFixture
+ public class read_event_should: SpecificationWithMiniNode
{
- private MiniNode _node;
- private IEventStoreConnection _conn;
private Guid _eventId0;
private Guid _eventId1;
- [TestFixtureSetUp]
- public override void TestFixtureSetUp()
+ protected override void When()
{
- base.TestFixtureSetUp();
- _node = new MiniNode(PathName);
- _node.Start();
-
- _conn = TestConnection.Create(_node.TcpEndPoint);
- _conn.Connect();
-
_eventId0 = Guid.NewGuid();
_eventId1 = Guid.NewGuid();
@@ -62,14 +52,6 @@ public override void TestFixtureSetUp()
_conn.DeleteStream("deleted-stream", -1, hardDelete: true);
}
- [TestFixtureTearDown]
- public override void TestFixtureTearDown()
- {
- _conn.Close();
- _node.Shutdown();
- base.TestFixtureTearDown();
- }
-
[Test, Category("Network")]
public void throw_if_stream_id_is_null()
{
View
81 src/EventStore/EventStore.Core.Tests/ClientAPI/read_stream_events_with_unresolved_linkto.cs
@@ -0,0 +1,81 @@
+// Copyright (c) 2012, Event Store LLP
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// Neither the name of the Event Store LLP nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+
+using System;
+using System.Linq;
+using System.Text;
+using EventStore.ClientAPI;
+using EventStore.ClientAPI.SystemData;
+using EventStore.Core.Data;
+using EventStore.Core.Services;
+using EventStore.Core.Tests.ClientAPI.Helpers;
+using NUnit.Framework;
+using ExpectedVersion = EventStore.ClientAPI.ExpectedVersion;
+using StreamMetadata = EventStore.ClientAPI.StreamMetadata;
+
+namespace EventStore.Core.Tests.ClientAPI
+{
+ [TestFixture, Category("LongRunning")]
+ public class read_stream_events_with_unresolved_linkto : SpecificationWithMiniNode
+ {
+ private EventData[] _testEvents;
+
+ protected override void When()
+ {
+ _conn.SetStreamMetadata(
+ "$all", -1, StreamMetadata.Build().SetReadRole(SystemRoles.All),
+ new UserCredentials(SystemUsers.Admin, SystemUsers.DefaultAdminPassword));
+
+ _testEvents = Enumerable.Range(0, 20).Select(x => TestEvent.NewTestEvent(x.ToString())).ToArray();
+ _conn.AppendToStream("stream", ExpectedVersion.EmptyStream, _testEvents);
+ _conn.AppendToStream(
+ "links", ExpectedVersion.EmptyStream,
+ new EventData(
+ Guid.NewGuid(), EventStore.ClientAPI.Common.SystemEventTypes.LinkTo, false,
+ Encoding.UTF8.GetBytes("0@stream"), null));
+ _conn.DeleteStream("stream", ExpectedVersion.Any);
+ }
+
+ [Test, Category("LongRunning")]
+ public void ensure_deleted_stream()
+ {
+ var res = _conn.ReadStreamEventsForward("stream", 0, 100, false);
+ Assert.AreEqual(SliceReadStatus.StreamNotFound, res.Status);
+ Assert.AreEqual(0, res.Events.Length);
+ }
+
+ [Test, Category("LongRunning")]
+ public void returns_unresolved_linkto()
+ {
+ var read = _conn.ReadStreamEventsForward("links", 0, 1, true);
+ Assert.AreEqual(1, read.Events.Length);
+ Assert.IsNull(read.Events[0].Event);
+ Assert.IsNotNull(read.Events[0].Link);
+ }
+ }
+}
View
178 src/EventStore/EventStore.Core.Tests/ClientAPI/when_having_truncatebefore_set_for_stream.cs
@@ -35,45 +35,27 @@
namespace EventStore.Core.Tests.ClientAPI
{
[TestFixture, Category("LongRunning")]
- public class when_having_truncatebefore_set_for_stream : SpecificationWithDirectoryPerTestFixture
+ public class when_having_truncatebefore_set_for_stream : SpecificationWithMiniNode
{
- private MiniNode _node;
- private IEventStoreConnection _connection;
private EventData[] _testEvents;
- [TestFixtureSetUp]
- public override void TestFixtureSetUp()
+ protected override void When()
{
- base.TestFixtureSetUp();
- _node = new MiniNode(PathName);
- _node.Start();
-
- _connection = TestConnection.Create(_node.TcpEndPoint);
- _connection.Connect();
-
_testEvents = Enumerable.Range(0, 5).Select(x => TestEvent.NewTestEvent(data: x.ToString())).ToArray();
}
- [TestFixtureTearDown]
- public override void TestFixtureTearDown()
- {
- _connection.Close();
- _node.Shutdown();
- base.TestFixtureTearDown();
- }
-
[Test, Category("LongRunning"), Category("Network")]
public void read_event_respects_truncatebefore()
{
const string stream = "read_event_respects_truncatebefore";
- _connection.AppendToStream(stream, ExpectedVersion.EmptyStream, _testEvents);
+ _conn.AppendToStream(stream, ExpectedVersion.EmptyStream, _testEvents);
- _connection.SetStreamMetadata(stream, ExpectedVersion.EmptyStream, StreamMetadata.Build().SetTruncateBefore(2));
+ _conn.SetStreamMetadata(stream, ExpectedVersion.EmptyStream, StreamMetadata.Build().SetTruncateBefore(2));
- var res = _connection.ReadEvent(stream, 1, false);
+ var res = _conn.ReadEvent(stream, 1, false);
Assert.AreEqual(EventReadStatus.NotFound, res.Status);
- res = _connection.ReadEvent(stream, 2, false);
+ res = _conn.ReadEvent(stream, 2, false);
Assert.AreEqual(EventReadStatus.Success, res.Status);
Assert.AreEqual(_testEvents[2].EventId, res.Event.Value.OriginalEvent.EventId);
}
@@ -82,11 +64,11 @@ public void read_event_respects_truncatebefore()
public void read_stream_forward_respects_truncatebefore()
{
const string stream = "read_stream_forward_respects_truncatebefore";
- _connection.AppendToStream(stream, ExpectedVersion.EmptyStream, _testEvents);
+ _conn.AppendToStream(stream, ExpectedVersion.EmptyStream, _testEvents);
- _connection.SetStreamMetadata(stream, ExpectedVersion.EmptyStream, StreamMetadata.Build().SetTruncateBefore(2));
+ _conn.SetStreamMetadata(stream, ExpectedVersion.EmptyStream, StreamMetadata.Build().SetTruncateBefore(2));
- var res = _connection.ReadStreamEventsForward(stream, 0, 100, false);
+ var res = _conn.ReadStreamEventsForward(stream, 0, 100, false);
Assert.AreEqual(SliceReadStatus.Success, res.Status);
Assert.AreEqual(3, res.Events.Length);
Assert.AreEqual(_testEvents.Skip(2).Select(x => x.EventId).ToArray(),
@@ -97,11 +79,11 @@ public void read_stream_forward_respects_truncatebefore()
public void read_stream_backward_respects_truncatebefore()
{
const string stream = "read_stream_backward_respects_truncatebefore";
- _connection.AppendToStream(stream, ExpectedVersion.EmptyStream, _testEvents);
+ _conn.AppendToStream(stream, ExpectedVersion.EmptyStream, _testEvents);
- _connection.SetStreamMetadata(stream, ExpectedVersion.EmptyStream, StreamMetadata.Build().SetTruncateBefore(2));
+ _conn.SetStreamMetadata(stream, ExpectedVersion.EmptyStream, StreamMetadata.Build().SetTruncateBefore(2));
- var res = _connection.ReadStreamEventsBackward(stream, -1, 100, false);
+ var res = _conn.ReadStreamEventsBackward(stream, -1, 100, false);
Assert.AreEqual(SliceReadStatus.Success, res.Status);
Assert.AreEqual(3, res.Events.Length);
Assert.AreEqual(_testEvents.Skip(2).Select(x => x.EventId).ToArray(),
@@ -113,23 +95,23 @@ public void after_setting_less_strict_truncatebefore_read_event_reads_more_event
{
const string stream = "after_setting_less_strict_truncatebefore_read_event_reads_more_events";
- _connection.AppendToStream(stream, ExpectedVersion.EmptyStream, _testEvents);
+ _conn.AppendToStream(stream, ExpectedVersion.EmptyStream, _testEvents);
- _connection.SetStreamMetadata(stream, ExpectedVersion.EmptyStream, StreamMetadata.Build().SetTruncateBefore(2));
+ _conn.SetStreamMetadata(stream, ExpectedVersion.EmptyStream, StreamMetadata.Build().SetTruncateBefore(2));
- var res = _connection.ReadEvent(stream, 1, false);
+ var res = _conn.ReadEvent(stream, 1, false);
Assert.AreEqual(EventReadStatus.NotFound, res.Status);
- res = _connection.ReadEvent(stream, 2, false);
+ res = _conn.ReadEvent(stream, 2, false);
Assert.AreEqual(EventReadStatus.Success, res.Status);
Assert.AreEqual(_testEvents[2].EventId, res.Event.Value.OriginalEvent.EventId);
- _connection.SetStreamMetadata(stream, 0, StreamMetadata.Build().SetTruncateBefore(1));
+ _conn.SetStreamMetadata(stream, 0, StreamMetadata.Build().SetTruncateBefore(1));
- res = _connection.ReadEvent(stream, 0, false);
+ res = _conn.ReadEvent(stream, 0, false);
Assert.AreEqual(EventReadStatus.NotFound, res.Status);
- res = _connection.ReadEvent(stream, 1, false);
+ res = _conn.ReadEvent(stream, 1, false);
Assert.AreEqual(EventReadStatus.Success, res.Status);
Assert.AreEqual(_testEvents[1].EventId, res.Event.Value.OriginalEvent.EventId);
}
@@ -139,23 +121,23 @@ public void after_setting_more_strict_truncatebefore_read_event_reads_less_event
{
const string stream = "after_setting_more_strict_truncatebefore_read_event_reads_less_events";
- _connection.AppendToStream(stream, ExpectedVersion.EmptyStream, _testEvents);
+ _conn.AppendToStream(stream, ExpectedVersion.EmptyStream, _testEvents);
- _connection.SetStreamMetadata(stream, ExpectedVersion.EmptyStream, StreamMetadata.Build().SetTruncateBefore(2));
+ _conn.SetStreamMetadata(stream, ExpectedVersion.EmptyStream, StreamMetadata.Build().SetTruncateBefore(2));
- var res = _connection.ReadEvent(stream, 1, false);
+ var res = _conn.ReadEvent(stream, 1, false);
Assert.AreEqual(EventReadStatus.NotFound, res.Status);
- res = _connection.ReadEvent(stream, 2, false);
+ res = _conn.ReadEvent(stream, 2, false);
Assert.AreEqual(EventReadStatus.Success, res.Status);
Assert.AreEqual(_testEvents[2].EventId, res.Event.Value.OriginalEvent.EventId);
- _connection.SetStreamMetadata(stream, 0, StreamMetadata.Build().SetTruncateBefore(3));
+ _conn.SetStreamMetadata(stream, 0, StreamMetadata.Build().SetTruncateBefore(3));
- res = _connection.ReadEvent(stream, 2, false);
+ res = _conn.ReadEvent(stream, 2, false);
Assert.AreEqual(EventReadStatus.NotFound, res.Status);
- res = _connection.ReadEvent(stream, 3, false);
+ res = _conn.ReadEvent(stream, 3, false);
Assert.AreEqual(EventReadStatus.Success, res.Status);
Assert.AreEqual(_testEvents[3].EventId, res.Event.Value.OriginalEvent.EventId);
}
@@ -165,23 +147,23 @@ public void less_strict_max_count_doesnt_change_anything_for_event_read()
{
const string stream = "less_strict_max_count_doesnt_change_anything_for_event_read";
- _connection.AppendToStream(stream, ExpectedVersion.EmptyStream, _testEvents);
+ _conn.AppendToStream(stream, ExpectedVersion.EmptyStream, _testEvents);
- _connection.SetStreamMetadata(stream, ExpectedVersion.EmptyStream, StreamMetadata.Build().SetTruncateBefore(2));
+ _conn.SetStreamMetadata(stream, ExpectedVersion.EmptyStream, StreamMetadata.Build().SetTruncateBefore(2));
- var res = _connection.ReadEvent(stream, 1, false);
+ var res = _conn.ReadEvent(stream, 1, false);
Assert.AreEqual(EventReadStatus.NotFound, res.Status);
- res = _connection.ReadEvent(stream, 2, false);
+ res = _conn.ReadEvent(stream, 2, false);
Assert.AreEqual(EventReadStatus.Success, res.Status);
Assert.AreEqual(_testEvents[2].EventId, res.Event.Value.OriginalEvent.EventId);
- _connection.SetStreamMetadata(stream, 0, StreamMetadata.Build().SetTruncateBefore(2).SetMaxCount(4));
+ _conn.SetStreamMetadata(stream, 0, StreamMetadata.Build().SetTruncateBefore(2).SetMaxCount(4));
- res = _connection.ReadEvent(stream, 1, false);
+ res = _conn.ReadEvent(stream, 1, false);
Assert.AreEqual(EventReadStatus.NotFound, res.Status);
- res = _connection.ReadEvent(stream, 2, false);
+ res = _conn.ReadEvent(stream, 2, false);
Assert.AreEqual(EventReadStatus.Success, res.Status);
Assert.AreEqual(_testEvents[2].EventId, res.Event.Value.OriginalEvent.EventId);
}
@@ -191,23 +173,23 @@ public void more_strict_max_count_gives_less_events_for_event_read()
{
const string stream = "more_strict_max_count_gives_less_events_for_event_read";
- _connection.AppendToStream(stream, ExpectedVersion.EmptyStream, _testEvents);
+ _conn.AppendToStream(stream, ExpectedVersion.EmptyStream, _testEvents);
- _connection.SetStreamMetadata(stream, ExpectedVersion.EmptyStream, StreamMetadata.Build().SetTruncateBefore(2));
+ _conn.SetStreamMetadata(stream, ExpectedVersion.EmptyStream, StreamMetadata.Build().SetTruncateBefore(2));
- var res = _connection.ReadEvent(stream, 1, false);
+ var res = _conn.ReadEvent(stream, 1, false);
Assert.AreEqual(EventReadStatus.NotFound, res.Status);
- res = _connection.ReadEvent(stream, 2, false);
+ res = _conn.ReadEvent(stream, 2, false);
Assert.AreEqual(EventReadStatus.Success, res.Status);
Assert.AreEqual(_testEvents[2].EventId, res.Event.Value.OriginalEvent.EventId);
- _connection.SetStreamMetadata(stream, 0, StreamMetadata.Build().SetTruncateBefore(2).SetMaxCount(2));
+ _conn.SetStreamMetadata(stream, 0, StreamMetadata.Build().SetTruncateBefore(2).SetMaxCount(2));
- res = _connection.ReadEvent(stream, 2, false);
+ res = _conn.ReadEvent(stream, 2, false);
Assert.AreEqual(EventReadStatus.NotFound, res.Status);
- res = _connection.ReadEvent(stream, 3, false);
+ res = _conn.ReadEvent(stream, 3, false);
Assert.AreEqual(EventReadStatus.Success, res.Status);
Assert.AreEqual(_testEvents[3].EventId, res.Event.Value.OriginalEvent.EventId);
}
@@ -218,19 +200,19 @@ public void after_setting_less_strict_truncatebefore_read_stream_forward_reads_m
{
const string stream = "after_setting_less_strict_truncatebefore_read_stream_forward_reads_more_events";
- _connection.AppendToStream(stream, ExpectedVersion.EmptyStream, _testEvents);
+ _conn.AppendToStream(stream, ExpectedVersion.EmptyStream, _testEvents);
- _connection.SetStreamMetadata(stream, ExpectedVersion.EmptyStream, StreamMetadata.Build().SetTruncateBefore(2));
+ _conn.SetStreamMetadata(stream, ExpectedVersion.EmptyStream, StreamMetadata.Build().SetTruncateBefore(2));
- var res = _connection.ReadStreamEventsForward(stream, 0, 100, false);
+ var res = _conn.ReadStreamEventsForward(stream, 0, 100, false);
Assert.AreEqual(SliceReadStatus.Success, res.Status);
Assert.AreEqual(3, res.Events.Length);
Assert.AreEqual(_testEvents.Skip(2).Select(x => x.EventId).ToArray(),
res.Events.Select(x => x.Event.EventId).ToArray());
- _connection.SetStreamMetadata(stream, 0, StreamMetadata.Build().SetTruncateBefore(1));
+ _conn.SetStreamMetadata(stream, 0, StreamMetadata.Build().SetTruncateBefore(1));
- res = _connection.ReadStreamEventsForward(stream, 0, 100, false);
+ res = _conn.ReadStreamEventsForward(stream, 0, 100, false);
Assert.AreEqual(SliceReadStatus.Success, res.Status);
Assert.AreEqual(4, res.Events.Length);
Assert.AreEqual(_testEvents.Skip(1).Select(x => x.EventId).ToArray(),
@@ -242,19 +224,19 @@ public void after_setting_more_strict_truncatebefore_read_stream_forward_reads_l
{
const string stream = "after_setting_more_strict_truncatebefore_read_stream_forward_reads_less_events";
- _connection.AppendToStream(stream, ExpectedVersion.EmptyStream, _testEvents);
+ _conn.AppendToStream(stream, ExpectedVersion.EmptyStream, _testEvents);
- _connection.SetStreamMetadata(stream, ExpectedVersion.EmptyStream, StreamMetadata.Build().SetTruncateBefore(2));
+ _conn.SetStreamMetadata(stream, ExpectedVersion.EmptyStream, StreamMetadata.Build().SetTruncateBefore(2));
- var res = _connection.ReadStreamEventsForward(stream, 0, 100, false);
+ var res = _conn.ReadStreamEventsForward(stream, 0, 100, false);
Assert.AreEqual(SliceReadStatus.Success, res.Status);
Assert.AreEqual(3, res.Events.Length);
Assert.AreEqual(_testEvents.Skip(2).Select(x => x.EventId).ToArray(),
res.Events.Select(x => x.Event.EventId).ToArray());
- _connection.SetStreamMetadata(stream, 0, StreamMetadata.Build().SetTruncateBefore(3));
+ _conn.SetStreamMetadata(stream, 0, StreamMetadata.Build().SetTruncateBefore(3));
- res = _connection.ReadStreamEventsForward(stream, 0, 100, false);
+ res = _conn.ReadStreamEventsForward(stream, 0, 100, false);
Assert.AreEqual(SliceReadStatus.Success, res.Status);
Assert.AreEqual(2, res.Events.Length);
Assert.AreEqual(_testEvents.Skip(3).Select(x => x.EventId).ToArray(),
@@ -266,19 +248,19 @@ public void less_strict_max_count_doesnt_change_anything_for_stream_forward_read
{
const string stream = "less_strict_max_count_doesnt_change_anything_for_stream_forward_read";
- _connection.AppendToStream(stream, ExpectedVersion.EmptyStream, _testEvents);
+ _conn.AppendToStream(stream, ExpectedVersion.EmptyStream, _testEvents);
- _connection.SetStreamMetadata(stream, ExpectedVersion.EmptyStream, StreamMetadata.Build().SetTruncateBefore(2));
+ _conn.SetStreamMetadata(stream, ExpectedVersion.EmptyStream, StreamMetadata.Build().SetTruncateBefore(2));
- var res = _connection.ReadStreamEventsForward(stream, 0, 100, false);
+ var res = _conn.ReadStreamEventsForward(stream, 0, 100, false);
Assert.AreEqual(SliceReadStatus.Success, res.Status);
Assert.AreEqual(3, res.Events.Length);
Assert.AreEqual(_testEvents.Skip(2).Select(x => x.EventId).ToArray(),
res.Events.Select(x => x.Event.EventId).ToArray());
- _connection.SetStreamMetadata(stream, 0, StreamMetadata.Build().SetTruncateBefore(2).SetMaxCount(4));
+ _conn.SetStreamMetadata(stream, 0, StreamMetadata.Build().SetTruncateBefore(2).SetMaxCount(4));
- res = _connection.ReadStreamEventsForward(stream, 0, 100, false);
+ res = _conn.ReadStreamEventsForward(stream, 0, 100, false);
Assert.AreEqual(SliceReadStatus.Success, res.Status);
Assert.AreEqual(3, res.Events.Length);
Assert.AreEqual(_testEvents.Skip(2).Select(x => x.EventId).ToArray(),
@@ -290,19 +272,19 @@ public void more_strict_max_count_gives_less_events_for_stream_forward_read()
{
const string stream = "more_strict_max_count_gives_less_events_for_stream_forward_read";
- _connection.AppendToStream(stream, ExpectedVersion.EmptyStream, _testEvents);
+ _conn.AppendToStream(stream, ExpectedVersion.EmptyStream, _testEvents);
- _connection.SetStreamMetadata(stream, ExpectedVersion.EmptyStream, StreamMetadata.Build().SetTruncateBefore(2));
+ _conn.SetStreamMetadata(stream, ExpectedVersion.EmptyStream, StreamMetadata.Build().SetTruncateBefore(2));
- var res = _connection.ReadStreamEventsForward(stream, 0, 100, false);
+ var res = _conn.ReadStreamEventsForward(stream, 0, 100, false);
Assert.AreEqual(SliceReadStatus.Success, res.Status);
Assert.AreEqual(3, res.Events.Length);
Assert.AreEqual(_testEvents.Skip(2).Select(x => x.EventId).ToArray(),
res.Events.Select(x => x.Event.EventId).ToArray());
- _connection.SetStreamMetadata(stream, 0, StreamMetadata.Build().SetTruncateBefore(2).SetMaxCount(2));
+ _conn.SetStreamMetadata(stream, 0, StreamMetadata.Build().SetTruncateBefore(2).SetMaxCount(2));
- res = _connection.ReadStreamEventsForward(stream, 0, 100, false);
+ res = _conn.ReadStreamEventsForward(stream, 0, 100, false);
Assert.AreEqual(SliceReadStatus.Success, res.Status);
Assert.AreEqual(2, res.Events.Length);
Assert.AreEqual(_testEvents.Skip(3).Select(x => x.EventId).ToArray(),
@@ -314,19 +296,19 @@ public void after_setting_less_strict_truncatebefore_read_stream_backward_reads_
{
const string stream = "after_setting_less_strict_truncatebefore_read_stream_backward_reads_more_events";
- _connection.AppendToStream(stream, ExpectedVersion.EmptyStream, _testEvents);
+ _conn.AppendToStream(stream, ExpectedVersion.EmptyStream, _testEvents);
- _connection.SetStreamMetadata(stream, ExpectedVersion.EmptyStream, StreamMetadata.Build().SetTruncateBefore(2));
+ _conn.SetStreamMetadata(stream, ExpectedVersion.EmptyStream, StreamMetadata.Build().SetTruncateBefore(2));
- var res = _connection.ReadStreamEventsBackward(stream, -1, 100, false);
+ var res = _conn.ReadStreamEventsBackward(stream, -1, 100, false);
Assert.AreEqual(SliceReadStatus.Success, res.Status);
Assert.AreEqual(3, res.Events.Length);
Assert.AreEqual(_testEvents.Skip(2).Select(x => x.EventId).ToArray(),
res.Events.Reverse().Select(x => x.Event.EventId).ToArray());
- _connection.SetStreamMetadata(stream, 0, StreamMetadata.Build().SetTruncateBefore(1));
+ _conn.SetStreamMetadata(stream, 0, StreamMetadata.Build().SetTruncateBefore(1));
- res = _connection.ReadStreamEventsBackward(stream, -1, 100, false);
+ res = _conn.ReadStreamEventsBackward(stream, -1, 100, false);
Assert.AreEqual(SliceReadStatus.Success, res.Status);
Assert.AreEqual(4, res.Events.Length);
Assert.AreEqual(_testEvents.Skip(1).Select(x => x.EventId).ToArray(),
@@ -338,19 +320,19 @@ public void after_setting_more_strict_truncatebefore_read_stream_backward_reads_
{
const string stream = "after_setting_more_strict_truncatebefore_read_stream_backward_reads_less_events";
- _connection.AppendToStream(stream, ExpectedVersion.EmptyStream, _testEvents);
+ _conn.AppendToStream(stream, ExpectedVersion.EmptyStream, _testEvents);
- _connection.SetStreamMetadata(stream, ExpectedVersion.EmptyStream, StreamMetadata.Build().SetTruncateBefore(2));
+ _conn.SetStreamMetadata(stream, ExpectedVersion.EmptyStream, StreamMetadata.Build().SetTruncateBefore(2));
- var res = _connection.ReadStreamEventsBackward(stream, -1, 100, false);
+ var res = _conn.ReadStreamEventsBackward(stream, -1, 100, false);
Assert.AreEqual(SliceReadStatus.Success, res.Status);
Assert.AreEqual(3, res.Events.Length);
Assert.AreEqual(_testEvents.Skip(2).Select(x => x.EventId).ToArray(),
res.Events.Reverse().Select(x => x.Event.EventId).ToArray());
- _connection.SetStreamMetadata(stream, 0, StreamMetadata.Build().SetTruncateBefore(3));
+ _conn.SetStreamMetadata(stream, 0, StreamMetadata.Build().SetTruncateBefore(3));
- res = _connection.ReadStreamEventsBackward(stream, -1, 100, false);
+ res = _conn.ReadStreamEventsBackward(stream, -1, 100, false);
Assert.AreEqual(SliceReadStatus.Success, res.Status);
Assert.AreEqual(2, res.Events.Length);
Assert.AreEqual(_testEvents.Skip(3).Select(x => x.EventId).ToArray(),
@@ -362,19 +344,19 @@ public void less_strict_max_count_doesnt_change_anything_for_stream_backward_rea
{
const string stream = "less_strict_max_count_doesnt_change_anything_for_stream_backward_read";
- _connection.AppendToStream(stream, ExpectedVersion.EmptyStream, _testEvents);
+ _conn.AppendToStream(stream, ExpectedVersion.EmptyStream, _testEvents);
- _connection.SetStreamMetadata(stream, ExpectedVersion.EmptyStream, StreamMetadata.Build().SetTruncateBefore(2));
+ _conn.SetStreamMetadata(stream, ExpectedVersion.EmptyStream, StreamMetadata.Build().SetTruncateBefore(2));
- var res = _connection.ReadStreamEventsBackward(stream, -1, 100, false);
+ var res = _conn.ReadStreamEventsBackward(stream, -1, 100, false);
Assert.AreEqual(SliceReadStatus.Success, res.Status);
Assert.AreEqual(3, res.Events.Length);
Assert.AreEqual(_testEvents.Skip(2).Select(x => x.EventId).ToArray(),
res.Events.Reverse().Select(x => x.Event.EventId).ToArray());
- _connection.SetStreamMetadata(stream, 0, StreamMetadata.Build().SetTruncateBefore(2).SetMaxCount(4));
+ _conn.SetStreamMetadata(stream, 0, StreamMetadata.Build().SetTruncateBefore(2).SetMaxCount(4));
- res = _connection.ReadStreamEventsBackward(stream, -1, 100, false);
+ res = _conn.ReadStreamEventsBackward(stream, -1, 100, false);
Assert.AreEqual(SliceReadStatus.Success, res.Status);
Assert.AreEqual(3, res.Events.Length);
Assert.AreEqual(_testEvents.Skip(2).Select(x => x.EventId).ToArray(),
@@ -386,19 +368,19 @@ public void more_strict_max_count_gives_less_events_for_stream_backward_read()
{
const string stream = "more_strict_max_count_gives_less_events_for_stream_backward_read";
- _connection.AppendToStream(stream, ExpectedVersion.EmptyStream, _testEvents);
+ _conn.AppendToStream(stream, ExpectedVersion.EmptyStream, _testEvents);
- _connection.SetStreamMetadata(stream, ExpectedVersion.EmptyStream, StreamMetadata.Build().SetTruncateBefore(2));
+ _conn.SetStreamMetadata(stream, ExpectedVersion.EmptyStream, StreamMetadata.Build().SetTruncateBefore(2));
- var res = _connection.ReadStreamEventsBackward(stream, -1, 100, false);
+ var res = _conn.ReadStreamEventsBackward(stream, -1, 100, false);
Assert.AreEqual(SliceReadStatus.Success, res.Status);
Assert.AreEqual(3, res.Events.Length);
Assert.AreEqual(_testEvents.Skip(2).Select(x => x.EventId).ToArray(),
res.Events.Reverse().Select(x => x.Event.EventId).ToArray());
- _connection.SetStreamMetadata(stream, 0, StreamMetadata.Build().SetTruncateBefore(2).SetMaxCount(2));
+ _conn.SetStreamMetadata(stream, 0, StreamMetadata.Build().SetTruncateBefore(2).SetMaxCount(2));
- res = _connection.ReadStreamEventsBackward(stream, -1, 100, false);
+ res = _conn.ReadStreamEventsBackward(stream, -1, 100, false);
Assert.AreEqual(SliceReadStatus.Success, res.Status);
Assert.AreEqual(2, res.Events.Length);
Assert.AreEqual(_testEvents.Skip(3).Select(x => x.EventId).ToArray(),
View
4 src/EventStore/EventStore.Core.Tests/EventStore.Core.Tests.csproj
@@ -89,13 +89,17 @@
<Compile Include="Bus\when_unsubscribing_from_memory_bus.cs" />
<Compile Include="ClientAPI\appending_to_implicitly_created_stream.cs" />
<Compile Include="ClientAPI\appending_to_implicitly_created_stream_using_transaction.cs" />
+ <Compile Include="ClientAPI\read_all_events_forward_with_hard_deleted_stream_should.cs" />
+ <Compile Include="ClientAPI\read_all_events_forward_with_soft_deleted_stream_should.cs" />
+ <Compile Include="ClientAPI\read_stream_events_with_unresolved_linkto.cs" />
<Compile Include="ClientAPI\soft_delete.cs" />
<Compile Include="ClientAPI\Security\multiple_role_security.cs" />
<Compile Include="ClientAPI\Security\stream_security_inheritance.cs" />
<Compile Include="ClientAPI\Security\overriden_system_stream_security_for_all.cs" />
<Compile Include="ClientAPI\Security\overriden_user_stream_security.cs" />
<Compile Include="ClientAPI\Security\overriden_system_stream_security.cs" />
<Compile Include="ClientAPI\append_to_stream.cs" />
+ <Compile Include="ClientAPI\SpecificationWithMiniNode.cs" />
<Compile Include="ClientAPI\when_having_truncatebefore_set_for_stream.cs" />
<Compile Include="ClientAPI\connect.cs" />
<Compile Include="ClientAPI\read_event_should.cs" />
View
29 src/EventStore/EventStore.Core.Tests/Helpers/ManualQueue.cs
@@ -39,12 +39,14 @@ public class ManualQueue : IPublisher, IHandle<TimerMessage.Schedule>
{
private readonly Queue<Message> _queue = new Queue<Message>();
private readonly IBus _bus;
- private readonly List<TimerMessage.Schedule> _timerQueue = new List<TimerMessage.Schedule>();
+ private readonly ITimeProvider _time;
+ private readonly List<InternalSchedule> _timerQueue = new List<InternalSchedule>();
private bool _timerDisabled;
- public ManualQueue(IBus bus)
+ public ManualQueue(IBus bus, ITimeProvider time)
{
_bus = bus;
+ _time = time;
_bus.Subscribe(this);
}
@@ -77,10 +79,15 @@ public void ProcessTimer()
{
if (!_timerDisabled)
{
- var orderedTimerMessages = _timerQueue.OrderBy(v => v.TriggerAfter).ToArray();
+ var orderedTimerMessages = _timerQueue.OrderBy(v => v.Scheduled.Add(v.Message.TriggerAfter)).ToArray();
_timerQueue.Clear();
foreach (var timerMessage in orderedTimerMessages)
- timerMessage.Reply();
+ {
+ if (timerMessage.Scheduled.Add(timerMessage.Message.TriggerAfter) <= _time.Now)
+ timerMessage.Message.Reply();
+ else
+ _timerQueue.Add(timerMessage);
+ }
}
}
@@ -96,9 +103,21 @@ public void EnableTimer(bool process = true)
Process();
}
+ private class InternalSchedule
+ {
+ public readonly TimerMessage.Schedule Message;
+ public readonly DateTime Scheduled;
+
+ public InternalSchedule(TimerMessage.Schedule message, DateTime scheduled)
+ {
+ Message = message;
+ Scheduled = scheduled;
+ }
+ }
+
public void Handle(TimerMessage.Schedule message)
{
- _timerQueue.Add(message);
+ _timerQueue.Add(new InternalSchedule(message, _time.Now));
}
}
}
View
91 src/EventStore/EventStore.Core.Tests/Helpers/TestFixtureWithExistingEvents.cs
@@ -28,6 +28,7 @@
using System;
using System.Collections.Generic;
+using System.Diagnostics;
using System.Linq;
using System.Text;
using EventStore.Common.Utils;
@@ -93,7 +94,7 @@ public void Commit(ClientMessage.TransactionCommit message, TestFixtureWithExist
protected TestHandler<ClientMessage.ReadStreamEventsBackward> _listEventsHandler;
- protected readonly Dictionary<string, List<EventRecord>> _lastMessageReplies =
+ protected readonly Dictionary<string, List<EventRecord>> _streams =
new Dictionary<string, List<EventRecord>>();
protected readonly SortedList<TFPos, EventRecord> _all = new SortedList<TFPos, EventRecord>();
@@ -119,10 +120,10 @@ protected TFPos ExistingStreamMetadata(string streamId, string metadata)
protected TFPos ExistingEvent(string streamId, string eventType, string eventMetadata, string eventData, bool isJson = false)
{
List<EventRecord> list;
- if (!_lastMessageReplies.TryGetValue(streamId, out list) || list == null)
+ if (!_streams.TryGetValue(streamId, out list) || list == null)
{
list = new List<EventRecord>();
- _lastMessageReplies[streamId] = list;
+ _streams[streamId] = list;
}
var eventRecord = new EventRecord(
list.Count,
@@ -146,7 +147,7 @@ protected void EnableReadAll()
protected void NoStream(string streamId)
{
- _lastMessageReplies[streamId] = null;
+ _streams[streamId] = null;
}
protected void NoOtherStreams()
@@ -157,6 +158,12 @@ protected void NoOtherStreams()
protected void DeletedStream(string streamId)
{
_deletedStreams.Add(streamId);
+ ExistingStreamMetadata(streamId, CreateStreamDeletedEventJson());
+ }
+
+ private static string CreateStreamDeletedEventJson()
+ {
+ return new StreamMetadata(null, null, EventNumber.DeletedStream, null, null, null).ToJsonString();
}
protected void AllWritesSucceed()
@@ -207,7 +214,7 @@ public void setup1()
_bus.Subscribe(_readDispatcher);
_bus.Subscribe(_writeDispatcher);
_bus.Subscribe(_ioDispatcher.StreamDeleter);
- _lastMessageReplies.Clear();
+ _streams.Clear();
_deletedStreams.Clear();
_all.Clear();
_readAllEnabled = false;
@@ -236,7 +243,7 @@ void IHandle<ClientMessage.ReadStreamEventsBackward>.Handle(ClientMessage.ReadSt
ReadStreamResult.StreamDeleted, new ResolvedEvent[0], null, false, string.Empty, -1, EventNumber.DeletedStream, true, _fakePosition));
}
- else if (_lastMessageReplies.TryGetValue(message.EventStreamId, out list) || _noOtherStreams)
+ else if (_streams.TryGetValue(message.EventStreamId, out list) || _noOtherStreams)
{
if (list != null && list.Count > 0 && (list.Last().EventNumber >= message.FromEventNumber)
|| (message.FromEventNumber == -1))
@@ -301,7 +308,7 @@ public void Handle(ClientMessage.ReadStreamEventsForward message)
ReadStreamResult.StreamDeleted, new ResolvedEvent[0], null, false, string.Empty, -1, EventNumber.DeletedStream, true, _fakePosition));
}
- else if (_lastMessageReplies.TryGetValue(message.EventStreamId, out list) || _noOtherStreams)
+ else if (_streams.TryGetValue(message.EventStreamId, out list) || _noOtherStreams)
{
if (list != null && list.Count > 0 && message.FromEventNumber >= 0)
{
@@ -356,7 +363,9 @@ private ResolvedEvent BuildEvent(EventRecord x, bool resolveLinks)
if (x.EventType == "$>" && resolveLinks)
{
var parts = Helper.UTF8NoBom.GetString(x.Data).Split(_linkToSeparator, 2);
- var list = _lastMessageReplies[parts[1]];
+ List<EventRecord> list;
+ if (_deletedStreams.Contains(parts[1]) || !_streams.TryGetValue(parts[1], out list))
+ return new ResolvedEvent(x, null);
var eventNumber = int.Parse(parts[0]);
var target = list[eventNumber];
@@ -371,7 +380,7 @@ private ResolvedEvent BuildEvent(EventRecord x, bool resolveLinks, long commitPo
if (x.EventType == "$>" && resolveLinks)
{
var parts = Helper.UTF8NoBom.GetString(x.Data).Split(_linkToSeparator, 2);
- var list = _lastMessageReplies[parts[1]];
+ var list = _streams[parts[1]];
var eventNumber = int.Parse(parts[0]);
var target = list[eventNumber];
@@ -409,10 +418,10 @@ public void Handle(ClientMessage.WriteEvents message)
}
}
List<EventRecord> list;
- if (!_lastMessageReplies.TryGetValue(streamId, out list) || list == null)
+ if (!_streams.TryGetValue(streamId, out list) || list == null)
{
list = new List<EventRecord>();
- _lastMessageReplies[streamId] = list;
+ _streams[streamId] = list;
}
if (expectedVersion != EventStore.ClientAPI.ExpectedVersion.Any)
{
@@ -441,11 +450,14 @@ public void Handle(ClientMessage.WriteEvents message)
foreach (var eventRecord in eventRecords)
{
list.Add(eventRecord.record);
- _all.Add(new TFPos(commitPosition ?? eventRecord.position + 50, eventRecord.position), eventRecord.record);
+ var tfPos = new TFPos(commitPosition ?? eventRecord.position + 50, eventRecord.position);
+ _all.Add(tfPos, eventRecord.record);
+ _bus.Publish(new StorageMessage.EventCommited(tfPos.CommitPosition, eventRecord.record));
}
var firstEventNumber = list.Count - events.Length;
- envelope.ReplyWith(writeEventsCompleted(firstEventNumber, firstEventNumber + events.Length - 1));
+ if (envelope != null)
+ envelope.ReplyWith(writeEventsCompleted(firstEventNumber, firstEventNumber + events.Length - 1));
}
public void Handle(ClientMessage.DeleteStream message)
@@ -456,13 +468,20 @@ public void Handle(ClientMessage.DeleteStream message)
message.Envelope.ReplyWith(new ClientMessage.DeleteStreamCompleted(message.CorrelationId, OperationResult.StreamDeleted, string.Empty));
return;
}
- if (!_lastMessageReplies.TryGetValue(message.EventStreamId, out list) || list == null)
+ if (!_streams.TryGetValue(message.EventStreamId, out list) || list == null)
{
message.Envelope.ReplyWith(new ClientMessage.DeleteStreamCompleted(message.CorrelationId, OperationResult.WrongExpectedVersion, string.Empty));
return;
}
_deletedStreams.Add(message.EventStreamId);
- message.Envelope.ReplyWith(new ClientMessage.DeleteStreamCompleted(message.CorrelationId, OperationResult.Success, string.Empty));
+
+ ProcessWrite<Message>(
+ null, message.CorrelationId, SystemStreams.MetastreamOf(message.EventStreamId), ExpectedVersion.Any,
+ new Event[]
+ {new Event(Guid.NewGuid(), SystemEventTypes.StreamMetadata, true, CreateStreamDeletedEventJson(), null)},
+ null, null);
+
+ message.Envelope.ReplyWith(new ClientMessage.DeleteStreamCompleted(message.CorrelationId, OperationResult.Success, string.Empty));
}
public void Handle(ClientMessage.ReadAllEventsForward message)
@@ -539,7 +558,7 @@ public void AssertLastEvent(string streamId, string data, string message = null,
{
message = message ?? string.Format("Invalid last event in the '{0}' stream. ", streamId);
List<EventRecord> events;
- Assert.That(_lastMessageReplies.TryGetValue(streamId, out events), message + "The stream does not exist.");
+ Assert.That(_streams.TryGetValue(streamId, out events), message + "The stream does not exist.");
events = events.Take(events.Count - skip).ToList();
Assert.IsNotEmpty(events, message + "The stream is empty.");
var last = events[events.Count - 1];
@@ -550,7 +569,7 @@ public void AssertStreamTail(string streamId, params string[] data)
{
var message = string.Format("Invalid events in the '{0}' stream. ", streamId);
List<EventRecord> events;
- Assert.That(_lastMessageReplies.TryGetValue(streamId, out events), message + "The stream does not exist.");
+ Assert.That(_streams.TryGetValue(streamId, out events), message + "The stream does not exist.");
var eventsText = events.Skip(events.Count - data.Length).Select(v => Encoding.UTF8.GetString(v.Data)).ToList();
if (data.Length > 0)
Assert.IsNotEmpty(events, message + "The stream is empty.");
@@ -566,7 +585,7 @@ public void AssertStreamTailWithLinks(string streamId, params string[] data)
{
var message = string.Format("Invalid events in the '{0}' stream. ", streamId);
List<EventRecord> events;
- Assert.That(_lastMessageReplies.TryGetValue(streamId, out events), message + "The stream does not exist.");
+ Assert.That(_streams.TryGetValue(streamId, out events), message + "The stream does not exist.");
var eventsText =
events.Skip(events.Count - data.Length)
.Select(v => new {Text = Encoding.UTF8.GetString(v.Data), EventType = v.EventType})
@@ -590,15 +609,15 @@ private string ResolveEventText(string link)
{
var stream = SystemEventTypes.StreamReferenceEventToStreamId(SystemEventTypes.LinkTo, link);
var eventNumber = SystemEventTypes.EventLinkToEventNumber(link);
- return _lastMessageReplies[stream][eventNumber].EventType + ":"
- + Encoding.UTF8.GetString(_lastMessageReplies[stream][eventNumber].Data);
+ return _streams[stream][eventNumber].EventType + ":"
+ + Encoding.UTF8.GetString(_streams[stream][eventNumber].Data);
}
public void AssertStreamContains(string streamId, params string[] data)
{
var message = string.Format("Invalid events in the '{0}' stream. ", streamId);
List<EventRecord> events;
- Assert.That(_lastMessageReplies.TryGetValue(streamId, out events), message + "The stream does not exist.");
+ Assert.That(_streams.TryGetValue(streamId, out events), message + "The stream does not exist.");
if (data.Length > 0)
Assert.IsNotEmpty(events, message + "The stream is empty.");
@@ -622,9 +641,37 @@ public void AssertEmptyOrNoStream(string streamId)
{
List<EventRecord> events;
Assert.That(
- !_lastMessageReplies.TryGetValue(streamId, out events) || events.Count == 0,
+ !_streams.TryGetValue(streamId, out events) || events.Count == 0,
string.Format("The stream {0} should not exist.", streamId));
}
+
+ [Conditional("DEBUG")]
+ public void DumpStream(string streamId)
+ {
+#if DEBUG
+ if (_deletedStreams.Contains(streamId))
+ Console.WriteLine("Stream '{0}' has been deleted", streamId);
+
+ List<EventRecord> list;
+ if (!_streams.TryGetValue(streamId, out list) || list == null)
+ Console.WriteLine("Stream '{0}' does not exist", streamId);
+ if (list != null)
+ {
+ for (int index = 0; index < list.Count; index++)
+ {
+ var record = list[index];
+ try
+ {
+ Console.WriteLine("{0}: '{1}' ==> \r\n{2}", index, record.EventType, record.DebugDataView);
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("EXCEPTION: {0}", ex);
+ }
+ }
+ }
+#endif
+ }
}
}
View
5 src/EventStore/EventStore.Core.Tests/Helpers/TestFixtureWithReadWriteDispatchers.cs
@@ -80,6 +80,8 @@ public void setup0()
_envelope = null;
_timeProvider = new FakeTimeProvider();
_bus = new InMemoryBus("bus");
+ _consumer = new TestHandler<Message>();
+ _bus.Subscribe(_consumer);
_queue = GiveInputQueue();
_otherQueues = null;
_ioDispatcher = new IODispatcher(_bus, new PublishEnvelope(GetInputQueue()));
@@ -93,8 +95,6 @@ public void setup0()
_bus.Subscribe(_ioDispatcher.StreamDeleter);
_bus.Subscribe(_ioDispatcher);
- _consumer = new TestHandler<Message>();
- _bus.Subscribe(_consumer);
}
protected virtual ManualQueue GiveInputQueue()
@@ -128,6 +128,7 @@ protected void WhenLoop(IEnumerable<WhenStep> steps)
{
foreach (var step in steps)
{
+ _timeProvider.AddTime(TimeSpan.FromMilliseconds(10));
if (step.Action != null)
{
step.Action();
View
2 ...ventStore/EventStore.Core.Tests/Services/UserManagementService/user_management_service.cs
@@ -73,7 +73,7 @@ protected override void Given()
protected override ManualQueue GiveInputQueue()
{
- return new ManualQueue(_bus);
+ return new ManualQueue(_bus, _timeProvider);
}
[SetUp]
View
102 src/EventStore/EventStore.Core/Bus/QueueStatsCollector.cs
@@ -27,9 +27,11 @@
//
using System;
using System.Diagnostics;
+using System.Net.Configuration;
using System.Threading;
using EventStore.Common.Utils;
using EventStore.Core.Services.Monitoring.Stats;
+using EventStore.Core.TransactionLog.Checkpoint;
namespace EventStore.Core.Bus
{
@@ -42,6 +44,12 @@ public class QueueStatsCollector
public Type InProgressMessage { get { return _inProgressMsgType; } }
+#if DEBUG
+ public static int NonIdle
+ {
+ get { return _nonIdle; }
+ }
+#endif
private readonly object _statisticsLock = new object(); // this lock is mostly acquired from a single thread (+ rarely to get statistics), so performance penalty is not too high
private readonly Stopwatch _busyWatch = new Stopwatch();
@@ -73,6 +81,15 @@ public QueueStatsCollector(string name, string groupName = null)
public void Start()
{
_totalTimeWatch.Start();
+#if DEBUG
+ if (_notifyLock != null)
+ {
+ lock (_notifyLock)
+ {
+ _nonIdle++;
+ }
+ }
+#endif
EnterIdle();
}
@@ -107,6 +124,19 @@ public void EnterIdle()
if (_wasIdle)
return;
_wasIdle = true;
+#if DEBUG
+ if (_notifyLock != null)
+ {
+ lock (_notifyLock)
+ {
+ _nonIdle = NonIdle - 1;
+ if (NonIdle == 0)
+ {
+ Monitor.Pulse(_notifyLock);
+ }
+ }
+ }
+#endif
//NOTE: the following locks are primarily acquired in main thread,
// so not too high performance penalty
@@ -126,6 +156,16 @@ public void EnterBusy()
return;
_wasIdle = false;
+#if DEBUG
+ if (_notifyLock != null)
+ {
+ lock (_notifyLock)
+ {
+ _nonIdle = NonIdle + 1;
+ }
+ }
+#endif
+
lock (_statisticsLock)
{
_totalIdleWatch.Stop();
@@ -178,6 +218,68 @@ public QueueStats GetStatistics(int currentQueueLength)
return stats;
}
}
+
+#if DEBUG
+ private static object _notifyLock;
+ private static int _nonIdle = 0;
+ private static ICheckpoint _writerCheckpoint;
+ private static ICheckpoint _chaserCheckpoint;
+ private static int _length;
+
+ public static void InitializeIdleDetection(bool enable = true)
+ {
+ if (enable)
+ {
+ _nonIdle = 0;
+ _length = 0;
+ _notifyLock = new object();
+ }
+ else
+ {
+ _notifyLock = null;
+ }
+ }
+
+#endif
+ [Conditional("DEBUG")]
+ public static void WaitIdle()
+ {
+#if DEBUG
+ var counter = 0;
+ lock (_notifyLock)
+ {
+ while (_nonIdle > 0 || _length > 0 || _writerCheckpoint.Read() != _chaserCheckpoint.Read())
+ {
+ if (!Monitor.Wait(_notifyLock, 100))
+ {
+ Console.WriteLine("Waiting for IDLE state...");
+ counter++;
+ if (counter > 10)
+ throw new ApplicationException("Infinite loop?");
+ }
+ }
+ }
+#endif
+ }
+#if DEBUG
+ public static void InitializeCheckpoints(ICheckpoint writerCheckpoint, ICheckpoint chaserCheckpoint)
+ {
+ _chaserCheckpoint = chaserCheckpoint;
+ _writerCheckpoint = writerCheckpoint;
+ }
+#endif
+
+ [Conditional("DEBUG")]
+ public void Enqueued()
+ {
+ Interlocked.Increment(ref _length);
+ }
+
+ [Conditional("DEBUG")]
+ public void Dequeued()
+ {
+ Interlocked.Decrement(ref _length);
+ }
}
}
View
6 src/EventStore/EventStore.Core/Bus/QueuedHandlerAutoReset.cs
@@ -146,6 +146,9 @@ private void ReadFromQueue(object o)
else
{
_queueStats.EnterBusy();
+#if DEBUG
+ _queueStats.Dequeued();
+#endif
iterationsCount = 0;
@@ -191,6 +194,9 @@ private void ReadFromQueue(object o)
public void Publish(Message message)
{
//Ensure.NotNull(message, "message");
+#if DEBUG
+ _queueStats.Enqueued();
+#endif
_queue.Enqueue(message);
if (_starving)
_msgAddEvent.Set();
View
6 src/EventStore/EventStore.Core/Bus/QueuedHandlerMRES.cs
@@ -132,6 +132,9 @@ private void ReadFromQueue(object o)
else
{
_queueStats.EnterBusy();
+#if DEBUG
+ _queueStats.Dequeued();
+#endif
var cnt = _queue.Count;
_queueStats.ProcessingStarted(msg.GetType(), cnt);
@@ -175,6 +178,9 @@ private void ReadFromQueue(object o)
public void Publish(Message message)
{
//Ensure.NotNull(message, "message");
+#if DEBUG
+ _queueStats.Enqueued();
+#endif
_queue.Enqueue(message);
if (_starving)
_msgAddEvent.Set();
View
6 src/EventStore/EventStore.Core/Bus/QueuedHandlerPulse.cs
@@ -134,6 +134,9 @@ private void ReadFromQueue(object o)
}
_queueStats.EnterBusy();
+#if DEBUG
+ _queueStats.Dequeued();
+#endif
var cnt = _queue.Count;
_queueStats.ProcessingStarted(msg.GetType(), cnt);
@@ -176,6 +179,9 @@ private void ReadFromQueue(object o)
public void Publish(Message message)
{
//Ensure.NotNull(message, "message");
+#if DEBUG
+ _queueStats.Enqueued();
+#endif
_queue.Enqueue(message);
if (_starving)
{
View
6 src/EventStore/EventStore.Core/Bus/QueuedHandlerSleep.cs
@@ -137,6 +137,9 @@ private void ReadFromQueue(object o)
else
{
_queueStats.EnterBusy();
+#if DEBUG
+ _queueStats.Dequeued();
+#endif
var cnt = _queue.Count;
_queueStats.ProcessingStarted(msg.GetType(), cnt);
@@ -180,6 +183,9 @@ private void ReadFromQueue(object o)
public void Publish(Message message)
{
//Ensure.NotNull(message, "message");
+#if DEBUG
+ _queueStats.Enqueued();
+#endif
_queue.Enqueue(message);
}
View
6 src/EventStore/EventStore.Core/Bus/QueuedHandlerThreadPool.cs
@@ -115,6 +115,9 @@ private void ReadFromQueue(object o)
Message msg;
while (!_stop && _queue.TryDequeue(out msg))
{
+#if DEBUG
+ _queueStats.Dequeued();
+#endif
try
{
var queueCnt = _queue.Count;
@@ -161,6 +164,9 @@ private void ReadFromQueue(object o)
public void Publish(Message message)