pg_eventstore 1.13.4 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (319) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +11 -2
  3. data/CHANGELOG.md +195 -16
  4. data/README.md +33 -10
  5. data/db/migrations/10_setup_pg_cron.rb +1 -0
  6. data/db/migrations/11_add_events_link_global_position.sql +1 -0
  7. data/db/migrations/12_migrate_legacy_links.rb +83 -0
  8. data/db/migrations/13_remove_events_link_id.sql +6 -0
  9. data/db/migrations/14_remove_ids_events_id_index.sql +1 -0
  10. data/db/migrations/15_create_streams_global_index.sql +17 -0
  11. data/db/migrations/16_populate_streams_global_index.rb +150 -0
  12. data/db/migrations/17_create_events_global_index.sql +62 -0
  13. data/db/migrations/18_populate_events_global_index.rb +124 -0
  14. data/db/migrations/19_populate_events_global_index_p2.rb +25 -0
  15. data/db/migrations/20_migrate_subscriptions_current_position.sql +19 -0
  16. data/db/migrations/21_create_partitions_stats.sql +2 -0
  17. data/db/migrations/22_drop_streams_sql_view.sql +2 -0
  18. data/db/migrations/23_adjust_partitions_indexes.sql +5 -0
  19. data/db/migrations/24_drop_legacy_events_indexes.sql +3 -0
  20. data/db/migrations/25_add_parent_partitions_info_to_partitions.sql +16 -0
  21. data/db/migrations/26_change_events_stream_revision_type.rb +35 -0
  22. data/db/migrations/27_drop_events_horizon.sql +3 -0
  23. data/db/migrations/28_create_maintenance_tasks.sql +8 -0
  24. data/db/migrations/29_create_event_markers.sql +35 -0
  25. data/db/migrations/30_improve_partitions_search_in_admin_ui.rb +24 -0
  26. data/db/migrations/31_drop_events_id_default_value.sql +1 -0
  27. data/db/migrations/32_create_parittions_triggers.sql +101 -0
  28. data/db/migrations/9_create_events_horizon.sql +21 -0
  29. data/docs/AGENTS.fragment.md +696 -0
  30. data/docs/admin_ui.md +3 -1
  31. data/docs/appending_events.md +110 -49
  32. data/docs/configuration.md +69 -36
  33. data/docs/event_tracing.md +55 -0
  34. data/docs/events_and_streams.md +54 -30
  35. data/docs/how_it_works.md +57 -16
  36. data/docs/linking_events.md +2 -1
  37. data/docs/maintenance.md +14 -5
  38. data/docs/multiple_commands.md +30 -6
  39. data/docs/reading_events.md +208 -43
  40. data/docs/reading_streams.md +50 -0
  41. data/docs/replication.md +99 -0
  42. data/docs/subscriptions.md +165 -35
  43. data/docs/writing_middleware.md +25 -8
  44. data/ext/pg_eventstore_ext/extconf.rb +5 -0
  45. data/ext/pg_eventstore_ext/pg_eventstore_ext.c +74 -0
  46. data/lib/pg_eventstore/async_runner.rb +63 -0
  47. data/lib/pg_eventstore/basic_config.rb +15 -0
  48. data/lib/pg_eventstore/callbacks.rb +7 -5
  49. data/lib/pg_eventstore/chunks/chunk.rb +31 -0
  50. data/lib/pg_eventstore/chunks/read_api_events_index_chunk.rb +83 -0
  51. data/lib/pg_eventstore/chunks/replica_events_index_chunk.rb +35 -0
  52. data/lib/pg_eventstore/chunks/repository.rb +73 -0
  53. data/lib/pg_eventstore/chunks/subscription_checkpoint_chunk.rb +48 -0
  54. data/lib/pg_eventstore/chunks/subscription_events_index_chunk.rb +99 -0
  55. data/lib/pg_eventstore/chunks.rb +14 -0
  56. data/lib/pg_eventstore/cli/try_to_delete_subscriptions_set.rb +2 -2
  57. data/lib/pg_eventstore/client.rb +167 -52
  58. data/lib/pg_eventstore/commands/append.rb +62 -43
  59. data/lib/pg_eventstore/commands/delete_event.rb +7 -8
  60. data/lib/pg_eventstore/commands/delete_stream.rb +3 -3
  61. data/lib/pg_eventstore/commands/event_modifiers/prepare_link_event.rb +11 -6
  62. data/lib/pg_eventstore/commands/event_modifiers/prepare_regular_event.rb +12 -7
  63. data/lib/pg_eventstore/commands/link_to.rb +9 -9
  64. data/lib/pg_eventstore/commands/multiple.rb +2 -2
  65. data/lib/pg_eventstore/commands/read.rb +23 -5
  66. data/lib/pg_eventstore/commands/read_grouped.rb +46 -0
  67. data/lib/pg_eventstore/commands/read_streams.rb +18 -0
  68. data/lib/pg_eventstore/commands/read_streams_paginated.rb +56 -0
  69. data/lib/pg_eventstore/commands/regular_stream_read_paginated.rb +4 -4
  70. data/lib/pg_eventstore/commands/revision_check/current_revision.rb +51 -0
  71. data/lib/pg_eventstore/commands/revision_check/event_type_revisions_comparison.rb +46 -0
  72. data/lib/pg_eventstore/commands/revision_check/expected_revision.rb +135 -0
  73. data/lib/pg_eventstore/commands/revision_check/stream_revision_check.rb +98 -0
  74. data/lib/pg_eventstore/commands/revision_check/stream_revision_comparison.rb +36 -0
  75. data/lib/pg_eventstore/commands/stream_revision.rb +14 -0
  76. data/lib/pg_eventstore/commands/system_stream_read_paginated.rb +4 -4
  77. data/lib/pg_eventstore/commands.rb +4 -2
  78. data/lib/pg_eventstore/config.rb +30 -9
  79. data/lib/pg_eventstore/connection.rb +22 -37
  80. data/lib/pg_eventstore/errors.rb +137 -11
  81. data/lib/pg_eventstore/event.rb +39 -7
  82. data/lib/pg_eventstore/event_deserializer.rb +5 -4
  83. data/lib/pg_eventstore/event_global_index.rb +118 -0
  84. data/lib/pg_eventstore/event_marker.rb +16 -0
  85. data/lib/pg_eventstore/event_marker_index.rb +25 -0
  86. data/lib/pg_eventstore/event_serializer.rb +6 -0
  87. data/lib/pg_eventstore/extensions/acts_as_configurable.rb +88 -0
  88. data/lib/pg_eventstore/extensions/options_defaults.rb +25 -0
  89. data/lib/pg_eventstore/extensions/options_extension.rb +42 -13
  90. data/lib/pg_eventstore/feature_marker.rb +18 -0
  91. data/lib/pg_eventstore/maintenance.rb +11 -6
  92. data/lib/pg_eventstore/middleware/event_tracing.rb +53 -0
  93. data/lib/pg_eventstore/partition.rb +6 -0
  94. data/lib/pg_eventstore/pg_connection.rb +70 -14
  95. data/lib/pg_eventstore/queries/event_marker_queries.rb +74 -0
  96. data/lib/pg_eventstore/queries/event_queries.rb +9 -95
  97. data/lib/pg_eventstore/queries/events_global_index_queries.rb +131 -0
  98. data/lib/pg_eventstore/queries/index_filtering_queries.rb +179 -0
  99. data/lib/pg_eventstore/queries/links_resolver.rb +10 -7
  100. data/lib/pg_eventstore/queries/maintenance_queries.rb +159 -42
  101. data/lib/pg_eventstore/queries/partition_queries.rb +46 -104
  102. data/lib/pg_eventstore/queries/replica_queries.rb +110 -0
  103. data/lib/pg_eventstore/queries/streams_global_index_queries.rb +163 -0
  104. data/lib/pg_eventstore/queries/transaction_queries.rb +58 -10
  105. data/lib/pg_eventstore/queries.rb +29 -1
  106. data/lib/pg_eventstore/query_builders/basic_filtering.rb +38 -5
  107. data/lib/pg_eventstore/query_builders/event_markers_filtering.rb +47 -0
  108. data/lib/pg_eventstore/query_builders/event_markers_index_filtering.rb +275 -0
  109. data/lib/pg_eventstore/query_builders/event_subscription_positions_filtering.rb +37 -0
  110. data/lib/pg_eventstore/query_builders/events_filtering.rb +15 -164
  111. data/lib/pg_eventstore/query_builders/events_global_index_filtering.rb +227 -0
  112. data/lib/pg_eventstore/query_builders/filters/collection.rb +324 -0
  113. data/lib/pg_eventstore/query_builders/filters/event_type_filter.rb +37 -0
  114. data/lib/pg_eventstore/query_builders/filters/filter_row.rb +54 -0
  115. data/lib/pg_eventstore/query_builders/filters/marker_filter.rb +20 -0
  116. data/lib/pg_eventstore/query_builders/filters/marker_filter_row.rb +49 -0
  117. data/lib/pg_eventstore/query_builders/filters/stream_filter.rb +48 -0
  118. data/lib/pg_eventstore/query_builders/index_based_events_filtering.rb +260 -0
  119. data/lib/pg_eventstore/query_builders/partitions_filtering.rb +175 -51
  120. data/lib/pg_eventstore/query_builders/read_cursor/stream_cursor.rb +122 -0
  121. data/lib/pg_eventstore/query_builders/streams_global_index_filtering.rb +83 -0
  122. data/lib/pg_eventstore/query_builders/subscription_events_filtering.rb +79 -0
  123. data/lib/pg_eventstore/query_strategy/async.rb +64 -0
  124. data/lib/pg_eventstore/query_strategy/foreground.rb +25 -0
  125. data/lib/pg_eventstore/query_strategy.rb +19 -0
  126. data/lib/pg_eventstore/raw_event.rb +46 -0
  127. data/lib/pg_eventstore/rspec/test_helpers.rb +21 -8
  128. data/lib/pg_eventstore/sql_builder.rb +87 -8
  129. data/lib/pg_eventstore/stream.rb +14 -17
  130. data/lib/pg_eventstore/stream_global_index.rb +28 -0
  131. data/lib/pg_eventstore/subscriptions/basic_runner.rb +4 -4
  132. data/lib/pg_eventstore/subscriptions/callback_handlers/events_processor_handlers.rb +5 -17
  133. data/lib/pg_eventstore/subscriptions/callback_handlers/events_subscription_position_worker_handlers.rb +36 -0
  134. data/lib/pg_eventstore/subscriptions/callback_handlers/subscription_feeder_handlers.rb +13 -1
  135. data/lib/pg_eventstore/subscriptions/callback_handlers/subscription_runner_handlers.rb +19 -14
  136. data/lib/pg_eventstore/subscriptions/events_processor.rb +21 -19
  137. data/lib/pg_eventstore/subscriptions/events_processor_consumer/multiple.rb +63 -0
  138. data/lib/pg_eventstore/subscriptions/events_processor_consumer/replica.rb +68 -0
  139. data/lib/pg_eventstore/subscriptions/events_processor_consumer/single.rb +62 -0
  140. data/lib/pg_eventstore/subscriptions/events_processor_consumer.rb +44 -0
  141. data/lib/pg_eventstore/subscriptions/events_subscription_position_worker.rb +68 -0
  142. data/lib/pg_eventstore/subscriptions/queries/event_subscription_position_queries.rb +177 -0
  143. data/lib/pg_eventstore/subscriptions/queries/subscription_command_queries.rb +5 -5
  144. data/lib/pg_eventstore/subscriptions/queries/subscription_queries.rb +80 -56
  145. data/lib/pg_eventstore/subscriptions/queries/subscriptions_set_command_queries.rb +2 -2
  146. data/lib/pg_eventstore/subscriptions/queries/subscriptions_set_queries.rb +1 -1
  147. data/lib/pg_eventstore/subscriptions/replica_subscription_handler.rb +140 -0
  148. data/lib/pg_eventstore/subscriptions/replica_subscription_runner.rb +9 -0
  149. data/lib/pg_eventstore/subscriptions/subscription.rb +9 -7
  150. data/lib/pg_eventstore/subscriptions/subscription_feed_strategies/collection.rb +36 -0
  151. data/lib/pg_eventstore/subscriptions/subscription_feed_strategies/index_read_strategy.rb +82 -0
  152. data/lib/pg_eventstore/subscriptions/subscription_feed_strategies/replication_strategy.rb +75 -0
  153. data/lib/pg_eventstore/subscriptions/subscription_feed_strategy.rb +31 -0
  154. data/lib/pg_eventstore/subscriptions/subscription_feeder.rb +26 -2
  155. data/lib/pg_eventstore/subscriptions/subscription_handler_performance.rb +5 -5
  156. data/lib/pg_eventstore/subscriptions/subscription_runner.rb +20 -22
  157. data/lib/pg_eventstore/subscriptions/subscription_runner_commands/reset_position.rb +1 -1
  158. data/lib/pg_eventstore/subscriptions/subscription_runners_feeder.rb +10 -11
  159. data/lib/pg_eventstore/subscriptions/subscriptions_lifecycle.rb +0 -12
  160. data/lib/pg_eventstore/subscriptions/subscriptions_manager.rb +84 -29
  161. data/lib/pg_eventstore/{subscriptions/synchronized_array.rb → synchronized_array.rb} +15 -0
  162. data/lib/pg_eventstore/tasks/setup.rake +32 -33
  163. data/lib/pg_eventstore/utils.rb +39 -0
  164. data/lib/pg_eventstore/version.rb +1 -1
  165. data/lib/pg_eventstore/web/application.rb +104 -20
  166. data/lib/pg_eventstore/web/paginator/base_collection.rb +5 -1
  167. data/lib/pg_eventstore/web/paginator/event_types_collection.rb +14 -4
  168. data/lib/pg_eventstore/web/paginator/events_collection.rb +29 -33
  169. data/lib/pg_eventstore/web/paginator/helpers.rb +19 -12
  170. data/lib/pg_eventstore/web/paginator/markers_collection.rb +48 -0
  171. data/lib/pg_eventstore/web/paginator/stream_contexts_collection.rb +13 -2
  172. data/lib/pg_eventstore/web/paginator/stream_ids_collection.rb +21 -11
  173. data/lib/pg_eventstore/web/paginator/stream_names_collection.rb +18 -4
  174. data/lib/pg_eventstore/web/paginator/streams_collection.rb +95 -0
  175. data/lib/pg_eventstore/web/public/javascripts/pg_eventstore.js +49 -22
  176. data/lib/pg_eventstore/web/subscriptions/helpers.rb +2 -2
  177. data/lib/pg_eventstore/web/subscriptions/set_collection.rb +1 -1
  178. data/lib/pg_eventstore/web/subscriptions/subscriptions.rb +1 -1
  179. data/lib/pg_eventstore/web/subscriptions/with_state/set_collection.rb +1 -1
  180. data/lib/pg_eventstore/web/subscriptions/with_state/subscriptions.rb +1 -1
  181. data/lib/pg_eventstore/web/views/home/dashboard.erb +11 -9
  182. data/lib/pg_eventstore/web/views/home/partials/event_filter.erb +18 -5
  183. data/lib/pg_eventstore/web/views/home/partials/events.erb +38 -1
  184. data/lib/pg_eventstore/web/views/home/partials/markers_filter.erb +18 -0
  185. data/lib/pg_eventstore/web/views/layouts/application.erb +6 -0
  186. data/lib/pg_eventstore/web/views/streams/index.erb +110 -0
  187. data/lib/pg_eventstore/web/views/streams/partials/streams.erb +11 -0
  188. data/lib/pg_eventstore/web/views/subscriptions/index.erb +4 -1
  189. data/lib/pg_eventstore/web.rb +2 -0
  190. data/lib/pg_eventstore.rb +26 -63
  191. data/pg_eventstore.gemspec +6 -4
  192. data/sig/interfaces/_raw_events_handler.rbs +3 -0
  193. data/sig/interfaces/subscription_handler.rbs +1 -1
  194. data/sig/pg/result.rbs +9 -0
  195. data/sig/pg_eventstore/async_runner.rbs +13 -0
  196. data/sig/pg_eventstore/basic_config.rbs +9 -0
  197. data/sig/pg_eventstore/chunks/chunk.rbs +13 -0
  198. data/sig/pg_eventstore/chunks/read_api_events_index_chunk.rbs +30 -0
  199. data/sig/pg_eventstore/chunks/replica_events_index_chunk.rbs +11 -0
  200. data/sig/pg_eventstore/chunks/repository.rbs +22 -0
  201. data/sig/pg_eventstore/chunks/subscription_checkpoint_chunk.rbs +18 -0
  202. data/sig/pg_eventstore/chunks/subscription_events_index_chunk.rbs +37 -0
  203. data/sig/pg_eventstore/client.rbs +41 -43
  204. data/sig/pg_eventstore/commands/append.rbs +11 -25
  205. data/sig/pg_eventstore/commands/event_modifiers/prepare_link_event.rbs +9 -12
  206. data/sig/pg_eventstore/commands/event_modifiers/prepare_regular_event.rbs +5 -4
  207. data/sig/pg_eventstore/commands/link_to.rbs +6 -11
  208. data/sig/pg_eventstore/commands/multiple.rbs +1 -1
  209. data/sig/pg_eventstore/commands/read.rbs +2 -5
  210. data/sig/pg_eventstore/commands/read_grouped.rbs +7 -0
  211. data/sig/pg_eventstore/commands/read_streams.rbs +7 -0
  212. data/sig/pg_eventstore/commands/read_streams_paginated.rbs +16 -0
  213. data/sig/pg_eventstore/commands/regular_stream_read_paginated.rbs +9 -17
  214. data/sig/pg_eventstore/commands/revision_check/current_revision.rbs +25 -0
  215. data/sig/pg_eventstore/commands/revision_check/event_type_revisions_comparison.rbs +14 -0
  216. data/sig/pg_eventstore/commands/revision_check/expected_revision.rbs +67 -0
  217. data/sig/pg_eventstore/commands/revision_check/stream_revision_check.rbs +20 -0
  218. data/sig/pg_eventstore/commands/revision_check/stream_revision_comparison.rbs +9 -0
  219. data/sig/pg_eventstore/commands/stream_revision.rbs +7 -0
  220. data/sig/pg_eventstore/commands/system_stream_read_paginated.rbs +9 -14
  221. data/sig/pg_eventstore/config.rbs +15 -6
  222. data/sig/pg_eventstore/connection.rbs +11 -18
  223. data/sig/pg_eventstore/errors.rbs +64 -34
  224. data/sig/pg_eventstore/event.rbs +20 -6
  225. data/sig/pg_eventstore/event_deserializer.rbs +5 -10
  226. data/sig/pg_eventstore/event_global_index.rbs +60 -0
  227. data/sig/pg_eventstore/event_marker.rbs +9 -0
  228. data/sig/pg_eventstore/event_marker_index.rbs +12 -0
  229. data/sig/pg_eventstore/extensions/acts_as_configurable.rbs +29 -0
  230. data/sig/pg_eventstore/extensions/options_defaults.rbs +7 -0
  231. data/sig/pg_eventstore/extensions/options_extension.rbs +9 -1
  232. data/sig/pg_eventstore/feature_marker.rbs +10 -0
  233. data/sig/pg_eventstore/maintenance.rbs +12 -8
  234. data/sig/pg_eventstore/middleware/event_trace.rbs +14 -0
  235. data/sig/pg_eventstore/partition.rbs +2 -4
  236. data/sig/pg_eventstore/pg_connection.rbs +8 -0
  237. data/sig/pg_eventstore/queries/event_marker_queries.rbs +21 -0
  238. data/sig/pg_eventstore/queries/event_queries.rbs +6 -38
  239. data/sig/pg_eventstore/queries/events_global_index_queries.rbs +37 -0
  240. data/sig/pg_eventstore/queries/index_filtering_queries.rbs +50 -0
  241. data/sig/pg_eventstore/queries/links_resolver.rbs +7 -11
  242. data/sig/pg_eventstore/queries/maintenance_queries.rbs +12 -9
  243. data/sig/pg_eventstore/queries/partition_queries.rbs +32 -67
  244. data/sig/pg_eventstore/queries/replica_queries.rbs +31 -0
  245. data/sig/pg_eventstore/queries/streams_global_index_queries.rbs +39 -0
  246. data/sig/pg_eventstore/queries/transaction_queries.rbs +4 -2
  247. data/sig/pg_eventstore/queries.rbs +11 -21
  248. data/sig/pg_eventstore/query_builders/basic_filtering.rbs +10 -3
  249. data/sig/pg_eventstore/query_builders/event_markers_filtering.rbs +17 -0
  250. data/sig/pg_eventstore/query_builders/event_markers_index_filtering.rbs +69 -0
  251. data/sig/pg_eventstore/query_builders/event_subscription_positions_filtering.rbs +15 -0
  252. data/sig/pg_eventstore/query_builders/events_filtering_query.rbs +9 -51
  253. data/sig/pg_eventstore/query_builders/events_global_index_filtering.rbs +68 -0
  254. data/sig/pg_eventstore/query_builders/filters/collection.rbs +84 -0
  255. data/sig/pg_eventstore/query_builders/filters/event_type_filter.rbs +19 -0
  256. data/sig/pg_eventstore/query_builders/filters/filter_row.rbs +21 -0
  257. data/sig/pg_eventstore/query_builders/filters/marker_filter.rbs +13 -0
  258. data/sig/pg_eventstore/query_builders/filters/marker_filter_row.rbs +19 -0
  259. data/sig/pg_eventstore/query_builders/filters/stream_filter.rbs +24 -0
  260. data/sig/pg_eventstore/query_builders/index_based_events_filtering.rbs +60 -0
  261. data/sig/pg_eventstore/query_builders/partitions_filtering.rbs +29 -10
  262. data/sig/pg_eventstore/query_builders/read_cursor/stream_cursor.rbs +47 -0
  263. data/sig/pg_eventstore/query_builders/streams_global_index_filtering.rbs +27 -0
  264. data/sig/pg_eventstore/query_builders/subscription_events_filtering.rbs +26 -0
  265. data/sig/pg_eventstore/query_strategy/async.rbs +17 -0
  266. data/sig/pg_eventstore/query_strategy/foreground.rbs +11 -0
  267. data/sig/pg_eventstore/query_strategy.rbs +7 -0
  268. data/sig/pg_eventstore/raw_event.rbs +20 -0
  269. data/sig/pg_eventstore/sql_builder.rbs +32 -10
  270. data/sig/pg_eventstore/stream.rbs +10 -18
  271. data/sig/pg_eventstore/stream_global_index.rbs +14 -0
  272. data/sig/pg_eventstore/subscriptions/callback_handlers/events_processor_handlers.rbs +5 -4
  273. data/sig/pg_eventstore/subscriptions/callback_handlers/events_subscription_position_worker_handlers.rbs +9 -0
  274. data/sig/pg_eventstore/subscriptions/callback_handlers/subscription_feeder_handlers.rbs +17 -12
  275. data/sig/pg_eventstore/subscriptions/callback_handlers/subscription_runner_handlers.rbs +16 -8
  276. data/sig/pg_eventstore/subscriptions/event_subscription_position_queries.rbs +30 -0
  277. data/sig/pg_eventstore/subscriptions/events_processor.rbs +12 -5
  278. data/sig/pg_eventstore/subscriptions/events_processor_consumer/multiple.rbs +17 -0
  279. data/sig/pg_eventstore/subscriptions/events_processor_consumer/replica.rbs +17 -0
  280. data/sig/pg_eventstore/subscriptions/events_processor_consumer/single.rbs +17 -0
  281. data/sig/pg_eventstore/subscriptions/events_processor_consumer.rbs +14 -0
  282. data/sig/pg_eventstore/subscriptions/events_subscription_position_worker.rbs +28 -0
  283. data/sig/pg_eventstore/subscriptions/queries/subscription_queries.rbs +18 -50
  284. data/sig/pg_eventstore/subscriptions/replica_subscription_handler.rbs +33 -0
  285. data/sig/pg_eventstore/subscriptions/replica_subscription_runner.rbs +4 -0
  286. data/sig/pg_eventstore/subscriptions/subscription_feed_strategy/collection.rbs +14 -0
  287. data/sig/pg_eventstore/subscriptions/subscription_feed_strategy/index_read_strategy.rbs +23 -0
  288. data/sig/pg_eventstore/subscriptions/subscription_feed_strategy/replication_strategy.rbs +23 -0
  289. data/sig/pg_eventstore/subscriptions/subscription_feed_strategy.rbs +11 -0
  290. data/sig/pg_eventstore/subscriptions/subscription_feeder.rbs +13 -10
  291. data/sig/pg_eventstore/subscriptions/subscription_handler_performance.rbs +1 -1
  292. data/sig/pg_eventstore/subscriptions/subscription_runner.rbs +13 -5
  293. data/sig/pg_eventstore/subscriptions/subscription_runners_feeder.rbs +5 -5
  294. data/sig/pg_eventstore/subscriptions/subscriptions_lifecycle.rbs +4 -6
  295. data/sig/pg_eventstore/subscriptions/subscriptions_manager.rbs +29 -43
  296. data/sig/pg_eventstore/synchronized_array.rbs +4 -0
  297. data/sig/pg_eventstore/utils.rbs +18 -11
  298. data/sig/pg_eventstore/web/application.rbs +13 -3
  299. data/sig/pg_eventstore/web/paginator/base_collection.rbs +2 -0
  300. data/sig/pg_eventstore/web/paginator/event_types_collection.rbs +4 -0
  301. data/sig/pg_eventstore/web/paginator/events_collection.rbs +11 -11
  302. data/sig/pg_eventstore/web/paginator/helpers.rbs +6 -15
  303. data/sig/pg_eventstore/web/paginator/markers_collection.rbs +13 -0
  304. data/sig/pg_eventstore/web/paginator/stream_contexts_collection.rbs +4 -0
  305. data/sig/pg_eventstore/web/paginator/stream_names_collection.rbs +4 -0
  306. data/sig/pg_eventstore/web/paginator/streams_collection.rbs +30 -0
  307. data/sig/pg_eventstore.rbs +8 -26
  308. metadata +181 -21
  309. data/lib/pg_eventstore/commands/all_stream_read_grouped.rb +0 -69
  310. data/lib/pg_eventstore/commands/regular_stream_read_grouped.rb +0 -31
  311. data/lib/pg_eventstore/subscriptions/queries/service_queries.rb +0 -73
  312. data/lib/pg_eventstore/subscriptions/subscription_position_evaluation.rb +0 -195
  313. data/lib/pg_eventstore/web/views/home/partials/system_stream_filter.erb +0 -15
  314. data/sig/pg_eventstore/commands/all_stream_read_grouped.rbs +0 -16
  315. data/sig/pg_eventstore/commands/regular_stream_read_grouped.rbs +0 -8
  316. data/sig/pg_eventstore/subscriptions/queries/service_queries.rbs +0 -15
  317. data/sig/pg_eventstore/subscriptions/subscription_position_evaluation.rbs +0 -53
  318. data/sig/pg_eventstore/subscriptions/synchronized_array.rbs +0 -4
  319. /data/sig/interfaces/{_raw_event_handler.rbs → raw_event_handler.rbs} +0 -0
