pg_eventstore 2.0.0 → 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.
- checksums.yaml +4 -4
- data/.rubocop.yml +10 -1
- data/CHANGELOG.md +186 -20
- data/README.md +25 -15
- data/db/migrations/10_setup_pg_cron.rb +1 -23
- data/db/migrations/15_create_streams_global_index.sql +17 -0
- data/db/migrations/16_populate_streams_global_index.rb +150 -0
- data/db/migrations/17_create_events_global_index.sql +62 -0
- data/db/migrations/18_populate_events_global_index.rb +124 -0
- data/db/migrations/19_populate_events_global_index_p2.rb +25 -0
- data/db/migrations/20_migrate_subscriptions_current_position.sql +19 -0
- data/db/migrations/21_create_partitions_stats.sql +2 -0
- data/db/migrations/22_drop_streams_sql_view.sql +2 -0
- data/db/migrations/23_adjust_partitions_indexes.sql +5 -0
- data/db/migrations/24_drop_legacy_events_indexes.sql +3 -0
- data/db/migrations/25_add_parent_partitions_info_to_partitions.sql +16 -0
- data/db/migrations/26_change_events_stream_revision_type.rb +35 -0
- data/db/migrations/27_drop_events_horizon.sql +3 -0
- data/db/migrations/28_create_maintenance_tasks.sql +8 -0
- data/db/migrations/29_create_event_markers.sql +35 -0
- data/db/migrations/30_improve_partitions_search_in_admin_ui.rb +24 -0
- data/db/migrations/31_drop_events_id_default_value.sql +1 -0
- data/db/migrations/32_create_parittions_triggers.sql +101 -0
- data/docs/AGENTS.fragment.md +696 -0
- data/docs/admin_ui.md +3 -1
- data/docs/appending_events.md +110 -49
- data/docs/configuration.md +69 -36
- data/docs/event_tracing.md +55 -0
- data/docs/events_and_streams.md +54 -30
- data/docs/how_it_works.md +57 -16
- data/docs/linking_events.md +2 -1
- data/docs/maintenance.md +14 -5
- data/docs/multiple_commands.md +17 -8
- data/docs/reading_events.md +208 -43
- data/docs/reading_streams.md +50 -0
- data/docs/replication.md +99 -0
- data/docs/subscriptions.md +165 -35
- data/docs/writing_middleware.md +25 -8
- data/ext/pg_eventstore_ext/extconf.rb +5 -0
- data/ext/pg_eventstore_ext/pg_eventstore_ext.c +74 -0
- data/lib/pg_eventstore/async_runner.rb +63 -0
- data/lib/pg_eventstore/basic_config.rb +15 -0
- data/lib/pg_eventstore/chunks/chunk.rb +31 -0
- data/lib/pg_eventstore/chunks/read_api_events_index_chunk.rb +83 -0
- data/lib/pg_eventstore/chunks/replica_events_index_chunk.rb +35 -0
- data/lib/pg_eventstore/chunks/repository.rb +73 -0
- data/lib/pg_eventstore/chunks/subscription_checkpoint_chunk.rb +48 -0
- data/lib/pg_eventstore/chunks/subscription_events_index_chunk.rb +99 -0
- data/lib/pg_eventstore/chunks.rb +14 -0
- data/lib/pg_eventstore/client.rb +163 -50
- data/lib/pg_eventstore/commands/append.rb +62 -43
- data/lib/pg_eventstore/commands/delete_event.rb +7 -8
- data/lib/pg_eventstore/commands/delete_stream.rb +3 -3
- data/lib/pg_eventstore/commands/event_modifiers/prepare_link_event.rb +9 -7
- data/lib/pg_eventstore/commands/event_modifiers/prepare_regular_event.rb +12 -7
- data/lib/pg_eventstore/commands/link_to.rb +5 -5
- data/lib/pg_eventstore/commands/read.rb +23 -5
- data/lib/pg_eventstore/commands/read_grouped.rb +46 -0
- data/lib/pg_eventstore/commands/read_streams.rb +18 -0
- data/lib/pg_eventstore/commands/read_streams_paginated.rb +56 -0
- data/lib/pg_eventstore/commands/regular_stream_read_paginated.rb +4 -4
- data/lib/pg_eventstore/commands/revision_check/current_revision.rb +51 -0
- data/lib/pg_eventstore/commands/revision_check/event_type_revisions_comparison.rb +46 -0
- data/lib/pg_eventstore/commands/revision_check/expected_revision.rb +135 -0
- data/lib/pg_eventstore/commands/revision_check/stream_revision_check.rb +98 -0
- data/lib/pg_eventstore/commands/revision_check/stream_revision_comparison.rb +36 -0
- data/lib/pg_eventstore/commands/stream_revision.rb +14 -0
- data/lib/pg_eventstore/commands/system_stream_read_paginated.rb +4 -4
- data/lib/pg_eventstore/commands.rb +4 -2
- data/lib/pg_eventstore/config.rb +30 -9
- data/lib/pg_eventstore/connection.rb +21 -2
- data/lib/pg_eventstore/errors.rb +136 -10
- data/lib/pg_eventstore/event.rb +34 -2
- data/lib/pg_eventstore/event_deserializer.rb +5 -4
- data/lib/pg_eventstore/event_global_index.rb +118 -0
- data/lib/pg_eventstore/event_marker.rb +16 -0
- data/lib/pg_eventstore/event_marker_index.rb +25 -0
- data/lib/pg_eventstore/event_serializer.rb +6 -0
- data/lib/pg_eventstore/extensions/acts_as_configurable.rb +88 -0
- data/lib/pg_eventstore/extensions/options_defaults.rb +25 -0
- data/lib/pg_eventstore/extensions/options_extension.rb +2 -2
- data/lib/pg_eventstore/feature_marker.rb +18 -0
- data/lib/pg_eventstore/maintenance.rb +11 -6
- data/lib/pg_eventstore/middleware/event_tracing.rb +53 -0
- data/lib/pg_eventstore/partition.rb +6 -0
- data/lib/pg_eventstore/pg_connection.rb +70 -14
- data/lib/pg_eventstore/queries/event_marker_queries.rb +74 -0
- data/lib/pg_eventstore/queries/event_queries.rb +7 -93
- data/lib/pg_eventstore/queries/events_global_index_queries.rb +131 -0
- data/lib/pg_eventstore/queries/index_filtering_queries.rb +179 -0
- data/lib/pg_eventstore/queries/links_resolver.rb +4 -4
- data/lib/pg_eventstore/queries/maintenance_queries.rb +159 -42
- data/lib/pg_eventstore/queries/partition_queries.rb +45 -103
- data/lib/pg_eventstore/queries/replica_queries.rb +110 -0
- data/lib/pg_eventstore/queries/streams_global_index_queries.rb +163 -0
- data/lib/pg_eventstore/queries/transaction_queries.rb +52 -10
- data/lib/pg_eventstore/queries.rb +29 -1
- data/lib/pg_eventstore/query_builders/basic_filtering.rb +38 -5
- data/lib/pg_eventstore/query_builders/event_markers_filtering.rb +47 -0
- data/lib/pg_eventstore/query_builders/event_markers_index_filtering.rb +275 -0
- data/lib/pg_eventstore/query_builders/event_subscription_positions_filtering.rb +37 -0
- data/lib/pg_eventstore/query_builders/events_filtering.rb +15 -164
- data/lib/pg_eventstore/query_builders/events_global_index_filtering.rb +227 -0
- data/lib/pg_eventstore/query_builders/filters/collection.rb +324 -0
- data/lib/pg_eventstore/query_builders/filters/event_type_filter.rb +37 -0
- data/lib/pg_eventstore/query_builders/filters/filter_row.rb +54 -0
- data/lib/pg_eventstore/query_builders/filters/marker_filter.rb +20 -0
- data/lib/pg_eventstore/query_builders/filters/marker_filter_row.rb +49 -0
- data/lib/pg_eventstore/query_builders/filters/stream_filter.rb +48 -0
- data/lib/pg_eventstore/query_builders/index_based_events_filtering.rb +260 -0
- data/lib/pg_eventstore/query_builders/partitions_filtering.rb +175 -51
- data/lib/pg_eventstore/query_builders/read_cursor/stream_cursor.rb +122 -0
- data/lib/pg_eventstore/query_builders/streams_global_index_filtering.rb +83 -0
- data/lib/pg_eventstore/query_builders/subscription_events_filtering.rb +79 -0
- data/lib/pg_eventstore/query_strategy/async.rb +64 -0
- data/lib/pg_eventstore/query_strategy/foreground.rb +25 -0
- data/lib/pg_eventstore/query_strategy.rb +19 -0
- data/lib/pg_eventstore/raw_event.rb +46 -0
- data/lib/pg_eventstore/rspec/test_helpers.rb +21 -8
- data/lib/pg_eventstore/sql_builder.rb +87 -8
- data/lib/pg_eventstore/stream.rb +13 -16
- data/lib/pg_eventstore/stream_global_index.rb +28 -0
- data/lib/pg_eventstore/subscriptions/callback_handlers/events_processor_handlers.rb +5 -17
- data/lib/pg_eventstore/subscriptions/callback_handlers/events_subscription_position_worker_handlers.rb +36 -0
- data/lib/pg_eventstore/subscriptions/callback_handlers/subscription_feeder_handlers.rb +12 -0
- data/lib/pg_eventstore/subscriptions/callback_handlers/subscription_runner_handlers.rb +21 -7
- data/lib/pg_eventstore/subscriptions/events_processor.rb +20 -18
- data/lib/pg_eventstore/subscriptions/events_processor_consumer/multiple.rb +63 -0
- data/lib/pg_eventstore/subscriptions/events_processor_consumer/replica.rb +68 -0
- data/lib/pg_eventstore/subscriptions/events_processor_consumer/single.rb +62 -0
- data/lib/pg_eventstore/subscriptions/events_processor_consumer.rb +44 -0
- data/lib/pg_eventstore/subscriptions/events_subscription_position_worker.rb +68 -0
- data/lib/pg_eventstore/subscriptions/queries/event_subscription_position_queries.rb +177 -0
- data/lib/pg_eventstore/subscriptions/queries/subscription_queries.rb +78 -54
- data/lib/pg_eventstore/subscriptions/replica_subscription_handler.rb +140 -0
- data/lib/pg_eventstore/subscriptions/replica_subscription_runner.rb +9 -0
- data/lib/pg_eventstore/subscriptions/subscription.rb +2 -1
- data/lib/pg_eventstore/subscriptions/subscription_feed_strategies/collection.rb +36 -0
- data/lib/pg_eventstore/subscriptions/subscription_feed_strategies/index_read_strategy.rb +82 -0
- data/lib/pg_eventstore/subscriptions/subscription_feed_strategies/replication_strategy.rb +75 -0
- data/lib/pg_eventstore/subscriptions/subscription_feed_strategy.rb +31 -0
- data/lib/pg_eventstore/subscriptions/subscription_feeder.rb +24 -0
- data/lib/pg_eventstore/subscriptions/subscription_handler_performance.rb +4 -2
- data/lib/pg_eventstore/subscriptions/subscription_runner.rb +20 -9
- data/lib/pg_eventstore/subscriptions/subscription_runner_commands/reset_position.rb +1 -1
- data/lib/pg_eventstore/subscriptions/subscription_runners_feeder.rb +9 -18
- data/lib/pg_eventstore/subscriptions/subscriptions_lifecycle.rb +0 -12
- data/lib/pg_eventstore/subscriptions/subscriptions_manager.rb +74 -14
- data/lib/pg_eventstore/{subscriptions/synchronized_array.rb → synchronized_array.rb} +15 -0
- data/lib/pg_eventstore/tasks/setup.rake +2 -2
- data/lib/pg_eventstore/utils.rb +31 -0
- data/lib/pg_eventstore/version.rb +1 -1
- data/lib/pg_eventstore/web/application.rb +100 -16
- data/lib/pg_eventstore/web/paginator/base_collection.rb +5 -1
- data/lib/pg_eventstore/web/paginator/event_types_collection.rb +14 -4
- data/lib/pg_eventstore/web/paginator/events_collection.rb +29 -33
- data/lib/pg_eventstore/web/paginator/helpers.rb +16 -9
- data/lib/pg_eventstore/web/paginator/markers_collection.rb +48 -0
- data/lib/pg_eventstore/web/paginator/stream_contexts_collection.rb +13 -2
- data/lib/pg_eventstore/web/paginator/stream_ids_collection.rb +21 -11
- data/lib/pg_eventstore/web/paginator/stream_names_collection.rb +18 -4
- data/lib/pg_eventstore/web/paginator/streams_collection.rb +95 -0
- data/lib/pg_eventstore/web/public/javascripts/pg_eventstore.js +49 -22
- data/lib/pg_eventstore/web/subscriptions/set_collection.rb +1 -1
- data/lib/pg_eventstore/web/subscriptions/subscriptions.rb +1 -1
- data/lib/pg_eventstore/web/subscriptions/with_state/set_collection.rb +1 -1
- data/lib/pg_eventstore/web/subscriptions/with_state/subscriptions.rb +1 -1
- data/lib/pg_eventstore/web/views/home/dashboard.erb +11 -9
- data/lib/pg_eventstore/web/views/home/partials/event_filter.erb +18 -5
- data/lib/pg_eventstore/web/views/home/partials/events.erb +38 -1
- data/lib/pg_eventstore/web/views/home/partials/markers_filter.erb +18 -0
- data/lib/pg_eventstore/web/views/layouts/application.erb +6 -0
- data/lib/pg_eventstore/web/views/streams/index.erb +110 -0
- data/lib/pg_eventstore/web/views/streams/partials/streams.erb +11 -0
- data/lib/pg_eventstore/web/views/subscriptions/index.erb +4 -1
- data/lib/pg_eventstore/web.rb +2 -0
- data/lib/pg_eventstore.rb +23 -60
- data/pg_eventstore.gemspec +6 -4
- data/sig/interfaces/_raw_events_handler.rbs +3 -0
- data/sig/interfaces/subscription_handler.rbs +1 -1
- data/sig/pg/result.rbs +9 -0
- data/sig/pg_eventstore/async_runner.rbs +13 -0
- data/sig/pg_eventstore/basic_config.rbs +9 -0
- data/sig/pg_eventstore/chunks/chunk.rbs +13 -0
- data/sig/pg_eventstore/chunks/read_api_events_index_chunk.rbs +30 -0
- data/sig/pg_eventstore/chunks/replica_events_index_chunk.rbs +11 -0
- data/sig/pg_eventstore/chunks/repository.rbs +22 -0
- data/sig/pg_eventstore/chunks/subscription_checkpoint_chunk.rbs +18 -0
- data/sig/pg_eventstore/chunks/subscription_events_index_chunk.rbs +37 -0
- data/sig/pg_eventstore/client.rbs +40 -42
- data/sig/pg_eventstore/commands/append.rbs +11 -25
- data/sig/pg_eventstore/commands/event_modifiers/prepare_link_event.rbs +9 -12
- data/sig/pg_eventstore/commands/event_modifiers/prepare_regular_event.rbs +5 -4
- data/sig/pg_eventstore/commands/link_to.rbs +6 -11
- data/sig/pg_eventstore/commands/read.rbs +2 -5
- data/sig/pg_eventstore/commands/read_grouped.rbs +7 -0
- data/sig/pg_eventstore/commands/read_streams.rbs +7 -0
- data/sig/pg_eventstore/commands/read_streams_paginated.rbs +16 -0
- data/sig/pg_eventstore/commands/regular_stream_read_paginated.rbs +9 -17
- data/sig/pg_eventstore/commands/revision_check/current_revision.rbs +25 -0
- data/sig/pg_eventstore/commands/revision_check/event_type_revisions_comparison.rbs +14 -0
- data/sig/pg_eventstore/commands/revision_check/expected_revision.rbs +67 -0
- data/sig/pg_eventstore/commands/revision_check/stream_revision_check.rbs +20 -0
- data/sig/pg_eventstore/commands/revision_check/stream_revision_comparison.rbs +9 -0
- data/sig/pg_eventstore/commands/stream_revision.rbs +7 -0
- data/sig/pg_eventstore/commands/system_stream_read_paginated.rbs +9 -14
- data/sig/pg_eventstore/config.rbs +15 -6
- data/sig/pg_eventstore/connection.rbs +11 -18
- data/sig/pg_eventstore/errors.rbs +64 -34
- data/sig/pg_eventstore/event.rbs +16 -2
- data/sig/pg_eventstore/event_deserializer.rbs +5 -10
- data/sig/pg_eventstore/event_global_index.rbs +60 -0
- data/sig/pg_eventstore/event_marker.rbs +9 -0
- data/sig/pg_eventstore/event_marker_index.rbs +12 -0
- data/sig/pg_eventstore/extensions/acts_as_configurable.rbs +29 -0
- data/sig/pg_eventstore/extensions/options_defaults.rbs +7 -0
- data/sig/pg_eventstore/feature_marker.rbs +10 -0
- data/sig/pg_eventstore/maintenance.rbs +12 -8
- data/sig/pg_eventstore/middleware/event_trace.rbs +14 -0
- data/sig/pg_eventstore/partition.rbs +2 -4
- data/sig/pg_eventstore/pg_connection.rbs +8 -0
- data/sig/pg_eventstore/queries/event_marker_queries.rbs +21 -0
- data/sig/pg_eventstore/queries/event_queries.rbs +4 -36
- data/sig/pg_eventstore/queries/events_global_index_queries.rbs +37 -0
- data/sig/pg_eventstore/queries/index_filtering_queries.rbs +50 -0
- data/sig/pg_eventstore/queries/links_resolver.rbs +5 -9
- data/sig/pg_eventstore/queries/maintenance_queries.rbs +12 -9
- data/sig/pg_eventstore/queries/partition_queries.rbs +32 -67
- data/sig/pg_eventstore/queries/replica_queries.rbs +31 -0
- data/sig/pg_eventstore/queries/streams_global_index_queries.rbs +39 -0
- data/sig/pg_eventstore/queries/transaction_queries.rbs +2 -0
- data/sig/pg_eventstore/queries.rbs +11 -21
- data/sig/pg_eventstore/query_builders/basic_filtering.rbs +10 -3
- data/sig/pg_eventstore/query_builders/event_markers_filtering.rbs +17 -0
- data/sig/pg_eventstore/query_builders/event_markers_index_filtering.rbs +69 -0
- data/sig/pg_eventstore/query_builders/event_subscription_positions_filtering.rbs +15 -0
- data/sig/pg_eventstore/query_builders/events_filtering_query.rbs +9 -51
- data/sig/pg_eventstore/query_builders/events_global_index_filtering.rbs +68 -0
- data/sig/pg_eventstore/query_builders/filters/collection.rbs +84 -0
- data/sig/pg_eventstore/query_builders/filters/event_type_filter.rbs +19 -0
- data/sig/pg_eventstore/query_builders/filters/filter_row.rbs +21 -0
- data/sig/pg_eventstore/query_builders/filters/marker_filter.rbs +13 -0
- data/sig/pg_eventstore/query_builders/filters/marker_filter_row.rbs +19 -0
- data/sig/pg_eventstore/query_builders/filters/stream_filter.rbs +24 -0
- data/sig/pg_eventstore/query_builders/index_based_events_filtering.rbs +60 -0
- data/sig/pg_eventstore/query_builders/partitions_filtering.rbs +29 -10
- data/sig/pg_eventstore/query_builders/read_cursor/stream_cursor.rbs +47 -0
- data/sig/pg_eventstore/query_builders/streams_global_index_filtering.rbs +27 -0
- data/sig/pg_eventstore/query_builders/subscription_events_filtering.rbs +26 -0
- data/sig/pg_eventstore/query_strategy/async.rbs +17 -0
- data/sig/pg_eventstore/query_strategy/foreground.rbs +11 -0
- data/sig/pg_eventstore/query_strategy.rbs +7 -0
- data/sig/pg_eventstore/raw_event.rbs +20 -0
- data/sig/pg_eventstore/sql_builder.rbs +32 -10
- data/sig/pg_eventstore/stream.rbs +10 -18
- data/sig/pg_eventstore/stream_global_index.rbs +14 -0
- data/sig/pg_eventstore/subscriptions/callback_handlers/events_processor_handlers.rbs +5 -4
- data/sig/pg_eventstore/subscriptions/callback_handlers/events_subscription_position_worker_handlers.rbs +9 -0
- data/sig/pg_eventstore/subscriptions/callback_handlers/subscription_feeder_handlers.rbs +17 -12
- data/sig/pg_eventstore/subscriptions/callback_handlers/subscription_runner_handlers.rbs +17 -6
- data/sig/pg_eventstore/subscriptions/event_subscription_position_queries.rbs +30 -0
- data/sig/pg_eventstore/subscriptions/events_processor.rbs +12 -5
- data/sig/pg_eventstore/subscriptions/events_processor_consumer/multiple.rbs +17 -0
- data/sig/pg_eventstore/subscriptions/events_processor_consumer/replica.rbs +17 -0
- data/sig/pg_eventstore/subscriptions/events_processor_consumer/single.rbs +17 -0
- data/sig/pg_eventstore/subscriptions/events_processor_consumer.rbs +14 -0
- data/sig/pg_eventstore/subscriptions/events_subscription_position_worker.rbs +28 -0
- data/sig/pg_eventstore/subscriptions/queries/subscription_queries.rbs +7 -39
- data/sig/pg_eventstore/subscriptions/replica_subscription_handler.rbs +33 -0
- data/sig/pg_eventstore/subscriptions/replica_subscription_runner.rbs +4 -0
- data/sig/pg_eventstore/subscriptions/subscription_feed_strategy/collection.rbs +14 -0
- data/sig/pg_eventstore/subscriptions/subscription_feed_strategy/index_read_strategy.rbs +23 -0
- data/sig/pg_eventstore/subscriptions/subscription_feed_strategy/replication_strategy.rbs +23 -0
- data/sig/pg_eventstore/subscriptions/subscription_feed_strategy.rbs +11 -0
- data/sig/pg_eventstore/subscriptions/subscription_feeder.rbs +13 -10
- data/sig/pg_eventstore/subscriptions/subscription_handler_performance.rbs +1 -1
- data/sig/pg_eventstore/subscriptions/subscription_runner.rbs +13 -2
- data/sig/pg_eventstore/subscriptions/subscription_runners_feeder.rbs +1 -8
- data/sig/pg_eventstore/subscriptions/subscriptions_lifecycle.rbs +4 -6
- data/sig/pg_eventstore/subscriptions/subscriptions_manager.rbs +29 -43
- data/sig/pg_eventstore/synchronized_array.rbs +4 -0
- data/sig/pg_eventstore/utils.rbs +10 -11
- data/sig/pg_eventstore/web/application.rbs +13 -3
- data/sig/pg_eventstore/web/paginator/base_collection.rbs +2 -0
- data/sig/pg_eventstore/web/paginator/event_types_collection.rbs +4 -0
- data/sig/pg_eventstore/web/paginator/events_collection.rbs +11 -11
- data/sig/pg_eventstore/web/paginator/helpers.rbs +6 -15
- data/sig/pg_eventstore/web/paginator/markers_collection.rbs +13 -0
- data/sig/pg_eventstore/web/paginator/stream_contexts_collection.rbs +4 -0
- data/sig/pg_eventstore/web/paginator/stream_names_collection.rbs +4 -0
- data/sig/pg_eventstore/web/paginator/streams_collection.rbs +30 -0
- data/sig/pg_eventstore.rbs +8 -26
- metadata +175 -20
- data/Dockerfile +0 -3
- data/lib/pg_eventstore/commands/all_stream_read_grouped.rb +0 -69
- data/lib/pg_eventstore/commands/regular_stream_read_grouped.rb +0 -31
- data/lib/pg_eventstore/subscriptions/queries/subscription_service_queries.rb +0 -78
- data/lib/pg_eventstore/web/views/home/partials/system_stream_filter.erb +0 -15
- data/sig/pg_eventstore/commands/all_stream_read_grouped.rbs +0 -16
- data/sig/pg_eventstore/commands/regular_stream_read_grouped.rbs +0 -8
- data/sig/pg_eventstore/subscriptions/queries/subscription_service_queries.rbs +0 -19
- data/sig/pg_eventstore/subscriptions/synchronized_array.rbs +0 -4
- /data/sig/interfaces/{_raw_event_handler.rbs → raw_event_handler.rbs} +0 -0
|
@@ -2,28 +2,33 @@ module PgEventstore
|
|
|
2
2
|
class SubscriptionFeederHandlers
|
|
3
3
|
include Extensions::CallbackHandlersExtension
|
|
4
4
|
|
|
5
|
-
def self.
|
|
5
|
+
def self.start_events_subscription_position_worker: (EventsSubscriptionPositionWorker worker) -> void
|
|
6
6
|
|
|
7
|
-
def self.
|
|
7
|
+
def self.stop_events_subscription_position_worker: (EventsSubscriptionPositionWorker worker) -> void
|
|
8
8
|
|
|
9
|
-
def self.
|
|
9
|
+
def self.update_subscriptions_set_state: (SubscriptionsSetLifecycle subscriptions_set_lifecycle,
|
|
10
|
+
String state) -> void
|
|
10
11
|
|
|
11
|
-
def self.
|
|
12
|
+
def self.lock_subscriptions: (SubscriptionsLifecycle subscriptions_lifecycle) -> void
|
|
12
13
|
|
|
13
|
-
def self.
|
|
14
|
+
def self.start_runners: (SubscriptionsLifecycle subscriptions_lifecycle) -> void
|
|
14
15
|
|
|
15
|
-
def self.
|
|
16
|
+
def self.start_cmds_handler: (CommandsHandler cmds_handler) -> void
|
|
16
17
|
|
|
17
|
-
def self.
|
|
18
|
+
def self.persist_error_info: (SubscriptionsSetLifecycle subscriptions_set_lifecycle, StandardError error) -> void
|
|
18
19
|
|
|
19
|
-
def self.
|
|
20
|
+
def self.ping_subscriptions_set: (SubscriptionsSetLifecycle subscriptions_set_lifecycle) -> void
|
|
20
21
|
|
|
21
|
-
def self.
|
|
22
|
+
def self.feed_runners: (SubscriptionsLifecycle subscriptions_lifecycle, Symbol config_name) -> void
|
|
22
23
|
|
|
23
|
-
def self.
|
|
24
|
+
def self.ping_subscriptions: (SubscriptionsLifecycle subscriptions_lifecycle) -> void
|
|
24
25
|
|
|
25
|
-
def self.
|
|
26
|
+
def self.stop_runners: (SubscriptionsLifecycle subscriptions_lifecycle) -> void
|
|
26
27
|
|
|
27
|
-
def self.
|
|
28
|
+
def self.reset_subscriptions_set: (SubscriptionsSetLifecycle subscriptions_set_lifecycle) -> void
|
|
29
|
+
|
|
30
|
+
def self.stop_commands_handler: (CommandsHandler cmds_handler) -> void
|
|
31
|
+
|
|
32
|
+
def self.update_subscriptions_set_restarts: (SubscriptionsSetLifecycle subscriptions_set_lifecycle) -> void
|
|
28
33
|
end
|
|
29
34
|
end
|
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
module PgEventstore
|
|
2
2
|
class SubscriptionRunnerHandlers
|
|
3
|
-
def self.
|
|
3
|
+
def self.checkpoint: (Subscription subscription, Integer global_position) -> void
|
|
4
4
|
|
|
5
|
-
def self.
|
|
5
|
+
def self.track_exec_time: (
|
|
6
|
+
SubscriptionHandlerPerformance stats, ^() -> void,
|
|
7
|
+
Integer _current_position,
|
|
8
|
+
Integer events_number
|
|
9
|
+
) -> void
|
|
6
10
|
|
|
7
|
-
def self.
|
|
11
|
+
def self.update_subscription_stats: (
|
|
12
|
+
Subscription subscription,
|
|
13
|
+
SubscriptionHandlerPerformance stats,
|
|
14
|
+
Integer current_position,
|
|
15
|
+
Integer events_number
|
|
16
|
+
) -> void
|
|
8
17
|
|
|
9
|
-
def self.
|
|
18
|
+
def self.update_subscription_error: (Subscription subscription, WrappedException error) -> void
|
|
10
19
|
|
|
11
|
-
def self.
|
|
20
|
+
def self.update_subscription_chunk_stats: (Subscription subscription, Integer subscription_position) -> void
|
|
12
21
|
|
|
13
|
-
def self.
|
|
22
|
+
def self.update_subscription_restarts: (Subscription subscription) -> void
|
|
23
|
+
|
|
24
|
+
def self.update_subscription_state: (Subscription subscription, String state) -> void
|
|
14
25
|
end
|
|
15
26
|
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
module PgEventstore
|
|
2
|
+
class EventSubscriptionPositionQueries
|
|
3
|
+
ASSIGN_SUBSCRIPTION_POSITIONS_LOCK_ID: Integer
|
|
4
|
+
MAX_INDEX_RECORDS_TO_UPDATE_SUBSCRIPTION_POSITION: Integer
|
|
5
|
+
REINDEX_PERIOD: Integer
|
|
6
|
+
UNPROCESSED_POSITIONS_INDEX_NAME: String
|
|
7
|
+
UNPROCESSED_POSITIONS_INDEX_SIZE_THRESHOLD: Integer
|
|
8
|
+
UNPROCESSED_POSITIONS_LOCK_EXPIRES_IN: Integer
|
|
9
|
+
|
|
10
|
+
attr_reader connection: Connection
|
|
11
|
+
|
|
12
|
+
def initialize: (Connection connection) -> void
|
|
13
|
+
|
|
14
|
+
def create_unprocessed_positions: (Array[Hash[String, untyped]] raw_events) -> void
|
|
15
|
+
|
|
16
|
+
def max_subscription_position: -> Integer?
|
|
17
|
+
|
|
18
|
+
def reindex_unprocessed_positions: -> Time?
|
|
19
|
+
|
|
20
|
+
def subscription_positions_from_db: (Array[Event] events) -> Hash[Integer, Integer?]
|
|
21
|
+
|
|
22
|
+
def assign_subscription_position: -> Integer?
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
|
|
26
|
+
def index_size: (String index_name) -> Integer
|
|
27
|
+
|
|
28
|
+
def transaction_queries: -> TransactionQueries
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
module PgEventstore
|
|
2
2
|
class EventsProcessor
|
|
3
|
-
include
|
|
3
|
+
include Extensions::CallbacksExtension
|
|
4
|
+
|
|
4
5
|
extend Forwardable
|
|
5
6
|
|
|
7
|
+
@basic_runner: BasicRunner
|
|
8
|
+
@consumer: EventsProcessorConsumer
|
|
9
|
+
@events_repository: Chunks::Repository
|
|
10
|
+
@repository_cond: MonitorMixin::ConditionVariable
|
|
11
|
+
|
|
6
12
|
%a{rbs:test:skip} def initialize: (
|
|
7
|
-
_RawEventHandler handler,
|
|
8
13
|
graceful_shutdown_timeout: Float | Integer,
|
|
14
|
+
consumer: EventsProcessorConsumer,
|
|
15
|
+
?events_repository: Chunks::Repository,
|
|
9
16
|
?recovery_strategies: Array[RunnerRecoveryStrategy]
|
|
10
17
|
) -> void
|
|
11
18
|
|
|
12
|
-
def feed: (::
|
|
19
|
+
def feed: (Chunks::Chunk[EventGlobalIndex, Hash[String, untyped]] chunk) -> void
|
|
13
20
|
|
|
14
|
-
def
|
|
21
|
+
def events_left_in_repo: () -> Integer
|
|
15
22
|
|
|
16
|
-
def
|
|
23
|
+
def clear_events_repository: () -> void
|
|
17
24
|
|
|
18
25
|
def process_event: (::Hash[untyped, untyped] raw_event) -> void
|
|
19
26
|
|
|
@@ -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
|
-
|
|
4
|
-
|
|
3
|
+
@query_strategy: QueryStrategy
|
|
4
|
+
|
|
5
|
+
attr_accessor connection: Connection
|
|
6
|
+
|
|
7
|
+
def initialize: (Connection connection, QueryStrategy query_strategy) -> void
|
|
8
|
+
|
|
9
|
+
def create_or_replace_table_function: (Integer id, Hash[untyped, untyped] options, Integer locked_by) -> void
|
|
5
10
|
|
|
6
|
-
# _@param_ `attrs`
|
|
7
11
|
def find_or_create_by: (::Hash[untyped, untyped] attrs) -> ::Hash[Symbol, untyped]
|
|
8
12
|
|
|
9
|
-
# _@param_ `attrs`
|
|
10
13
|
def find_by: (::Hash[untyped, untyped] attrs) -> ::Hash[Symbol, untyped]?
|
|
11
14
|
|
|
12
|
-
# _@param_ `attrs`
|
|
13
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
19
|
def find!: (Integer id) -> ::Hash[Symbol, untyped]
|
|
19
20
|
|
|
20
|
-
# _@param_ `attrs`
|
|
21
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
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) -> SQLBuilder
|
|
56
|
-
|
|
57
|
-
# _@param_ `builders`
|
|
58
31
|
def union_builders: (::Array[SQLBuilder] builders) -> SQLBuilder
|
|
59
32
|
|
|
60
33
|
def transaction_queries: () -> TransactionQueries
|
|
61
34
|
|
|
62
35
|
def links_resolver: () -> LinksResolver
|
|
63
36
|
|
|
64
|
-
# _@param_ `hash`
|
|
65
37
|
def deserialize: (::Hash[String, untyped] hash) -> ::Hash[Symbol, untyped]
|
|
66
38
|
|
|
67
|
-
# _@param_ `attrs`
|
|
68
39
|
def find_by_attrs_builder: (::Hash[untyped, untyped] attrs) -> SQLBuilder
|
|
69
|
-
|
|
70
|
-
# Returns the value of attribute connection.
|
|
71
|
-
attr_accessor connection: Connection
|
|
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,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
|
|
@@ -4,26 +4,27 @@ module PgEventstore
|
|
|
4
4
|
|
|
5
5
|
extend Forwardable
|
|
6
6
|
|
|
7
|
-
@basic_runner:
|
|
8
|
-
@commands_handler:
|
|
9
|
-
@
|
|
10
|
-
@
|
|
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:
|
|
17
|
-
subscriptions_lifecycle:
|
|
17
|
+
subscriptions_set_lifecycle: SubscriptionsSetLifecycle,
|
|
18
|
+
subscriptions_lifecycle: SubscriptionsLifecycle
|
|
18
19
|
) -> void
|
|
19
20
|
|
|
20
|
-
def id:
|
|
21
|
+
def id: -> Integer?
|
|
21
22
|
|
|
22
|
-
def start_all:
|
|
23
|
+
def start_all: -> void
|
|
23
24
|
|
|
24
|
-
def stop_all:
|
|
25
|
+
def stop_all: -> void
|
|
25
26
|
|
|
26
|
-
def attach_runner_callbacks:
|
|
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
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
module PgEventstore
|
|
2
2
|
class SubscriptionRunner
|
|
3
3
|
extend Forwardable
|
|
4
|
-
|
|
4
|
+
DEFAULT_MAX_EVENTS_PER_CHUNK: Integer
|
|
5
5
|
MIN_EVENTS_PER_CHUNK: Integer
|
|
6
|
-
|
|
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,6 +17,8 @@ module PgEventstore
|
|
|
12
17
|
stats: SubscriptionHandlerPerformance,
|
|
13
18
|
events_processor: EventsProcessor,
|
|
14
19
|
subscription: Subscription,
|
|
20
|
+
?initial_events_per_chunk: Integer,
|
|
21
|
+
?max_events_per_chunk: Integer,
|
|
15
22
|
) -> void
|
|
16
23
|
|
|
17
24
|
def next_chunk_query_opts: () -> ::Hash[untyped, untyped]
|
|
@@ -23,5 +30,9 @@ module PgEventstore
|
|
|
23
30
|
def estimate_events_number: () -> Integer
|
|
24
31
|
|
|
25
32
|
def attach_callbacks: () -> void
|
|
33
|
+
|
|
34
|
+
private
|
|
35
|
+
|
|
36
|
+
def subscription_from_position: -> Integer
|
|
26
37
|
end
|
|
27
38
|
end
|
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
module PgEventstore
|
|
2
2
|
class SubscriptionRunnersFeeder
|
|
3
3
|
@config_name: Symbol
|
|
4
|
-
@current_database_id: Integer
|
|
5
4
|
|
|
6
|
-
# _@param_ `config_name`
|
|
7
5
|
def initialize: (Symbol config_name) -> void
|
|
8
6
|
|
|
9
|
-
# _@param_ `runners`
|
|
10
7
|
def feed: (::Array[SubscriptionRunner] runners) -> void
|
|
11
8
|
|
|
12
9
|
private
|
|
13
10
|
|
|
14
|
-
def connection:
|
|
15
|
-
|
|
16
|
-
def subscription_queries: () -> SubscriptionQueries
|
|
17
|
-
|
|
18
|
-
def subscription_service_queries: -> SubscriptionServiceQueries
|
|
11
|
+
def connection: -> Connection
|
|
19
12
|
end
|
|
20
13
|
end
|
|
@@ -4,15 +4,15 @@ module PgEventstore
|
|
|
4
4
|
|
|
5
5
|
@config_name: Symbol
|
|
6
6
|
|
|
7
|
-
@subscriptions_set_lifecycle:
|
|
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[
|
|
13
|
+
attr_reader runners: Array[SubscriptionRunner]
|
|
14
14
|
|
|
15
|
-
def initialize: (Symbol config_name,
|
|
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[
|
|
24
|
-
|
|
25
|
-
def force_lock!: -> void
|
|
23
|
+
def subscriptions: -> Array[Subscription]
|
|
26
24
|
end
|
|
27
25
|
end
|