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
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
module PgEventstore
|
|
2
|
+
class EventsGlobalIndexQueries
|
|
3
|
+
@query_strategy: QueryStrategy
|
|
4
|
+
|
|
5
|
+
attr_reader connection: Connection
|
|
6
|
+
|
|
7
|
+
def initialize: (Connection connection, QueryStrategy query_strategy) -> void
|
|
8
|
+
|
|
9
|
+
def fetch_indexes_for_subscriptions: (Hash[Integer, Hash[Symbol, untyped]] grouped_opts) ->
|
|
10
|
+
Hash[Integer, Array[EventGlobalIndex::SubscriptionRepr]]
|
|
11
|
+
|
|
12
|
+
def global_positions_from_db: (Array[Event] events) -> Array[Integer]
|
|
13
|
+
|
|
14
|
+
def index_events: (Array[Hash[String, untyped]] raw_events, Array[Partition] affected_partitions,
|
|
15
|
+
Integer stream_index_id) -> Array[EventGlobalIndex::WriteApiRepr]
|
|
16
|
+
|
|
17
|
+
def max_global_position: -> Integer?
|
|
18
|
+
|
|
19
|
+
def resolve_indexes: (Array[EventGlobalIndex::ReadApiRepr] | Array[EventGlobalIndex::SubscriptionRepr] indexes,
|
|
20
|
+
?direction: (String | Symbol)?, resolve_link_tos: bool) -> Array[Hash[String, untyped]]
|
|
21
|
+
|
|
22
|
+
private
|
|
23
|
+
|
|
24
|
+
def deserialize: (PG::Result pg_result, ?repr: Symbol?) ->
|
|
25
|
+
(
|
|
26
|
+
Array[EventGlobalIndex] |
|
|
27
|
+
Array[EventGlobalIndex::ReadApiRepr] |
|
|
28
|
+
Array[EventGlobalIndex::SubscriptionRepr] |
|
|
29
|
+
Array[EventGlobalIndex::WriteApiRepr] |
|
|
30
|
+
Array[EventGlobalIndex::RevisionCheckRepr]
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
def links_resolver: -> LinksResolver
|
|
34
|
+
|
|
35
|
+
def partition_queries: -> PartitionQueries
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
module PgEventstore
|
|
2
|
+
class IndexFilteringQueries
|
|
3
|
+
@query_strategy: QueryStrategy
|
|
4
|
+
|
|
5
|
+
attr_reader connection: Connection
|
|
6
|
+
|
|
7
|
+
def initialize: (Connection connection, QueryStrategy query_strategy) -> void
|
|
8
|
+
|
|
9
|
+
def compute_read_api_chunks_repo: (
|
|
10
|
+
Array[EventGlobalIndex::ReadApiRepr] indexes,
|
|
11
|
+
bool resolve_link_tos
|
|
12
|
+
) -> Chunks::Repository
|
|
13
|
+
|
|
14
|
+
def fetch_grouped_indexes_for_read_api: (
|
|
15
|
+
QueryBuilders::Filters::Collection filters_collection,
|
|
16
|
+
QueryBuilders::ReadCursor::StreamCursor cursor
|
|
17
|
+
) -> Array[EventGlobalIndex::ReadApiRepr]
|
|
18
|
+
|
|
19
|
+
def fetch_indexes_for_read_api: (
|
|
20
|
+
QueryBuilders::Filters::Collection filters_collection,
|
|
21
|
+
QueryBuilders::ReadCursor::StreamCursor cursor
|
|
22
|
+
) -> Array[EventGlobalIndex::ReadApiRepr]
|
|
23
|
+
|
|
24
|
+
def fetch_indexes_for_revision_validation: (
|
|
25
|
+
Stream stream,
|
|
26
|
+
Array[
|
|
27
|
+
Commands::RevisionCheck::ExpectedRevision::EventTypeRevision |
|
|
28
|
+
Commands::RevisionCheck::ExpectedRevision::EventTypeRevisionWithMarkers |
|
|
29
|
+
Commands::RevisionCheck::ExpectedRevision::MarkersRevision
|
|
30
|
+
] expected_revisions
|
|
31
|
+
) -> Array[EventGlobalIndex::RevisionCheckRepr]
|
|
32
|
+
|
|
33
|
+
private
|
|
34
|
+
|
|
35
|
+
def deserialize: (PG::Result pg_result, ?repr: Symbol?) ->
|
|
36
|
+
(
|
|
37
|
+
Array[EventGlobalIndex] |
|
|
38
|
+
Array[EventGlobalIndex::ReadApiRepr] |
|
|
39
|
+
Array[EventGlobalIndex::SubscriptionRepr] |
|
|
40
|
+
Array[EventGlobalIndex::WriteApiRepr] |
|
|
41
|
+
Array[EventGlobalIndex::RevisionCheckRepr]
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
def expand_event_types: (
|
|
45
|
+
QueryBuilders::Filters::Collection filters_collection
|
|
46
|
+
) -> Array[QueryBuilders::Filters::FilterRow | QueryBuilders::Filters::MarkerFilterRow]
|
|
47
|
+
|
|
48
|
+
def partition_queries: -> PartitionQueries
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
module PgEventstore
|
|
2
2
|
class LinksResolver
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
@query_strategy: QueryStrategy
|
|
4
|
+
|
|
5
|
+
attr_accessor connection: Connection
|
|
6
|
+
|
|
7
|
+
def initialize: (Connection connection, QueryStrategy query_strategy) -> void
|
|
5
8
|
|
|
6
|
-
# _@param_ `raw_events`
|
|
7
9
|
def resolve: (::Array[::Hash[String, untyped]] raw_events) -> ::Array[::Hash[String, untyped]]
|
|
8
10
|
|
|
9
|
-
# _@param_ `link_events` — partition id to link events association
|
|
10
|
-
#
|
|
11
|
-
# _@return_ — original events
|
|
12
11
|
def load_original_events: (::Hash[Integer, ::Array[::Hash[String, untyped]]] link_events) -> ::Array[::Hash[String, untyped]]
|
|
13
12
|
|
|
14
13
|
def partition_queries: () -> PartitionQueries
|
|
15
|
-
|
|
16
|
-
# Returns the value of attribute connection.
|
|
17
|
-
attr_accessor connection: Connection
|
|
18
14
|
end
|
|
19
15
|
end
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
module PgEventstore
|
|
2
2
|
class MaintenanceQueries
|
|
3
|
-
|
|
3
|
+
EVENT_INDEXES_TO_REMOVE_PER_QUERY: Integer
|
|
4
|
+
EVENT_INDEXES_TO_UPDATE_PER_QUERY: Integer
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
attr_reader connection: Connection
|
|
6
7
|
|
|
7
|
-
def
|
|
8
|
+
def initialize: (Connection connection) -> untyped
|
|
8
9
|
|
|
9
|
-
def delete_event: (
|
|
10
|
+
def delete_event: (Event event) -> void
|
|
10
11
|
|
|
11
|
-
def delete_stream: (
|
|
12
|
+
def delete_stream: (Stream stream) -> Integer
|
|
12
13
|
|
|
13
|
-
def events_to_lock_count: (
|
|
14
|
-
|
|
15
|
-
def reload_event: (PgEventstore::Event event)-> PgEventstore::Event?
|
|
14
|
+
def events_to_lock_count: (Stream stream, Integer after_revision) -> Integer
|
|
16
15
|
|
|
17
16
|
private
|
|
18
17
|
|
|
19
|
-
def
|
|
18
|
+
def partition_queries: -> PartitionQueries
|
|
19
|
+
|
|
20
|
+
def streams_global_index_queries: -> StreamsGlobalIndexQueries
|
|
21
|
+
|
|
22
|
+
def transaction_queries: -> TransactionQueries
|
|
20
23
|
end
|
|
21
24
|
end
|
|
@@ -1,78 +1,43 @@
|
|
|
1
1
|
module PgEventstore
|
|
2
2
|
class PartitionQueries
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
def
|
|
31
|
-
|
|
32
|
-
# _@param_ `stream`
|
|
33
|
-
#
|
|
34
|
-
# _@param_ `event_type`
|
|
35
|
-
def create_partitions: (PgEventstore::Stream stream, String event_type) -> void
|
|
36
|
-
|
|
37
|
-
# _@param_ `stream`
|
|
38
|
-
#
|
|
39
|
-
# _@return_ — partition attributes
|
|
40
|
-
def context_partition: (PgEventstore::Stream stream) -> ::Hash[untyped, untyped]?
|
|
41
|
-
|
|
42
|
-
def partitions: (Array[Hash[Symbol, String | nil]] stream_filters, Array[String] event_filters,
|
|
43
|
-
?scope: Symbol) -> Array[Partition]
|
|
44
|
-
|
|
45
|
-
# _@param_ `stream`
|
|
46
|
-
#
|
|
47
|
-
# _@return_ — partition attributes
|
|
48
|
-
def stream_name_partition: (PgEventstore::Stream stream) -> ::Hash[untyped, untyped]?
|
|
49
|
-
|
|
50
|
-
# _@param_ `stream`
|
|
51
|
-
#
|
|
52
|
-
# _@param_ `event_type`
|
|
53
|
-
#
|
|
54
|
-
# _@return_ — partition attributes
|
|
55
|
-
def event_type_partition: (PgEventstore::Stream stream, String event_type) -> ::Hash[untyped, untyped]?
|
|
56
|
-
|
|
57
|
-
# _@param_ `table_name`
|
|
3
|
+
@query_strategy: QueryStrategy
|
|
4
|
+
|
|
5
|
+
attr_accessor connection: Connection
|
|
6
|
+
|
|
7
|
+
def initialize: (Connection connection, ?QueryStrategy query_strategy) -> void
|
|
8
|
+
|
|
9
|
+
def attach_event_type_partition: (Partition partition) -> void
|
|
10
|
+
|
|
11
|
+
def create_context_partition: (Stream stream) -> ::Hash[untyped, untyped]
|
|
12
|
+
|
|
13
|
+
def create_stream_name_partition: (Stream stream, Integer context_partition_id) -> ::Hash[untyped, untyped]
|
|
14
|
+
|
|
15
|
+
def create_event_type_partition: (Stream stream, String event_type,
|
|
16
|
+
Integer context_partition_id, Integer stream_name_partition_id) -> ::Hash[untyped, untyped]
|
|
17
|
+
|
|
18
|
+
def detach_event_type_partition: (Partition partition) -> void
|
|
19
|
+
|
|
20
|
+
def partition_required?: (Stream stream, String event_type) -> bool
|
|
21
|
+
|
|
22
|
+
def create_partitions: (Stream stream, String event_type) -> void
|
|
23
|
+
|
|
24
|
+
def context_partition: (Stream stream) -> ::Hash[untyped, untyped]?
|
|
25
|
+
|
|
26
|
+
def partitions: (QueryBuilders::Filters::Collection filters_collection, ?scope: Symbol) -> Array[Partition]
|
|
27
|
+
|
|
28
|
+
def stream_name_partition: (Stream stream) -> ::Hash[untyped, untyped]?
|
|
29
|
+
|
|
30
|
+
def event_type_partition: (Stream stream, String event_type) -> ::Hash[untyped, untyped]?
|
|
31
|
+
|
|
58
32
|
def partition_name_taken?: (String table_name) -> bool
|
|
59
33
|
|
|
60
|
-
# _@param_ `ids`
|
|
61
34
|
def find_by_ids: (::Array[Integer] ids) -> ::Array[::Hash[untyped, untyped]]
|
|
62
35
|
|
|
63
|
-
|
|
64
|
-
def context_partition_name: (PgEventstore::Stream stream) -> String
|
|
65
|
-
|
|
66
|
-
# _@param_ `stream`
|
|
67
|
-
def stream_name_partition_name: (PgEventstore::Stream stream) -> String
|
|
36
|
+
def context_partition_name: (Stream stream) -> String
|
|
68
37
|
|
|
69
|
-
|
|
70
|
-
#
|
|
71
|
-
# _@param_ `event_type`
|
|
72
|
-
def event_type_partition_name: (PgEventstore::Stream stream, String event_type) -> String
|
|
38
|
+
def stream_name_partition_name: (Stream stream) -> String
|
|
73
39
|
|
|
74
|
-
|
|
75
|
-
attr_accessor connection: PgEventstore::Connection
|
|
40
|
+
def event_type_partition_name: (Stream stream, String event_type) -> String
|
|
76
41
|
|
|
77
42
|
private
|
|
78
43
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
module PgEventstore
|
|
2
|
+
class ReplicaQueries
|
|
3
|
+
MAX_PARTITIONS_TO_RESOLVE_PER_CALL: Integer
|
|
4
|
+
|
|
5
|
+
@query_strategy: QueryStrategy
|
|
6
|
+
|
|
7
|
+
attr_reader connection: Connection
|
|
8
|
+
|
|
9
|
+
def initialize: (Connection connection, QueryStrategy query_strategy) -> void
|
|
10
|
+
|
|
11
|
+
def load_event_markers_index: (Array[EventGlobalIndex::SubscriptionRepr] indexes) -> Array[EventMarkerIndex]
|
|
12
|
+
|
|
13
|
+
def load_events: (Array[EventGlobalIndex::SubscriptionRepr] indexes) -> Array[RawEvent]
|
|
14
|
+
|
|
15
|
+
def load_events_global_index: (Array[EventGlobalIndex::SubscriptionRepr] indexes) -> Array[EventGlobalIndex]
|
|
16
|
+
|
|
17
|
+
def load_markers: (Array[EventMarkerIndex] indexes) -> Array[EventMarker]
|
|
18
|
+
|
|
19
|
+
def load_partitions: (Array[EventGlobalIndex] indexes) -> Array[Partition]
|
|
20
|
+
|
|
21
|
+
def load_streams_global_index: (Array[EventGlobalIndex] indexes) -> Array[StreamGlobalIndex]
|
|
22
|
+
|
|
23
|
+
def load_subscription_positions: (Array[EventGlobalIndex::SubscriptionRepr] indexes) -> Array[Integer]
|
|
24
|
+
|
|
25
|
+
private
|
|
26
|
+
|
|
27
|
+
def events_global_index_queries: -> EventsGlobalIndexQueries
|
|
28
|
+
|
|
29
|
+
def partition_queries: -> PartitionQueries
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
module PgEventstore
|
|
2
|
+
class StreamsGlobalIndexQueries
|
|
3
|
+
@query_strategy: QueryStrategy
|
|
4
|
+
|
|
5
|
+
attr_reader connection: Connection
|
|
6
|
+
|
|
7
|
+
def initialize: (Connection connection, QueryStrategy query_strategy) -> void
|
|
8
|
+
|
|
9
|
+
def create: (Stream stream) -> StreamGlobalIndex
|
|
10
|
+
|
|
11
|
+
def delete: (Integer id) -> bool
|
|
12
|
+
|
|
13
|
+
def find_by: (Stream stream) -> StreamGlobalIndex?
|
|
14
|
+
|
|
15
|
+
def find_by!: (Stream stream) -> StreamGlobalIndex
|
|
16
|
+
|
|
17
|
+
def find_or_create_by: (Stream stream) -> StreamGlobalIndex
|
|
18
|
+
|
|
19
|
+
def resolve_indexes: (Array[StreamGlobalIndex] indexes) -> Array[Stream]
|
|
20
|
+
|
|
21
|
+
def stream_exists?: (Stream stream) -> bool
|
|
22
|
+
|
|
23
|
+
def stream_revision: (Stream stream) -> Integer?
|
|
24
|
+
|
|
25
|
+
def streams_global_index: (Hash[Symbol, untyped]) -> Array[StreamGlobalIndex]
|
|
26
|
+
|
|
27
|
+
def update: (Integer id, **untyped attrs) -> void
|
|
28
|
+
|
|
29
|
+
private
|
|
30
|
+
|
|
31
|
+
def deserialize_many: (PG::Result pg_result) -> Array[StreamGlobalIndex]
|
|
32
|
+
|
|
33
|
+
def deserialize_one: (PG::Result pg_result) -> StreamGlobalIndex?
|
|
34
|
+
|
|
35
|
+
def partition_queries: -> PartitionQueries
|
|
36
|
+
|
|
37
|
+
def transaction_queries: -> TransactionQueries
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -1,25 +1,15 @@
|
|
|
1
1
|
module PgEventstore
|
|
2
2
|
class Queries
|
|
3
|
-
include
|
|
4
|
-
|
|
5
|
-
attr_accessor events:
|
|
6
|
-
|
|
7
|
-
attr_accessor
|
|
8
|
-
|
|
9
|
-
attr_accessor
|
|
10
|
-
|
|
11
|
-
attr_accessor
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def options_hash: () -> ::Hash[untyped, untyped]
|
|
16
|
-
|
|
17
|
-
def readonly!: (Symbol opt_name) -> bool
|
|
18
|
-
|
|
19
|
-
def readonly?: (Symbol opt_name) -> bool
|
|
20
|
-
|
|
21
|
-
def readonly_error: (Symbol opt_name) -> void
|
|
22
|
-
|
|
23
|
-
def init_default_values: (::Hash[untyped, untyped] options) -> void
|
|
3
|
+
include Extensions::OptionsExtension
|
|
4
|
+
|
|
5
|
+
attr_accessor events: EventQueries?
|
|
6
|
+
attr_accessor partitions: PartitionQueries?
|
|
7
|
+
attr_accessor transactions: TransactionQueries?
|
|
8
|
+
attr_accessor maintenance: MaintenanceQueries?
|
|
9
|
+
attr_accessor events_global_index: EventsGlobalIndexQueries?
|
|
10
|
+
attr_accessor streams_global_index: StreamsGlobalIndexQueries?
|
|
11
|
+
attr_accessor event_subscription_positions: EventSubscriptionPositionQueries?
|
|
12
|
+
attr_accessor event_markers: EventMarkerQueries?
|
|
13
|
+
attr_accessor index_filtering: IndexFilteringQueries?
|
|
24
14
|
end
|
|
25
15
|
end
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
module PgEventstore
|
|
2
2
|
module QueryBuilders
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
module BasicFiltering
|
|
4
|
+
module ClassMethods
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
def ascending?: ((String | Symbol)? order) -> bool
|
|
7
|
+
|
|
8
|
+
def descending?: ((String | Symbol)? order) -> bool
|
|
9
|
+
|
|
10
|
+
def reverse_order: ((String | Symbol)? order) -> Symbol
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
SQL_DIRECTIONS: Hash[String | Symbol, String]
|
|
7
14
|
|
|
8
15
|
def to_exec_params: -> [String, Array[untyped]]
|
|
9
16
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module PgEventstore
|
|
2
|
+
module QueryBuilders
|
|
3
|
+
class EventMarkersFiltering
|
|
4
|
+
PRIMARY_TABLE_NAME: String
|
|
5
|
+
|
|
6
|
+
include BasicFiltering
|
|
7
|
+
|
|
8
|
+
@sql_builder: SQLBuilder
|
|
9
|
+
|
|
10
|
+
def self.sql_builder_by_names: (Array[String] names) -> SQLBuilder
|
|
11
|
+
|
|
12
|
+
def add_name: (String name) -> void
|
|
13
|
+
|
|
14
|
+
def add_names: (Array[String] names) -> void
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
module PgEventstore
|
|
2
|
+
module QueryBuilders
|
|
3
|
+
class EventMarkersIndexFiltering
|
|
4
|
+
DEFAULT_LIMIT: Integer
|
|
5
|
+
PRIMARY_TABLE_NAME: String
|
|
6
|
+
|
|
7
|
+
include BasicFiltering
|
|
8
|
+
|
|
9
|
+
@sql_builder: SQLBuilder
|
|
10
|
+
|
|
11
|
+
def self.for_read_common: (
|
|
12
|
+
Filters::MarkerFilterRow marker_filter_row,
|
|
13
|
+
ReadCursor::StreamCursor cursor
|
|
14
|
+
) -> SQLBuilder
|
|
15
|
+
|
|
16
|
+
def self.for_read_grouped: (
|
|
17
|
+
Filters::MarkerFilterRow marker_filter_row,
|
|
18
|
+
ReadCursor::StreamCursor cursor
|
|
19
|
+
) -> SQLBuilder
|
|
20
|
+
|
|
21
|
+
def self.for_revision_validation_per_type: (
|
|
22
|
+
Filters::MarkerFilterRow marker_filter_row,
|
|
23
|
+
ReadCursor::StreamCursor cursor,
|
|
24
|
+
Integer seq_num
|
|
25
|
+
) -> SQLBuilder
|
|
26
|
+
|
|
27
|
+
def add_global_position_direction: ((String | Symbol)? direction) -> void
|
|
28
|
+
|
|
29
|
+
def add_limit: (Integer? limit) -> void
|
|
30
|
+
|
|
31
|
+
def add_marker_filter_row: (Filters::MarkerFilterRow marker_filter_row) -> void
|
|
32
|
+
|
|
33
|
+
def add_stream_revision_direction: ((String | Symbol)? direction) -> void
|
|
34
|
+
|
|
35
|
+
def for_subscription: -> void
|
|
36
|
+
|
|
37
|
+
def from_position: (Integer? position, (String | Symbol)? direction) -> void
|
|
38
|
+
|
|
39
|
+
def from_revision: ((Integer | SQLBuilder)? revision, (String | Symbol)? direction) -> void
|
|
40
|
+
|
|
41
|
+
def to_position: (Integer? position, (String | Symbol)? direction) -> void
|
|
42
|
+
|
|
43
|
+
def to_revision: ((Integer | SQLBuilder)? revision, (String | Symbol)? direction) -> void
|
|
44
|
+
|
|
45
|
+
private
|
|
46
|
+
|
|
47
|
+
def self.add_direction_and_limit: (
|
|
48
|
+
EventMarkersIndexFiltering index_filtering,
|
|
49
|
+
ReadCursor::StreamCursor cursor
|
|
50
|
+
)-> void
|
|
51
|
+
|
|
52
|
+
def self.default_filtering: (ReadCursor::StreamCursor cursor) -> EventMarkersIndexFiltering
|
|
53
|
+
|
|
54
|
+
def self.filtering_from_filter_row: (
|
|
55
|
+
Filters::MarkerFilterRow marker_filter_row,
|
|
56
|
+
ReadCursor::StreamCursor cursor
|
|
57
|
+
) -> EventMarkersIndexFiltering
|
|
58
|
+
|
|
59
|
+
def self.stream_revision_based_filtering: (
|
|
60
|
+
ReadCursor::StreamCursor cursor,
|
|
61
|
+
Filters::MarkerFilterRow marker_filter_row
|
|
62
|
+
) -> EventMarkersIndexFiltering
|
|
63
|
+
|
|
64
|
+
def direction_operator_from: ((String | Symbol)? direction) -> String
|
|
65
|
+
|
|
66
|
+
def direction_operator_to: ((String | Symbol)? direction) -> String
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module PgEventstore
|
|
2
|
+
module QueryBuilders
|
|
3
|
+
class EventSubscriptionPositionsFiltering
|
|
4
|
+
include BasicFiltering
|
|
5
|
+
|
|
6
|
+
PRIMARY_TABLE_NAME: String
|
|
7
|
+
|
|
8
|
+
@sql_builder: SQLBuilder
|
|
9
|
+
|
|
10
|
+
def by_global_positions: (Array[Integer] positions)-> void
|
|
11
|
+
|
|
12
|
+
def max_subscription_position: -> void
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -1,68 +1,26 @@
|
|
|
1
1
|
module PgEventstore
|
|
2
2
|
module QueryBuilders
|
|
3
3
|
# @!visibility private
|
|
4
|
-
class EventsFiltering
|
|
5
|
-
|
|
6
|
-
SQL_DIRECTIONS: Hash[String | Symbol, String]
|
|
7
|
-
SUBSCRIPTIONS_OPTIONS: ::Array[Symbol]
|
|
8
|
-
|
|
9
|
-
TABLE_NAME: String
|
|
10
|
-
|
|
11
|
-
def self.events_filtering: (Stream stream, ::Hash[untyped, untyped] options) -> EventsFiltering
|
|
12
|
-
|
|
13
|
-
def self.extract_event_types_filter: (Hash[untyped, untyped] options) -> Array[String]
|
|
4
|
+
class EventsFiltering
|
|
5
|
+
include BasicFiltering
|
|
14
6
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
# _@param_ `options`
|
|
18
|
-
def self.subscriptions_events_filtering: (::Hash[untyped, untyped] options) -> EventsFiltering
|
|
19
|
-
|
|
20
|
-
# _@param_ `options`
|
|
21
|
-
def self.all_stream_filtering: (::Hash[untyped, untyped] options) -> EventsFiltering
|
|
22
|
-
|
|
23
|
-
# _@param_ `stream`
|
|
24
|
-
#
|
|
25
|
-
# _@param_ `options`
|
|
26
|
-
def self.specific_stream_filtering: (Stream stream, ::Hash[untyped, untyped] options) -> EventsFiltering
|
|
7
|
+
DEFAULT_LIMIT: Integer
|
|
27
8
|
|
|
28
|
-
|
|
9
|
+
@sql_builder: SQLBuilder
|
|
29
10
|
|
|
30
|
-
def initialize:
|
|
11
|
+
def initialize: -> void
|
|
31
12
|
|
|
32
|
-
def add_stream_attrs: (
|
|
13
|
+
def add_stream_attrs: (context: String, stream_name: String) -> void
|
|
33
14
|
|
|
34
15
|
def add_event_types: (::Array[String] event_types) -> void
|
|
35
16
|
|
|
36
|
-
# _@param_ `revision`
|
|
37
|
-
#
|
|
38
|
-
# _@param_ `direction`
|
|
39
|
-
def add_revision: (Integer? revision, (String | Symbol)? direction) -> void
|
|
40
|
-
|
|
41
|
-
# _@param_ `position`
|
|
42
|
-
#
|
|
43
|
-
# _@param_ `direction`
|
|
44
|
-
def add_global_position: (Integer? position, (String | Symbol)? direction) -> void
|
|
45
|
-
|
|
46
|
-
# _@param_ `direction`
|
|
47
|
-
def add_stream_direction: ((String | Symbol)? direction) -> void
|
|
48
|
-
|
|
49
|
-
# _@param_ `direction`
|
|
50
|
-
def add_all_stream_direction: ((String | Symbol)? direction) -> void
|
|
51
|
-
|
|
52
|
-
# _@param_ `limit`
|
|
53
17
|
def add_limit: (Integer? limit) -> void
|
|
54
18
|
|
|
55
|
-
def set_source: (String table_name)-> void
|
|
56
|
-
|
|
57
|
-
def to_sql_builder: () -> SQLBuilder
|
|
58
|
-
|
|
59
|
-
def to_exec_params: () -> [String, Array[untyped]]
|
|
60
|
-
|
|
61
|
-
# _@param_ `stream_attrs`
|
|
62
19
|
def correct_stream_filter?: (::Hash[untyped, untyped] stream_attrs) -> bool
|
|
63
20
|
|
|
64
|
-
|
|
65
|
-
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
def comparison_operator: (Array[String] event_types) -> String
|
|
66
24
|
end
|
|
67
25
|
end
|
|
68
26
|
end
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
module PgEventstore
|
|
2
|
+
module QueryBuilders
|
|
3
|
+
class EventsGlobalIndexFiltering
|
|
4
|
+
include BasicFiltering
|
|
5
|
+
|
|
6
|
+
DEFAULT_LIMIT: Integer
|
|
7
|
+
PRIMARY_TABLE_NAME: String
|
|
8
|
+
|
|
9
|
+
@sql_builder: SQLBuilder
|
|
10
|
+
|
|
11
|
+
def self.default_filtering: (ReadCursor::StreamCursor cursor) -> EventsGlobalIndexFiltering
|
|
12
|
+
|
|
13
|
+
def self.for_read_common: (
|
|
14
|
+
Filters::FilterRow filter_row,
|
|
15
|
+
ReadCursor::StreamCursor cursor
|
|
16
|
+
)-> SQLBuilder
|
|
17
|
+
|
|
18
|
+
def self.for_read_grouped: (
|
|
19
|
+
Filters::FilterRow filter_row,
|
|
20
|
+
ReadCursor::StreamCursor cursor
|
|
21
|
+
)-> SQLBuilder
|
|
22
|
+
|
|
23
|
+
def self.for_revision_validation_per_type: (
|
|
24
|
+
Filters::FilterRow filter_row,
|
|
25
|
+
ReadCursor::StreamCursor cursor,
|
|
26
|
+
Integer seq_num
|
|
27
|
+
)-> SQLBuilder
|
|
28
|
+
|
|
29
|
+
def initialize: -> void
|
|
30
|
+
|
|
31
|
+
def add_filter_row: (Filters::FilterRow filter_row) -> void
|
|
32
|
+
|
|
33
|
+
def add_global_position_direction: (String? | Symbol? direction) -> void
|
|
34
|
+
|
|
35
|
+
def add_limit: (Integer? limit) -> void
|
|
36
|
+
|
|
37
|
+
def add_stream_revision_direction: (String? | Symbol? direction) -> void
|
|
38
|
+
|
|
39
|
+
def for_subscription: -> void
|
|
40
|
+
|
|
41
|
+
def from_position: (Integer? position, String? | Symbol? direction) -> void
|
|
42
|
+
|
|
43
|
+
def from_revision: (Integer? revision, String? | Symbol? direction) -> void
|
|
44
|
+
|
|
45
|
+
def to_position: (Integer? position, String? | Symbol? direction) -> void
|
|
46
|
+
|
|
47
|
+
def to_revision: (Integer? revision, String? | Symbol? direction) -> void
|
|
48
|
+
|
|
49
|
+
private
|
|
50
|
+
|
|
51
|
+
def self.add_direction_and_limit: (
|
|
52
|
+
EventsGlobalIndexFiltering index_filtering,
|
|
53
|
+
ReadCursor::StreamCursor cursor
|
|
54
|
+
) -> void
|
|
55
|
+
|
|
56
|
+
def self.filtering_from_filter_row: (
|
|
57
|
+
Filters::FilterRow filter_row,
|
|
58
|
+
ReadCursor::StreamCursor cursor
|
|
59
|
+
) -> EventsGlobalIndexFiltering
|
|
60
|
+
|
|
61
|
+
def direction_operator_from: (String? | Symbol? direction) -> String
|
|
62
|
+
|
|
63
|
+
def direction_operator_to: (String? | Symbol? direction) -> String
|
|
64
|
+
|
|
65
|
+
def event_type_comparison: (Filters::FilterRow filter_row) -> Array[String]
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|