@@ -0,0 +1,17 @@
1
+ module PgEventstore
2
+ module EventsProcessorConsumer
3
+ class Multiple
4
+ EVENTS_WAIT_TIMEOUT: Integer | Float
5
+
6
+ include EventsProcessorConsumer
7
+ extend ClassMethods
8
+
9
+ @handler: _RawEventsHandler
10
+
11
+ @last_unprocessed_events: Array[Hash[String, untyped]]?
12
+
13
+ def initialize: (_RawEventsHandler handler) -> void
14
+ end
15
+ end
16
+ end
17
+
@@ -0,0 +1,17 @@
1
+ module PgEventstore
2
+ module EventsProcessorConsumer
3
+ class Replica
4
+ include EventsProcessorConsumer
5
+
6
+ EVENTS_WAIT_TIMEOUT: Float | Integer
7
+
8
+ @handler: Proc
9
+
10
+ @last_unprocessed_events: Array[EventGlobalIndex::SubscriptionRepr]?
11
+
12
+ def self.create_consumer: (Symbol config_name, Symbol replica_config_name) -> Replica
13
+
14
+ def initialize: (Proc handler) -> void
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ module PgEventstore
2
+ module EventsProcessorConsumer
3
+ class Single
4
+ EVENT_WAIT_TIMEOUT: Float | Integer
5
+
6
+ include EventsProcessorConsumer
7
+ extend ClassMethods
8
+
9
+ @handler: _RawEventHandler
10
+
11
+ @last_unprocessed_event: Hash[String, untyped]?
12
+
13
+ def initialize: (_RawEventHandler handler) -> void
14
+ end
15
+ end
16
+ end
17
+
@@ -0,0 +1,14 @@
1
+ module PgEventstore
2
+ module EventsProcessorConsumer
3
+ module ClassMethods
4
+ def create_consumer: (_SubscriptionHandler handler, EventDeserializer deserializer) -> EventsProcessorConsumer
5
+ end
6
+
7
+ def self.consumer_class: (bool in_batches) -> Class
8
+
9
+ def call: (Callbacks callbacks, Chunks::Repository repository,
10
+ MonitorMixin::ConditionVariable repository_cond) -> void
11
+
12
+ def clear_unprocessed_events: -> void
13
+ end
14
+ end
@@ -0,0 +1,28 @@
1
+ module PgEventstore
2
+ class EventsSubscriptionPositionWorker
3
+ class ReindexTime
4
+ include Extensions::OptionsExtension
5
+ include Extensions::OptionsDefaults
6
+
7
+ attr_accessor time: Time?
8
+ end
9
+
10
+ @basic_runner: BasicRunner
11
+
12
+ @next_reindex_at: ReindexTime
13
+
14
+ attr_reader config_name: Symbol
15
+
16
+ def initialize: (Symbol config_name) -> void
17
+
18
+ private
19
+
20
+ def attach_runner_callbacks: -> void
21
+
22
+ def config: -> Config
23
+
24
+ def connection: -> Connection
25
+
26
+ def event_subscription_position_queries: -> EventSubscriptionPositionQueries
27
+ end
28
+ end
@@ -1,73 +1,41 @@
1
1
  module PgEventstore
