pg_eventstore 1.1.3 → 1.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +4 -3
- data/docs/subscriptions.md +25 -2
- data/lib/pg_eventstore/abstract_command.rb +2 -0
- data/lib/pg_eventstore/callbacks.rb +3 -0
- data/lib/pg_eventstore/client.rb +6 -1
- data/lib/pg_eventstore/config.rb +1 -1
- data/lib/pg_eventstore/connection.rb +9 -1
- data/lib/pg_eventstore/errors.rb +45 -26
- data/lib/pg_eventstore/event.rb +2 -1
- data/lib/pg_eventstore/event_class_resolver.rb +1 -1
- data/lib/pg_eventstore/event_deserializer.rb +8 -2
- data/lib/pg_eventstore/event_serializer.rb +2 -0
- data/lib/pg_eventstore/extensions/callbacks_extension.rb +1 -0
- data/lib/pg_eventstore/extensions/options_extension.rb +3 -1
- data/lib/pg_eventstore/queries/event_queries.rb +12 -4
- data/lib/pg_eventstore/queries/links_resolver.rb +3 -0
- data/lib/pg_eventstore/queries/partition_queries.rb +6 -0
- data/lib/pg_eventstore/queries/transaction_queries.rb +4 -0
- data/lib/pg_eventstore/queries.rb +1 -1
- data/lib/pg_eventstore/query_builders/{events_filtering_query.rb → events_filtering.rb} +3 -0
- data/lib/pg_eventstore/sql_builder.rb +18 -10
- data/lib/pg_eventstore/stream.rb +13 -2
- data/lib/pg_eventstore/subscriptions/basic_runner.rb +2 -0
- data/lib/pg_eventstore/subscriptions/commands_handler.rb +5 -3
- data/lib/pg_eventstore/subscriptions/queries/subscription_command_queries.rb +6 -4
- data/lib/pg_eventstore/subscriptions/queries/subscription_queries.rb +4 -2
- data/lib/pg_eventstore/subscriptions/queries/subscriptions_set_command_queries.rb +6 -4
- data/lib/pg_eventstore/subscriptions/queries/subscriptions_set_queries.rb +3 -0
- data/lib/pg_eventstore/subscriptions/runner_state.rb +1 -0
- data/lib/pg_eventstore/subscriptions/subscription.rb +19 -17
- data/lib/pg_eventstore/subscriptions/subscription_feeder.rb +8 -0
- data/lib/pg_eventstore/subscriptions/subscription_feeder_commands/base.rb +4 -4
- data/lib/pg_eventstore/subscriptions/subscription_handler_performance.rb +2 -1
- data/lib/pg_eventstore/subscriptions/subscription_runner.rb +5 -0
- data/lib/pg_eventstore/subscriptions/subscription_runner_commands/base.rb +4 -4
- data/lib/pg_eventstore/subscriptions/subscriptions_manager.rb +15 -5
- data/lib/pg_eventstore/subscriptions/subscriptions_set.rb +10 -10
- data/lib/pg_eventstore/version.rb +2 -1
- data/lib/pg_eventstore/web/application.rb +6 -6
- data/lib/pg_eventstore/web/paginator/base_collection.rb +15 -1
- data/lib/pg_eventstore/web/paginator/event_types_collection.rb +2 -1
- data/lib/pg_eventstore/web/paginator/events_collection.rb +7 -4
- data/lib/pg_eventstore/web/paginator/helpers.rb +3 -3
- data/lib/pg_eventstore/web/paginator/stream_contexts_collection.rb +2 -1
- data/lib/pg_eventstore/web/paginator/stream_ids_collection.rb +2 -1
- data/lib/pg_eventstore/web/paginator/stream_names_collection.rb +2 -1
- data/lib/pg_eventstore/web/subscriptions/set_collection.rb +2 -0
- data/lib/pg_eventstore/web/subscriptions/subscriptions.rb +2 -0
- data/lib/pg_eventstore/web/subscriptions/subscriptions_set.rb +2 -0
- data/lib/pg_eventstore/web/subscriptions/subscriptions_to_set_association.rb +6 -1
- data/lib/pg_eventstore.rb +6 -1
- data/rbs_collection.lock.yaml +16 -0
- data/rbs_collection.yaml +23 -0
- data/sig/interfaces/callback.rbs +3 -0
- data/sig/interfaces/event_class_resolver.rbs +3 -0
- data/sig/interfaces/event_modifier.rbs +3 -0
- data/sig/interfaces/restart_terminator.rbs +3 -0
- data/sig/interfaces/subscription_handler.rbs +3 -0
- data/sig/pg/basic_type_registry.rbs +21 -0
- data/sig/pg/connection.rbs +407 -0
- data/sig/pg/constants.rbs +153 -0
- data/sig/pg_eventstore/abstract_command.rbs +11 -0
- data/sig/pg_eventstore/callbacks.rbs +21 -0
- data/sig/pg_eventstore/client.rbs +67 -0
- data/sig/pg_eventstore/commands/append.rbs +33 -0
- data/sig/pg_eventstore/commands/event_modifiers/prepare_link_event.rbs +24 -0
- data/sig/pg_eventstore/commands/event_modifiers/prepare_regular_event.rbs +12 -0
- data/sig/pg_eventstore/commands/link_to.rbs +17 -0
- data/sig/pg_eventstore/commands/multiple.rbs +7 -0
- data/sig/pg_eventstore/commands/read.rbs +10 -0
- data/sig/pg_eventstore/commands/regular_stream_read_paginated.rbs +32 -0
- data/sig/pg_eventstore/commands/system_stream_read_paginated.rbs +30 -0
- data/sig/pg_eventstore/config.rbs +51 -0
- data/sig/pg_eventstore/connection.rbs +30 -0
- data/sig/pg_eventstore/errors.rbs +116 -0
- data/sig/pg_eventstore/event.rbs +46 -0
- data/sig/pg_eventstore/event_class_resolver.rbs +6 -0
- data/sig/pg_eventstore/event_deserializer.rbs +20 -0
- data/sig/pg_eventstore/event_serializer.rbs +13 -0
- data/sig/pg_eventstore/extensions/callbacks_extension.rbs +23 -0
- data/sig/pg_eventstore/extensions/options_extension.rbs +37 -0
- data/sig/pg_eventstore/extensions/using_connection_extension.rbs +14 -0
- data/sig/pg_eventstore/middleware.rbs +9 -0
- data/sig/pg_eventstore/pg_connection.rbs +13 -0
- data/sig/pg_eventstore/queries/event_queries.rbs +50 -0
- data/sig/pg_eventstore/queries/links_resolver.rbs +19 -0
- data/sig/pg_eventstore/queries/partition_queries.rbs +74 -0
- data/sig/pg_eventstore/queries/transaction_queries.rbs +21 -0
- data/sig/pg_eventstore/queries.rbs +23 -0
- data/sig/pg_eventstore/query_builders/events_filtering_query.rbs +62 -0
- data/sig/pg_eventstore/sql_builder.rbs +74 -0
- data/sig/pg_eventstore/stream.rbs +40 -0
- data/sig/pg_eventstore/subscriptions/basic_runner.rbs +37 -0
- data/sig/pg_eventstore/subscriptions/command_handlers/subscription_feeder_commands.rbs +16 -0
- data/sig/pg_eventstore/subscriptions/command_handlers/subscription_runners_commands.rbs +18 -0
- data/sig/pg_eventstore/subscriptions/commands_handler.rbs +25 -0
- data/sig/pg_eventstore/subscriptions/events_processor.rbs +34 -0
- data/sig/pg_eventstore/subscriptions/extensions/base_command_extension.rbs +20 -0
- data/sig/pg_eventstore/subscriptions/extensions/command_class_lookup_extension.rbs +8 -0
- data/sig/pg_eventstore/subscriptions/queries/subscription_command_queries.rbs +56 -0
- data/sig/pg_eventstore/subscriptions/queries/subscription_queries.rbs +73 -0
- data/sig/pg_eventstore/subscriptions/queries/subscriptions_set_command_queries.rbs +39 -0
- data/sig/pg_eventstore/subscriptions/queries/subscriptions_set_queries.rbs +36 -0
- data/sig/pg_eventstore/subscriptions/runner_state.rbs +16 -0
- data/sig/pg_eventstore/subscriptions/subscription.rbs +96 -0
- data/sig/pg_eventstore/subscriptions/subscription_feeder.rbs +64 -0
- data/sig/pg_eventstore/subscriptions/subscription_feeder_commands/base.rbs +45 -0
- data/sig/pg_eventstore/subscriptions/subscription_feeder_commands/restore.rbs +8 -0
- data/sig/pg_eventstore/subscriptions/subscription_feeder_commands/start_all.rbs +8 -0
- data/sig/pg_eventstore/subscriptions/subscription_feeder_commands/stop.rbs +8 -0
- data/sig/pg_eventstore/subscriptions/subscription_feeder_commands/stop_all.rbs +8 -0
- data/sig/pg_eventstore/subscriptions/subscription_feeder_commands.rbs +8 -0
- data/sig/pg_eventstore/subscriptions/subscription_handler_performance.rbs +12 -0
- data/sig/pg_eventstore/subscriptions/subscription_runner.rbs +55 -0
- data/sig/pg_eventstore/subscriptions/subscription_runner_commands/base.rbs +47 -0
- data/sig/pg_eventstore/subscriptions/subscription_runner_commands/reset_position.rbs +11 -0
- data/sig/pg_eventstore/subscriptions/subscription_runner_commands/restore.rbs +8 -0
- data/sig/pg_eventstore/subscriptions/subscription_runner_commands/start.rbs +8 -0
- data/sig/pg_eventstore/subscriptions/subscription_runner_commands/stop.rbs +8 -0
- data/sig/pg_eventstore/subscriptions/subscription_runner_commands.rbs +8 -0
- data/sig/pg_eventstore/subscriptions/subscription_runners_feeder.rbs +13 -0
- data/sig/pg_eventstore/subscriptions/subscriptions_manager.rbs +62 -0
- data/sig/pg_eventstore/subscriptions/subscriptions_set.rbs +72 -0
- data/sig/pg_eventstore/utils.rbs +20 -0
- data/sig/pg_eventstore/version.rbs +3 -0
- data/sig/pg_eventstore/web/paginator/base_collection.rbs +51 -0
- data/sig/pg_eventstore/web/paginator/event_types_collection.rbs +15 -0
- data/sig/pg_eventstore/web/paginator/events_collection.rbs +31 -0
- data/sig/pg_eventstore/web/paginator/helpers.rbs +38 -0
- data/sig/pg_eventstore/web/paginator/stream_contexts_collection.rbs +15 -0
- data/sig/pg_eventstore/web/paginator/stream_ids_collection.rbs +15 -0
- data/sig/pg_eventstore/web/paginator/stream_names_collection.rbs +15 -0
- data/sig/pg_eventstore/web/subscriptions/helpers.rbs +48 -0
- data/sig/pg_eventstore/web/subscriptions/set_collection.rbs +18 -0
- data/sig/pg_eventstore/web/subscriptions/subscriptions.rbs +18 -0
- data/sig/pg_eventstore/web/subscriptions/subscriptions_set.rbs +18 -0
- data/sig/pg_eventstore/web/subscriptions/subscriptions_to_set_association.rbs +18 -0
- data/sig/pg_eventstore.rbs +42 -0
- metadata +90 -3
@@ -0,0 +1,20 @@
|
|
1
|
+
module PgEventstore
|
2
|
+
class EventDeserializer
|
3
|
+
# _@param_ `middlewares`
|
4
|
+
#
|
5
|
+
# _@param_ `event_class_resolver`
|
6
|
+
def initialize: (::Array[PgEventstore::Middleware] middlewares, _EventClassResolver event_class_resolver) -> void
|
7
|
+
|
8
|
+
# _@param_ `raw_events`
|
9
|
+
def deserialize_many: (::Array[::Hash[untyped, untyped]] raw_events) -> ::Array[PgEventstore::Event]
|
10
|
+
|
11
|
+
# _@param_ `attrs`
|
12
|
+
def deserialize: (::Hash[untyped, untyped] attrs) -> PgEventstore::Event
|
13
|
+
|
14
|
+
def without_middlewares: () -> PgEventstore::EventDeserializer
|
15
|
+
|
16
|
+
attr_accessor middlewares: ::Array[PgEventstore::Middleware]
|
17
|
+
|
18
|
+
attr_accessor event_class_resolver: _EventClassResolver
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module PgEventstore
|
2
|
+
class EventSerializer
|
3
|
+
# _@param_ `middlewares`
|
4
|
+
def initialize: (::Array[PgEventstore::Middleware] middlewares) -> void
|
5
|
+
|
6
|
+
# _@param_ `event`
|
7
|
+
def serialize: (PgEventstore::Event event) -> PgEventstore::Event
|
8
|
+
|
9
|
+
def without_middlewares: () -> PgEventstore::EventSerializer
|
10
|
+
|
11
|
+
attr_accessor middlewares: ::Array[PgEventstore::Middleware]
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module PgEventstore
|
2
|
+
module Extensions
|
3
|
+
module CallbacksExtension
|
4
|
+
def self.included: (untyped klass) -> untyped
|
5
|
+
|
6
|
+
def define_callback: (*untyped) -> void
|
7
|
+
|
8
|
+
module InitCallbacks
|
9
|
+
def initialize: (*untyped, **untyped) ?{ (*untyped, **untyped) -> untyped } -> void
|
10
|
+
end
|
11
|
+
|
12
|
+
module ClassMethods
|
13
|
+
# _@param_ `action`
|
14
|
+
#
|
15
|
+
# _@param_ `method_name`
|
16
|
+
def has_callbacks: ((String | Symbol) action, Symbol method_name) -> void
|
17
|
+
|
18
|
+
# _@param_ `method_name`
|
19
|
+
def visibility_method: (Symbol method_name) -> Symbol
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module PgEventstore
|
2
|
+
module Extensions
|
3
|
+
module OptionsExtension
|
4
|
+
def self.included: (untyped klass) -> untyped
|
5
|
+
|
6
|
+
def initialize: (**untyped options) -> void
|
7
|
+
|
8
|
+
# Construct a hash from options, where key is the option's name and the value is option's
|
9
|
+
# value
|
10
|
+
def options_hash: () -> ::Hash[untyped, untyped]
|
11
|
+
|
12
|
+
# _@param_ `opt_name`
|
13
|
+
def readonly!: (Symbol opt_name) -> bool
|
14
|
+
|
15
|
+
# _@param_ `opt_name`
|
16
|
+
def readonly?: (Symbol opt_name) -> bool
|
17
|
+
|
18
|
+
# _@param_ `opt_name`
|
19
|
+
def readonly_error: (Symbol opt_name) -> void
|
20
|
+
|
21
|
+
# _@param_ `options`
|
22
|
+
def init_default_values: (::Hash[untyped, untyped] options) -> void
|
23
|
+
|
24
|
+
module ClassMethods
|
25
|
+
# _@param_ `opt_name` — option name
|
26
|
+
#
|
27
|
+
# _@param_ `blk` — provide define value using block. It will be later evaluated in the context of your object to determine the default value of the option
|
28
|
+
def option: (Symbol opt_name) ?{ () -> untyped } -> Symbol
|
29
|
+
|
30
|
+
def inherited: (untyped klass) -> untyped
|
31
|
+
|
32
|
+
# _@param_ `method_name`
|
33
|
+
def warn_already_defined: (Symbol method_name) -> void
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module PgEventstore
|
2
|
+
module Extensions
|
3
|
+
module UsingConnectionExtension
|
4
|
+
def self.included: (untyped klass) -> untyped
|
5
|
+
|
6
|
+
module ClassMethods
|
7
|
+
def connection: () -> PgEventstore::Connection
|
8
|
+
|
9
|
+
# _@param_ `config_name`
|
10
|
+
def using_connection: (Symbol config_name) -> Class
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module PgEventstore
|
2
|
+
class PgConnection < PG::Connection
|
3
|
+
def exec: (untyped sql) -> untyped
|
4
|
+
|
5
|
+
def exec_params: (untyped sql, untyped params) -> untyped
|
6
|
+
|
7
|
+
def log: (untyped sql, untyped params) -> untyped
|
8
|
+
|
9
|
+
def encode_value: (untyped value) -> untyped
|
10
|
+
|
11
|
+
def normalize_value: (untyped value) -> untyped
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module PgEventstore
|
2
|
+
class EventQueries
|
3
|
+
# _@param_ `connection`
|
4
|
+
#
|
5
|
+
# _@param_ `serializer`
|
6
|
+
#
|
7
|
+
# _@param_ `deserializer`
|
8
|
+
def initialize: (PgEventstore::Connection connection, PgEventstore::EventSerializer serializer, PgEventstore::EventDeserializer deserializer) -> void
|
9
|
+
|
10
|
+
# _@param_ `event`
|
11
|
+
def event_exists?: (PgEventstore::Event event) -> bool
|
12
|
+
|
13
|
+
# _@param_ `events`
|
14
|
+
def ids_from_db: (::Array[PgEventstore::Event] events) -> ::Array[String]
|
15
|
+
|
16
|
+
# _@param_ `stream`
|
17
|
+
def stream_revision: (PgEventstore::Stream stream) -> Integer?
|
18
|
+
|
19
|
+
# _@param_ `stream`
|
20
|
+
#
|
21
|
+
# _@param_ `options`
|
22
|
+
def stream_events: (PgEventstore::Stream stream, ::Hash[untyped, untyped] options) -> ::Array[PgEventstore::Event]
|
23
|
+
|
24
|
+
# _@param_ `stream`
|
25
|
+
#
|
26
|
+
# _@param_ `events`
|
27
|
+
def insert: (PgEventstore::Stream stream, ::Array[PgEventstore::Event] events) -> ::Array[PgEventstore::Event]
|
28
|
+
|
29
|
+
# _@param_ `stream`
|
30
|
+
#
|
31
|
+
# _@param_ `events`
|
32
|
+
def prepared_statements: (PgEventstore::Stream stream, ::Array[PgEventstore::Event] events) -> ::Array[(::Array[String] | ::Array[Object])]
|
33
|
+
|
34
|
+
# _@param_ `stream`
|
35
|
+
#
|
36
|
+
# _@param_ `options`
|
37
|
+
def events_filtering: (PgEventstore::Stream stream, ::Hash[untyped, untyped] options) -> PgEventstore::QueryBuilders::EventsFiltering
|
38
|
+
|
39
|
+
def links_resolver: () -> PgEventstore::LinksResolver
|
40
|
+
|
41
|
+
# Returns the value of attribute connection.
|
42
|
+
attr_accessor connection: PgEventstore::Connection
|
43
|
+
|
44
|
+
# Returns the value of attribute serializer.
|
45
|
+
attr_accessor serializer: PgEventstore::EventSerializer
|
46
|
+
|
47
|
+
# Returns the value of attribute deserializer.
|
48
|
+
attr_accessor deserializer: PgEventstore::EventDeserializer
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module PgEventstore
|
2
|
+
class LinksResolver
|
3
|
+
# _@param_ `connection`
|
4
|
+
def initialize: (PgEventstore::Connection connection) -> void
|
5
|
+
|
6
|
+
# _@param_ `raw_events`
|
7
|
+
def resolve: (::Array[::Hash[untyped, untyped]] raw_events) -> ::Array[::Hash[untyped, untyped]]
|
8
|
+
|
9
|
+
# _@param_ `link_events` — partition id to link events association
|
10
|
+
#
|
11
|
+
# _@return_ — original events
|
12
|
+
def load_original_events: (::Hash[Integer, ::Array[::Hash[untyped, untyped]]] link_events) -> ::Array[::Hash[untyped, untyped]]
|
13
|
+
|
14
|
+
def partition_queries: () -> PgEventstore::PartitionQueries
|
15
|
+
|
16
|
+
# Returns the value of attribute connection.
|
17
|
+
attr_accessor connection: PgEventstore::Connection
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
module PgEventstore
|
2
|
+
class PartitionQueries
|
3
|
+
# _@param_ `connection`
|
4
|
+
def initialize: (PgEventstore::Connection connection) -> void
|
5
|
+
|
6
|
+
# _@param_ `stream`
|
7
|
+
#
|
8
|
+
# _@return_ — partition attributes
|
9
|
+
def create_context_partition: (PgEventstore::Stream stream) -> ::Hash[untyped, untyped]
|
10
|
+
|
11
|
+
# _@param_ `stream`
|
12
|
+
#
|
13
|
+
# _@param_ `context_partition_name`
|
14
|
+
#
|
15
|
+
# _@return_ — partition attributes
|
16
|
+
def create_stream_name_partition: (PgEventstore::Stream stream, String context_partition_name) -> ::Hash[untyped, untyped]
|
17
|
+
|
18
|
+
# _@param_ `stream`
|
19
|
+
#
|
20
|
+
# _@param_ `event_type`
|
21
|
+
#
|
22
|
+
# _@param_ `stream_name_partition_name`
|
23
|
+
#
|
24
|
+
# _@return_ — partition attributes
|
25
|
+
def create_event_type_partition: (PgEventstore::Stream stream, String event_type, String stream_name_partition_name) -> ::Hash[untyped, untyped]
|
26
|
+
|
27
|
+
# _@param_ `stream`
|
28
|
+
#
|
29
|
+
# _@param_ `event_type`
|
30
|
+
def partition_required?: (PgEventstore::Stream stream, String event_type) -> bool
|
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
|
+
# _@param_ `stream`
|
43
|
+
#
|
44
|
+
# _@return_ — partition attributes
|
45
|
+
def stream_name_partition: (PgEventstore::Stream stream) -> ::Hash[untyped, untyped]?
|
46
|
+
|
47
|
+
# _@param_ `stream`
|
48
|
+
#
|
49
|
+
# _@param_ `event_type`
|
50
|
+
#
|
51
|
+
# _@return_ — partition attributes
|
52
|
+
def event_type_partition: (PgEventstore::Stream stream, String event_type) -> ::Hash[untyped, untyped]?
|
53
|
+
|
54
|
+
# _@param_ `table_name`
|
55
|
+
def partition_name_taken?: (String table_name) -> bool
|
56
|
+
|
57
|
+
# _@param_ `ids`
|
58
|
+
def find_by_ids: (::Array[Integer] ids) -> ::Array[::Hash[untyped, untyped]]
|
59
|
+
|
60
|
+
# _@param_ `stream`
|
61
|
+
def context_partition_name: (PgEventstore::Stream stream) -> String
|
62
|
+
|
63
|
+
# _@param_ `stream`
|
64
|
+
def stream_name_partition_name: (PgEventstore::Stream stream) -> String
|
65
|
+
|
66
|
+
# _@param_ `stream`
|
67
|
+
#
|
68
|
+
# _@param_ `event_type`
|
69
|
+
def event_type_partition_name: (PgEventstore::Stream stream, String event_type) -> String
|
70
|
+
|
71
|
+
# Returns the value of attribute connection.
|
72
|
+
attr_accessor connection: PgEventstore::Connection
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module PgEventstore
|
2
|
+
class TransactionQueries
|
3
|
+
ISOLATION_LEVELS: ::Hash[Symbol, String]
|
4
|
+
|
5
|
+
# _@param_ `connection`
|
6
|
+
def initialize: (PgEventstore::Connection connection) -> void
|
7
|
+
|
8
|
+
# _@param_ `level` — transaction isolation level
|
9
|
+
def transaction: (?Symbol level) { () -> untyped } -> void
|
10
|
+
|
11
|
+
# _@param_ `level` — PostgreSQL transaction isolation level
|
12
|
+
#
|
13
|
+
# _@param_ `pg_connection`
|
14
|
+
def pg_transaction: (String level, PG::Connection pg_connection) { () -> untyped } -> void
|
15
|
+
|
16
|
+
def partition_queries: () -> PgEventstore::PartitionQueries
|
17
|
+
|
18
|
+
# Returns the value of attribute connection.
|
19
|
+
attr_accessor connection: PgEventstore::Connection
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module PgEventstore
|
2
|
+
class Queries
|
3
|
+
include PgEventstore::Extensions::OptionsExtension
|
4
|
+
|
5
|
+
def initialize: (**untyped options) -> void
|
6
|
+
|
7
|
+
def options_hash: () -> ::Hash[untyped, untyped]
|
8
|
+
|
9
|
+
def readonly!: (Symbol opt_name) -> bool
|
10
|
+
|
11
|
+
def readonly?: (Symbol opt_name) -> bool
|
12
|
+
|
13
|
+
def readonly_error: (Symbol opt_name) -> void
|
14
|
+
|
15
|
+
def init_default_values: (::Hash[untyped, untyped] options) -> void
|
16
|
+
|
17
|
+
attr_accessor events: PgEventstore::EventQueries?
|
18
|
+
|
19
|
+
attr_accessor partitions: PgEventstore::PartitionQueries?
|
20
|
+
|
21
|
+
attr_accessor transactions: PgEventstore::TransactionQueries?
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module PgEventstore
|
2
|
+
module QueryBuilders
|
3
|
+
# @!visibility private
|
4
|
+
class EventsFiltering
|
5
|
+
DEFAULT_LIMIT: Integer
|
6
|
+
SQL_DIRECTIONS: Hash[String | Symbol, String]
|
7
|
+
SUBSCRIPTIONS_OPTIONS: ::Array[Symbol]
|
8
|
+
|
9
|
+
# _@param_ `options`
|
10
|
+
def self.subscriptions_events_filtering: (::Hash[untyped, untyped] options) -> PgEventstore::QueryBuilders::EventsFiltering
|
11
|
+
|
12
|
+
# _@param_ `options`
|
13
|
+
def self.all_stream_filtering: (::Hash[untyped, untyped] options) -> PgEventstore::QueryBuilders::EventsFiltering
|
14
|
+
|
15
|
+
# _@param_ `stream`
|
16
|
+
#
|
17
|
+
# _@param_ `options`
|
18
|
+
def self.specific_stream_filtering: (PgEventstore::Stream stream, ::Hash[untyped, untyped] options) -> PgEventstore::QueryBuilders::EventsFiltering
|
19
|
+
|
20
|
+
def initialize: () -> void
|
21
|
+
|
22
|
+
# _@param_ `context`
|
23
|
+
#
|
24
|
+
# _@param_ `stream_name`
|
25
|
+
#
|
26
|
+
# _@param_ `stream_id`
|
27
|
+
def add_stream_attrs: (?context: String?, ?stream_name: String?, ?stream_id: String?) -> void
|
28
|
+
|
29
|
+
# _@param_ `event_types`
|
30
|
+
def add_event_types: (::Array[String]? event_types) -> void
|
31
|
+
|
32
|
+
# _@param_ `revision`
|
33
|
+
#
|
34
|
+
# _@param_ `direction`
|
35
|
+
def add_revision: (Integer? revision, (String | Symbol)? direction) -> void
|
36
|
+
|
37
|
+
# _@param_ `position`
|
38
|
+
#
|
39
|
+
# _@param_ `direction`
|
40
|
+
def add_global_position: (Integer? position, (String | Symbol)? direction) -> void
|
41
|
+
|
42
|
+
# _@param_ `direction`
|
43
|
+
def add_stream_direction: ((String | Symbol)? direction) -> void
|
44
|
+
|
45
|
+
# _@param_ `direction`
|
46
|
+
def add_all_stream_direction: ((String | Symbol)? direction) -> void
|
47
|
+
|
48
|
+
# _@param_ `limit`
|
49
|
+
def add_limit: (Integer? limit) -> void
|
50
|
+
|
51
|
+
def to_sql_builder: () -> PgEventstore::SQLBuilder
|
52
|
+
|
53
|
+
def to_exec_params: () -> ::Array[untyped]
|
54
|
+
|
55
|
+
# _@param_ `stream_attrs`
|
56
|
+
def correct_stream_filter?: (::Hash[untyped, untyped] stream_attrs) -> bool
|
57
|
+
|
58
|
+
# _@param_ `direction`
|
59
|
+
def direction_operator: ((String | Symbol)? direction) -> String
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
module PgEventstore
|
2
|
+
class SQLBuilder
|
3
|
+
def initialize: () -> void
|
4
|
+
|
5
|
+
# _@param_ `sql`
|
6
|
+
def select: (String sql) -> self
|
7
|
+
|
8
|
+
def unselect: () -> self
|
9
|
+
|
10
|
+
# _@param_ `sql`
|
11
|
+
#
|
12
|
+
# _@param_ `arguments` — positional values
|
13
|
+
def where: (String sql, *untyped arguments) -> self
|
14
|
+
|
15
|
+
# _@param_ `sql`
|
16
|
+
#
|
17
|
+
# _@param_ `arguments` — positional values
|
18
|
+
def where_or: (String sql, *Object arguments) -> self
|
19
|
+
|
20
|
+
# _@param_ `table_name`
|
21
|
+
def from: (String table_name) -> self
|
22
|
+
|
23
|
+
# _@param_ `sql`
|
24
|
+
#
|
25
|
+
# _@param_ `arguments`
|
26
|
+
def join: (String sql, *Object arguments) -> self
|
27
|
+
|
28
|
+
# _@param_ `sql`
|
29
|
+
def order: (String sql) -> self
|
30
|
+
|
31
|
+
def remove_order: () -> self
|
32
|
+
|
33
|
+
# _@param_ `limit`
|
34
|
+
def limit: (Integer limit) -> self
|
35
|
+
|
36
|
+
def remove_limit: () -> self
|
37
|
+
|
38
|
+
# _@param_ `offset`
|
39
|
+
def offset: (Integer offset) -> self
|
40
|
+
|
41
|
+
# _@param_ `another_builder`
|
42
|
+
def union: (PgEventstore::SQLBuilder another_builder) -> self
|
43
|
+
|
44
|
+
# _@param_ `sql`
|
45
|
+
def group: (String sql) -> self
|
46
|
+
|
47
|
+
def remove_group: () -> self
|
48
|
+
|
49
|
+
def to_exec_params: () -> ::Array[(String | ::Array[untyped])]
|
50
|
+
|
51
|
+
def positional_values: () -> ::Array[Object]
|
52
|
+
|
53
|
+
# _@param_ `val`
|
54
|
+
def positional_values_size=: (Integer val) -> Integer
|
55
|
+
|
56
|
+
def _to_exec_params: () -> ::Array[(String | ::Array[untyped])]
|
57
|
+
|
58
|
+
def single_query_sql: () -> String
|
59
|
+
|
60
|
+
def union_query_sql: () -> String
|
61
|
+
|
62
|
+
def select_sql: () -> String
|
63
|
+
|
64
|
+
# _@param_ `join_pattern` — "OR"/"AND"
|
65
|
+
def where_sql: (String join_pattern) -> String
|
66
|
+
|
67
|
+
def join_sql: () -> String
|
68
|
+
|
69
|
+
def order_sql: () -> String
|
70
|
+
|
71
|
+
# _@param_ `sql`
|
72
|
+
def extract_positional_args: (String sql, *untyped arguments) -> String
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module PgEventstore
|
2
|
+
class Stream
|
3
|
+
SYSTEM_STREAM_PREFIX: String
|
4
|
+
NON_EXISTING_STREAM_REVISION: Integer
|
5
|
+
|
6
|
+
def self.all_stream: () -> PgEventstore::Stream
|
7
|
+
|
8
|
+
# _@param_ `context`
|
9
|
+
#
|
10
|
+
# _@param_ `stream_name`
|
11
|
+
#
|
12
|
+
# _@param_ `stream_id`
|
13
|
+
def initialize: (context: String, stream_name: String, stream_id: String) -> void
|
14
|
+
|
15
|
+
def all_stream?: () -> bool
|
16
|
+
|
17
|
+
def system?: () -> bool
|
18
|
+
|
19
|
+
def deconstruct: () -> ::Array[untyped]
|
20
|
+
|
21
|
+
# _@param_ `keys`
|
22
|
+
def deconstruct_keys: (::Array[Symbol]? keys) -> ::Hash[Symbol, String]
|
23
|
+
|
24
|
+
def to_hash: () -> ::Hash[untyped, untyped]
|
25
|
+
|
26
|
+
def hash: () -> Integer
|
27
|
+
|
28
|
+
# _@param_ `another`
|
29
|
+
def eql?: (untyped another) -> bool
|
30
|
+
|
31
|
+
# _@param_ `other_stream`
|
32
|
+
def ==: (untyped other_stream) -> bool
|
33
|
+
|
34
|
+
attr_accessor context: String
|
35
|
+
|
36
|
+
attr_accessor stream_name: String
|
37
|
+
|
38
|
+
attr_accessor stream_id: String
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module PgEventstore
|
2
|
+
class BasicRunner
|
3
|
+
include PgEventstore::Extensions::CallbacksExtension
|
4
|
+
extend Forwardable
|
5
|
+
|
6
|
+
# _@param_ `run_interval` — seconds. Determines how often to run async task. Async task is determined by :after_runner_stopped callback
|
7
|
+
#
|
8
|
+
# _@param_ `async_shutdown_time` — seconds. Determines how long to wait for the async shutdown to wait for the runner to finish.
|
9
|
+
%a{rbs:test:skip} def initialize: ((Integer | Float) run_interval, (Integer | Float) async_shutdown_time) -> void
|
10
|
+
|
11
|
+
def start: () -> self
|
12
|
+
|
13
|
+
def stop: () -> self
|
14
|
+
|
15
|
+
def stop_async: () -> self
|
16
|
+
|
17
|
+
def restore: () -> self
|
18
|
+
|
19
|
+
def wait_for_finish: () -> self
|
20
|
+
|
21
|
+
def state: () -> String
|
22
|
+
|
23
|
+
# _@param_ `state`
|
24
|
+
def within_state: (Symbol state) { () -> untyped } -> untyped
|
25
|
+
|
26
|
+
def synchronize: () { () -> untyped } -> untyped
|
27
|
+
|
28
|
+
def _start: () -> void
|
29
|
+
|
30
|
+
def delegate_change_state_cbx: () -> void
|
31
|
+
|
32
|
+
# _@param_ `state`
|
33
|
+
def change_state: (String state) -> void
|
34
|
+
|
35
|
+
def define_callback: () -> void
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module PgEventstore
|
2
|
+
module CommandHandlers
|
3
|
+
class SubscriptionFeederCommands
|
4
|
+
# _@param_ `config_name`
|
5
|
+
#
|
6
|
+
# _@param_ `subscription_feeder`
|
7
|
+
def initialize: (Symbol config_name, PgEventstore::SubscriptionFeeder subscription_feeder) -> void
|
8
|
+
|
9
|
+
def process: () -> void
|
10
|
+
|
11
|
+
def queries: () -> PgEventstore::SubscriptionsSetCommandQueries
|
12
|
+
|
13
|
+
def connection: () -> PgEventstore::Connection
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module PgEventstore
|
2
|
+
module CommandHandlers
|
3
|
+
class SubscriptionRunnersCommands
|
4
|
+
# _@param_ `config_name`
|
5
|
+
#
|
6
|
+
# _@param_ `runners`
|
7
|
+
#
|
8
|
+
# _@param_ `subscriptions_set_id`
|
9
|
+
def initialize: (Symbol config_name, ::Array[PgEventstore::SubscriptionRunner] runners, Integer subscriptions_set_id) -> void
|
10
|
+
|
11
|
+
def process: () -> void
|
12
|
+
|
13
|
+
def queries: () -> PgEventstore::SubscriptionCommandQueries
|
14
|
+
|
15
|
+
def connection: () -> PgEventstore::Connection
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module PgEventstore
|
2
|
+
class CommandsHandler
|
3
|
+
extend Forwardable
|
4
|
+
RESTART_DELAY: Integer
|
5
|
+
PULL_INTERVAL: Integer
|
6
|
+
|
7
|
+
# _@param_ `config_name`
|
8
|
+
#
|
9
|
+
# _@param_ `subscription_feeder`
|
10
|
+
#
|
11
|
+
# _@param_ `runners`
|
12
|
+
def initialize: (Symbol config_name, PgEventstore::SubscriptionFeeder subscription_feeder, ::Array[PgEventstore::SubscriptionRunner] runners) -> void
|
13
|
+
|
14
|
+
def attach_runner_callbacks: () -> untyped
|
15
|
+
|
16
|
+
def process_async: () -> untyped
|
17
|
+
|
18
|
+
# _@param_ `error`
|
19
|
+
def after_runner_died: (StandardError error) -> void
|
20
|
+
|
21
|
+
def subscription_feeder_commands: () -> PgEventstore::CommandHandlers::SubscriptionFeederCommands
|
22
|
+
|
23
|
+
def subscription_runners_commands: () -> PgEventstore::CommandHandlers::SubscriptionRunnersCommands
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module PgEventstore
|
2
|
+
class EventsProcessor
|
3
|
+
include PgEventstore::Extensions::CallbacksExtension
|
4
|
+
extend Forwardable
|
5
|
+
|
6
|
+
# _@param_ `handler`
|
7
|
+
%a{rbs:test:skip} def initialize: (_SubscriptionHandler handler) -> void
|
8
|
+
|
9
|
+
# _@param_ `raw_events`
|
10
|
+
def feed: (::Array[::Hash[untyped, untyped]] raw_events) -> void
|
11
|
+
|
12
|
+
def events_left_in_chunk: () -> Integer
|
13
|
+
|
14
|
+
def clear_chunk: () -> void
|
15
|
+
|
16
|
+
# _@param_ `raw_event`
|
17
|
+
def process_event: (::Hash[untyped, untyped] raw_event) -> void
|
18
|
+
|
19
|
+
def attach_runner_callbacks: () -> void
|
20
|
+
|
21
|
+
def process_async: () -> void
|
22
|
+
|
23
|
+
def after_runner_died: (StandardError error) -> void
|
24
|
+
|
25
|
+
def before_runner_restored: () -> void
|
26
|
+
|
27
|
+
def change_state: (*untyped args, **untyped kwargs) -> void
|
28
|
+
|
29
|
+
# _@param_ `raw_event`
|
30
|
+
def global_position: (::Hash[untyped, untyped] raw_event) -> Integer
|
31
|
+
|
32
|
+
def define_callback: () -> void
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module PgEventstore
|
2
|
+
module Extensions
|
3
|
+
module BaseCommandExtension
|
4
|
+
def self.included: (untyped klass) -> untyped
|
5
|
+
|
6
|
+
def hash: () -> Integer
|
7
|
+
|
8
|
+
# _@param_ `another`
|
9
|
+
def eql?: (Object another) -> bool
|
10
|
+
|
11
|
+
# _@param_ `another`
|
12
|
+
def ==: (Object another) -> bool
|
13
|
+
|
14
|
+
module ClassMethods
|
15
|
+
# _@param_ `data`
|
16
|
+
def parse_data: (::Hash[untyped, untyped] data) -> ::Hash[untyped, untyped]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|