2
2
  class SubscriptionQueries
3
- # _@param_ `connection`
4
- def initialize: (PgEventstore::Connection connection) -> void
3
+ @query_strategy: QueryStrategy
5
4
 
6
- # _@param_ `attrs`
7
- def find_or_create_by: (::Hash[untyped, untyped] attrs) -> ::Hash[untyped, untyped]
5
+ attr_accessor connection: Connection
8
6
 
9
- # _@param_ `attrs`
10
- def find_by: (::Hash[untyped, untyped] attrs) -> ::Hash[untyped, untyped]?
7
+ def initialize: (Connection connection, QueryStrategy query_strategy) -> void
11
8
 
12
- # _@param_ `attrs`
13
- def find_all: (::Hash[untyped, untyped] attrs) -> ::Array[::Hash[untyped, untyped]]
9
+ def create_or_replace_table_function: (Integer id, Hash[untyped, untyped] options, Integer locked_by) -> void
10
+
11
+ def find_or_create_by: (::Hash[untyped, untyped] attrs) -> ::Hash[Symbol, untyped]
12
+
13
+ def find_by: (::Hash[untyped, untyped] attrs) -> ::Hash[Symbol, untyped]?
14
+
15
+ def find_all: (::Hash[untyped, untyped] attrs) -> ::Array[::Hash[Symbol, untyped]]
14
16
 
15
17
  def set_collection: (?String? state) -> ::Array[String]
16
18
 
17
- # _@param_ `id`
18
- def find!: (Integer id) -> ::Hash[untyped, untyped]
19
+ def find!: (Integer id) -> ::Hash[Symbol, untyped]
19
20
 
20
- # _@param_ `attrs`
21
- def create: (::Hash[untyped, untyped] attrs) -> ::Hash[untyped, untyped]
21
+ def create: (::Hash[untyped, untyped] attrs) -> ::Hash[Symbol, untyped]
22
22
 
23
- # _@param_ `id`
24
- #
25
- # _@param_ `attrs`
26
- #
27
- # _@param_ `locked_by`
28
- def update: (Integer id, attrs: ::Hash[untyped, untyped], locked_by: Integer?) -> ::Hash[untyped, untyped]
23
+ def update: (Integer id, attrs: ::Hash[Symbol, untyped], locked_by: Integer?) -> ::Hash[Symbol, untyped]
29
24
 
30
- # _@param_ `subscriptions_set_id` — SubscriptionsSet#id
31
- #
32
- # _@param_ `subscriptions_ids` — Array of Subscription#id
33
25
  def ping_all: (Integer subscriptions_set_id, ::Array[Integer] subscriptions_ids) -> ::Hash[Integer, Time]
34
26
 
35
- # _@param_ `query_options` — runner_id/query options association
36
- #
37
- # _@return_ — runner_id/events association
38
- def subscriptions_events: (::Hash[Integer, ::Hash[untyped, untyped]] query_options) -> ::Hash[Integer, Array[::Hash[untyped, untyped]]]
39
-
40
- # _@param_ `id` — subscription's id
41
- #
42
- # _@param_ `lock_id` — id of the subscriptions set which reserves the subscription
43
- #
44
- # _@param_ `force` — whether to lock the subscription despite on #locked_by value
45
- #
46
- # _@return_ — lock id
47
27
  def lock!: (Integer id, Integer lock_id, ?force: bool) -> Integer
48
28
 
49
- # _@param_ `id`
50
29
  def delete: (Integer id) -> void
51
30
 
52
- # _@param_ `id` runner id
53
- #
54
- # _@param_ `options` — query options
55
- def query_builder: (Integer id, ::Hash[untyped, untyped] options) -> PgEventstore::SQLBuilder
56
-
57
- # _@param_ `builders`
58
- def union_builders: (::Array[PgEventstore::SQLBuilder] builders) -> PgEventstore::SQLBuilder
59
-
60
- def transaction_queries: () -> PgEventstore::TransactionQueries
31
+ def union_builders: (::Array[SQLBuilder] builders) -> SQLBuilder
61
32
 
62
- def links_resolver: () -> PgEventstore::LinksResolver
33
+ def transaction_queries: () -> TransactionQueries
63
34
 
64
- # _@param_ `hash`
65
- def deserialize: (::Hash[untyped, untyped] hash) -> ::Hash[untyped, untyped]
35
+ def links_resolver: () -> LinksResolver
66
36
 
67
- # _@param_ `attrs`
68
- def find_by_attrs_builder: (::Hash[untyped, untyped] attrs) -> PgEventstore::SQLBuilder
37
+ def deserialize: (::Hash[String, untyped] hash) -> ::Hash[Symbol, untyped]
69
38
 
70
- # Returns the value of attribute connection.
71
- attr_accessor connection: PgEventstore::Connection
39
+ def find_by_attrs_builder: (::Hash[untyped, untyped] attrs) -> SQLBuilder
72
40
  end
73
41
  end
@@ -0,0 +1,33 @@
1
+ module PgEventstore
2
+ class ReplicaSubscriptionHandler
3
+ @replica_config_name: Symbol
4
+ @config_name: Symbol
5
+
6
+ def call: (Array[EventGlobalIndex::SubscriptionRepr] indexes) -> void
7
+
8
+ def initialize: (Symbol, Symbol) -> void
9
+
10
+ private
11
+
12
+ def connection: -> Connection
13
+
14
+ def destination_replica_queries: -> ReplicaQueries
15
+
16
+ def records_to_sql: (
17
+ String table_name,
18
+ Array[Symbol] attribute_names,
19
+ Array[Hash[Symbol, untyped]] attributes_collection,
20
+ ?on_conflict: String?
21
+ ) -> String
22
+
23
+ def reject_already_processed: (
24
+ Array[EventGlobalIndex::SubscriptionRepr] indexes
25
+ ) -> Array[EventGlobalIndex::SubscriptionRepr]
26
+
27
+ def replica_connection: -> Connection
28
+
29
+ def replica_transaction_queries: -> TransactionQueries
30
+
31
+ def source_replica_queries: -> ReplicaQueries
32
+ end
33
+ end
@@ -0,0 +1,4 @@
1
+ module PgEventstore
2
+ class ReplicaSubscriptionRunner < SubscriptionRunner
3
+ end
4
+ end
@@ -0,0 +1,14 @@
1
+ module PgEventstore
2
+ module SubscriptionFeedStrategy[unchecked Runner]
3
+ class Collection < Array[SubscriptionFeedStrategy[SubscriptionRunner] | SubscriptionFeedStrategy[ReplicaSubscriptionRunner]]
4
+ DEFAULT_SUBSCRIPTIONS_NUM_PER_QUERY: Integer
5
+
6
+ def self.create: (
7
+ Array[SubscriptionRunner | ReplicaSubscriptionRunner] runners,
8
+ Connection connection,
9
+ QueryStrategy query_strategy,
10
+ ?subscriptions_per_query: Integer
11
+ ) -> Collection
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,23 @@
1
+ module PgEventstore
2
+ module SubscriptionFeedStrategy[unchecked Runner]
3
+ class IndexReadStrategy
4
+ include SubscriptionFeedStrategy[SubscriptionRunner]
5
+
6
+ INDEX_LOOK_UP_DISTANCE: Integer
7
+
8
+ @connection: Connection
9
+ @query_strategy: QueryStrategy
10
+ @runners: Array[SubscriptionRunner]
11
+
12
+ def initialize: (Connection connection, QueryStrategy query_strategy) -> void
13
+
14
+ private
15
+
16
+ def event_subscription_position_queries: -> EventSubscriptionPositionQueries
17
+
18
+ def events_global_index_queries: -> EventsGlobalIndexQueries
19
+
20
+ def safe_position: -> Integer
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ module PgEventstore
2
+ module SubscriptionFeedStrategy[unchecked Runner]
3
+ class ReplicationStrategy
4
+ include SubscriptionFeedStrategy[ReplicaSubscriptionRunner]
5
+
6
+ INDEX_LOOK_UP_DISTANCE: Integer
7
+
8
+ @connection: Connection
9
+ @query_strategy: QueryStrategy
10
+ @runners: Array[ReplicaSubscriptionRunner]
11
+
12
+ def initialize: (Connection connection, QueryStrategy query_strategy) -> void
13
+
14
+ private
15
+
16
+ def event_subscription_position_queries: -> EventSubscriptionPositionQueries
17
+
18
+ def events_global_index_queries: -> EventsGlobalIndexQueries
19
+
20
+ def safe_position: -> Integer
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,11 @@
1
+ module PgEventstore
2
+ module SubscriptionFeedStrategy[unchecked Runner]
3
+ def add: (*Runner runners) -> Array[Runner]
4
+
5
+ def any?: -> bool
6
+
7
+ def feed: -> void
8
+
9
+ def size: -> Integer
10
+ end
11
+ end
@@ -4,26 +4,27 @@ module PgEventstore
4
4
 
5
5
  extend Forwardable
6
6
 
7
- @basic_runner: PgEventstore::BasicRunner
8
- @commands_handler: PgEventstore::CommandsHandler
9
- @subscriptions_lifecycle: PgEventstore::SubscriptionsLifecycle
10
- @subscriptions_set_lifecycle: PgEventstore::SubscriptionsSetLifecycle
7
+ @basic_runner: BasicRunner
8
+ @commands_handler: CommandsHandler
9
+ @events_subscription_position_worker: EventsSubscriptionPositionWorker?
10
+ @subscriptions_lifecycle: SubscriptionsLifecycle
11
+ @subscriptions_set_lifecycle: SubscriptionsSetLifecycle
11
12
 
12
13
  attr_reader config_name: Symbol
13
14
 
14
15
  def initialize: (
15
16
  config_name: Symbol,
16
- subscriptions_set_lifecycle: PgEventstore::SubscriptionsSetLifecycle,
17
- subscriptions_lifecycle: PgEventstore::SubscriptionsLifecycle
17
+ subscriptions_set_lifecycle: SubscriptionsSetLifecycle,
18
+ subscriptions_lifecycle: SubscriptionsLifecycle
18
19
  ) -> void
19
20
 
20
- def id: () -> Integer?
21
+ def id: -> Integer?
21
22
 
22
- def start_all: () -> void
23
+ def start_all: -> void
23
24
 
24
- def stop_all: () -> void
25
+ def stop_all: -> void
25
26
 
26
- def attach_runner_callbacks: () -> void
27
+ def attach_runner_callbacks: -> void
27
28
 
28
29
  private
29
30
 
@@ -31,5 +32,7 @@ module PgEventstore
31
32
  Symbol config_name,
32
33
  SubscriptionsSetLifecycle subscriptions_set_lifecycle
33
34
  ) -> Array[RunnerRecoveryStrategy]
35
+
36
+ def requires_subscription_position_assignment?: -> bool
34
37
  end
35
38
  end
@@ -5,7 +5,7 @@ module PgEventstore
5
5
 
6
6
  def initialize: () -> void
7
7
 
8
- def track_exec_time: () { () -> untyped } -> untyped
8
+ def track_exec_time: (Integer events_number) { () -> untyped } -> untyped
9
9
 
10
10
  def average_event_processing_time: () -> Float
11
11
  end
@@ -1,9 +1,14 @@
1
1
  module PgEventstore
2
2
  class SubscriptionRunner
3
3
  extend Forwardable
4
- MAX_EVENTS_PER_CHUNK: Integer
4
+ DEFAULT_MAX_EVENTS_PER_CHUNK: Integer
5
5
  MIN_EVENTS_PER_CHUNK: Integer
6
- INITIAL_EVENTS_PER_CHUNK: Integer
6
+ DEFAULT_INITIAL_EVENTS_PER_CHUNK: Integer
7
+
8
+ @events_processor: EventsProcessor
9
+ @initial_events_per_chunk: Integer
10
+ @max_events_per_chunk: Integer
11
+ @stats: SubscriptionHandlerPerformance
7
12
 
8
13
  # Returns the value of attribute subscription.
9
14
  attr_reader subscription: Subscription
@@ -12,13 +17,12 @@ module PgEventstore
12
17
  stats: SubscriptionHandlerPerformance,
13
18
  events_processor: EventsProcessor,
14
19
  subscription: Subscription,
15
- position_evaluation: SubscriptionPositionEvaluation,
20
+ ?initial_events_per_chunk: Integer,
21
+ ?max_events_per_chunk: Integer,
16
22
  ) -> void
17
23
 
18
24
  def next_chunk_query_opts: () -> ::Hash[untyped, untyped]
19
25
 
20
- def next_chunk_safe?: -> bool
21
-
22
26
  def time_to_feed?: () -> bool
23
27
 
24
28
  def next_chunk_global_position: () -> Integer
@@ -26,5 +30,9 @@ module PgEventstore
26
30
  def estimate_events_number: () -> Integer
27
31
 
28
32
  def attach_callbacks: () -> void
33
+
34
+ private
35
+
36
+ def subscription_from_position: -> Integer
29
37
  end
30
38
  end
@@ -1,13 +1,13 @@
1
1
  module PgEventstore
2
2
  class SubscriptionRunnersFeeder
3
- # _@param_ `config_name`
3
+ @config_name: Symbol
4
+
4
5
  def initialize: (Symbol config_name) -> void
5
6
 
6
- # _@param_ `runners`
7
- def feed: (::Array[PgEventstore::SubscriptionRunner] runners) -> void
7
+ def feed: (::Array[SubscriptionRunner] runners) -> void
8
8
 
9
- def connection: () -> PgEventstore::Connection
9
+ private
10
10
 
11
- def subscription_queries: () -> PgEventstore::SubscriptionQueries
11
+ def connection: -> Connection
12
12
  end
13
13
  end
@@ -4,15 +4,15 @@ module PgEventstore
4
4
 
5
5
  @config_name: Symbol
6
6
 
7
- @subscriptions_set_lifecycle: PgEventstore::SubscriptionsSetLifecycle
7
+ @subscriptions_set_lifecycle: SubscriptionsSetLifecycle
8
8
 
9
9
  @subscriptions_pinged_at: Time
10
10
 
11
11
  @force_lock: bool
12
12
 
13
- attr_reader runners: Array[PgEventstore::SubscriptionRunner]
13
+ attr_reader runners: Array[SubscriptionRunner]
14
14
 
15
- def initialize: (Symbol config_name, PgEventstore::SubscriptionsSetLifecycle subscriptions_set_lifecycle, ?force_lock: bool)-> void
15
+ def initialize: (Symbol config_name, SubscriptionsSetLifecycle subscriptions_set_lifecycle, ?force_lock: bool)-> void
16
16
 
17
17
  def force_locked?: -> bool
18
18
 
@@ -20,8 +20,6 @@ module PgEventstore
20
20
 
21
21
  def ping_subscriptions: -> void
22
22
 
23
- def subscriptions: -> Array[PgEventstore::Subscription]
24
-
25
- def force_lock!: -> void
23
+ def subscriptions: -> Array[Subscription]
26
24
  end
27
25
  end
@@ -3,46 +3,36 @@ module PgEventstore
3
3
  extend Forwardable
4
4
 
5
5
  @set_name: String
6
- @subscription_feeder: PgEventstore::SubscriptionFeeder
7
- @subscriptions_lifecycle: PgEventstore::SubscriptionsLifecycle
8
- @subscriptions_set_lifecycle: PgEventstore::SubscriptionsSetLifecycle
9
-
10
- def self.callbacks: () -> PgEventstore::Callbacks
11
-
12
- # _@param_ `config`
13
- #
14
- # _@param_ `set_name`
15
- #
16
- # _@param_ `max_retries` — max number of retries of failed SubscriptionsSet
17
- #
18
- # _@param_ `retries_interval` — a delay between retries of failed SubscriptionsSet
6
+ @subscription_feeder: SubscriptionFeeder
7
+ @subscriptions_lifecycle: SubscriptionsLifecycle
8
+ @subscriptions_set_lifecycle: SubscriptionsSetLifecycle
9
+
10
+ def self.callbacks: () -> Callbacks
11
+
19
12
  def initialize: (
20
- config: PgEventstore::Config,
13
+ config: Config,
21
14
  set_name: String,
22
15
  ?max_retries: Integer?,
23
16
  ?retries_interval: Integer?,
24
17
  ?force_lock: bool
25
18
  ) -> void
26
19
 
20
+ def create_replication: (
21
+ String subscription_name,
22
+ Symbol primary_config_name,
23
+ ?options: ::Hash[untyped, untyped],
24
+ ?max_events_to_replicate: Integer,
25
+ ?pull_interval: Integer | Float,
26
+ ?max_retries: Integer,
27
+ ?retries_interval: Integer | Float,
28
+ ?restart_terminator: _RestartTerminator?,
29
+ ?failed_subscription_notifier: _FailedSubscriptionNotifier?,
30
+ ?graceful_shutdown_timeout: Integer | Float,
31
+ ?in_batches: bool,
32
+ ) -> void
33
+
27
34
  def config_name: () -> Symbol
28
35
 
29
- # _@param_ `subscription_name` — subscription's name
30
- #
31
- # _@param_ `handler` — subscription's handler
32
- #
33
- # _@param_ `options` — request options
34
- #
35
- # _@param_ `middlewares` — provide a list of middleware names to override a config's middlewares
36
- #
37
- # _@param_ `pull_interval` — an interval in seconds to determine how often to query new events of the given subscription.
38
- #
39
- # _@param_ `max_retries` — max number of retries of failed Subscription
40
- #
41
- # _@param_ `retries_interval` — a delay between retries of failed Subscription
42
- #
43
- # _@param_ `restart_terminator` — a callable object which is invoked with PgEventstore::Subscription instance to determine whether restarts should be stopped(true - stops restarts, false - continues restarts)
44
- #
45
- # _@param_ `failed_subscription_notifier` - a callable object which is invoked with PgEventstore::Subscription instance and error instance after the related subscription died due to error and no longer can be automatically restarted due to max retries number reached. You can use this hook to send a notification about failed subscription.
46
36
  def subscribe: (
47
37
  String subscription_name,
48
38
  handler: _SubscriptionHandler,
@@ -54,26 +44,22 @@ module PgEventstore
54
44
  ?restart_terminator: _RestartTerminator?,
55
45
  ?failed_subscription_notifier: _FailedSubscriptionNotifier?,
56
46
  ?graceful_shutdown_timeout: Integer | Float,
47
+ ?in_batches: bool,
57
48
  ) -> void
58
49
 
59
- def subscriptions: () -> ::Array[PgEventstore::Subscription]
50
+ def subscriptions: () -> ::Array[Subscription]
60
51
 
61
- def subscriptions_set: () -> PgEventstore::SubscriptionsSet?
52
+ def subscriptions_set: () -> SubscriptionsSet?
62
53
 
63
- # _@param_ `middlewares`
64
- #
65
- # _@param_ `handler`
66
- def create_raw_event_handler: (::Array[Symbol]? middlewares, _SubscriptionHandler handler) -> _RawEventHandler
54
+ def deserializer: (::Array[Symbol]? middlewares) -> EventDeserializer
67
55
 
68
- # _@param_ `middlewares`
69
- def select_middlewares: (?::Array[Symbol]? middlewares) -> ::Array[PgEventstore::Middleware]
56
+ def select_middlewares: (?::Array[Symbol]? middlewares) -> ::Array[Middleware]
70
57
 
71
- def start!: () -> PgEventstore::BasicRunner
58
+ def start!: () -> BasicRunner
72
59
 
73
- def start: () -> PgEventstore::BasicRunner?
60
+ def start: () -> BasicRunner?
74
61
 
75
- # Returns the value of attribute config.
76
- attr_accessor config: PgEventstore::Config
62
+ attr_accessor config: Config
77
63
 
78
64
  private
79
65
 
@@ -0,0 +1,4 @@
1
+ module PgEventstore
2
+ class SynchronizedArray[unchecked out Elem] < Array[Elem]
3
+ end
4
+ end
@@ -1,28 +1,35 @@
1
1
  module PgEventstore
2
2
  class Utils
3
- # _@param_ `object`
4
- def self.deep_transform_keys: (untyped object) { (untyped key) -> untyped } -> Object
3
+ def self.assert!: (boolish truthy, String? message) -> void
5
4
 
6
- # _@param_ `object`
7
- def self.deep_dup: (untyped object) -> Object
5
+ def self.assert_node_role!: (Config config, Array[Symbol] expected_roles) -> void
6
+
7
+ def self.benchmark: { -> untyped } -> Float
8
+
9
+ def self.deep_transform_keys: (untyped object) { (untyped key) -> untyped } -> untyped
10
+
11
+ def self.deep_dup: (untyped object) -> untyped
8
12
 
9
13
  def self.deprecation_warning: (String message) -> void
10
14
 
11
- # _@param_ `array`
12
- #
13
- # _@return_ — positional variables, based on array size. Example: "$1, $2, $3"
15
+ def self.missing_implementation!: (untyped obj) -> void
16
+
14
17
  def self.positional_vars: (::Array[untyped] array) -> String
15
18
 
16
- # _@param_ `error`
17
19
  def self.error_info: (StandardError error) -> ::Hash[untyped, untyped]
18
20
 
19
- # _@param_ `str`
21
+ def self.read_pid: (String file_path) -> String?
22
+
23
+ def self.remove_file: (String file_path) -> void
24
+
20
25
  def self.underscore_str: (String str) -> String
21
26
 
22
27
  def self.original_global_position: (Hash[untyped, untyped] raw_event) -> Integer
23
28
 
24
- def self.unwrap_exception: (PgEventstore::WrappedException | StandardError wrapped_exception)-> StandardError
29
+ def self.unwrap_exception: (WrappedException | StandardError wrapped_exception) -> StandardError
30
+
31
+ def self.wrap_exception: (StandardError exception, **untyped extra) -> WrappedException
25
32
 
26
- def self.wrap_exception: (StandardError exception, **untyped extra)-> PgEventstore::WrappedException
33
+ def self.write_to_file: (String file_path, String content) -> void
27
34
  end
28
35
  end
@@ -11,7 +11,7 @@ module PgEventstore
11
11
 
12
12
  def asset_url: (String path) -> String
13
13
 
14
- def connection: -> PgEventstore::Connection
14
+ def connection: -> Connection
15
15
 
16
16
  def current_config: -> Symbol
17
17
 
@@ -19,13 +19,15 @@ module PgEventstore
19
19
 
20
20
  def escape_empty_string: (String? string) -> String?
21
21
 
22
- def events_filter: -> Array[String]?
22
+ def events_filter: -> Array[String | Hash[untyped, untyped]]
23
23
 
24
24
  def flash_message=: (({ message: String, kind: String }) val)-> String
25
25
 
26
26
  def h: (String text) -> String
27
27
 
28
- def paginated_json_response: (PgEventstore::Web::Paginator::BaseCollection collection) -> void
28
+ def markers_filter: -> Array[String]
29
+
30
+ def paginated_json_response: (Paginator::BaseCollection collection) -> void
29
31
 
30
32
  def redirect_back_url: (fallback_url: String) -> String
31
33
 
@@ -38,6 +40,14 @@ module PgEventstore
38
40
  def system_stream: -> String?
39
41
 
40
42
  def unescape_empty_string: (String? string) -> String?
43
+
44
+ def extract_event_types_filter: (Hash[untyped, untyped] options) -> Array[String | Hash[untyped, untyped]]
45
+
46
+ def extract_streams_filter: (Hash[untyped, untyped] options) -> Array[Hash[untyped, untyped]]
47
+
48
+ private
49
+
50
+ def normalize_markers: (Hash[untyped, untyped] hash) -> Array[String]
41
51
  end
42
52
  end
43
53
  end
@@ -2,6 +2,8 @@ module PgEventstore
2
2
  module Web
3
3
  module Paginator
4
4
  class BaseCollection
5
+ MIN_QUERY_SIZE_FOR_ADVANCE_SEARCH: Integer
6
+
5
7
  def initialize: (
6
8
  Symbol config_name,
7
9
  starting_id: (String | Integer)?,