event_sourcery-postgres 1.0.0 → 1.0.1
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/CHANGELOG.md +10 -1
- data/README.md +1 -3
- data/event_sourcery-postgres.gemspec +1 -1
- data/lib/event_sourcery/postgres/config.rb +1 -0
- data/lib/event_sourcery/postgres/event_store.rb +1 -0
- data/lib/event_sourcery/postgres/optimised_event_poll_waiter.rb +1 -1
- data/lib/event_sourcery/postgres/projector.rb +2 -0
- data/lib/event_sourcery/postgres/queue_with_interval_callback.rb +2 -1
- data/lib/event_sourcery/postgres/reactor.rb +5 -2
- data/lib/event_sourcery/postgres/schema.rb +1 -0
- data/lib/event_sourcery/postgres/table_owner.rb +4 -2
- data/lib/event_sourcery/postgres/version.rb +1 -1
- data/lib/event_sourcery/postgres.rb +1 -0
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d0257d9a0f70fe078196251fc6de2944278cb2ddf7dda70e2125ce1217d62af6
|
|
4
|
+
data.tar.gz: 4ff91be144b82ec02988d7993a7094618e002ffce96ec7dfde1cde054fb15668
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5cd37ea3284ab95e970e704bbabdb14c2160dd3a7612a48927fc99e15a72b074d8c704c0239a75256a158bf468df93c110dcaa0d0ce46da4f871ceb1fd0390c9
|
|
7
|
+
data.tar.gz: d9e5f9281bcc91bb364e1dd607065199b97f144118841183807ce78a3a7a0ab4997fc6e12a625d0f15aaf3b15076d769a03b56362e47201906539ed29d8fefb4
|
data/CHANGELOG.md
CHANGED
|
@@ -7,7 +7,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
-
[Unreleased]: https://github.com/envato/event_sourcery-postgres/compare/v1.0.
|
|
10
|
+
[Unreleased]: https://github.com/envato/event_sourcery-postgres/compare/v1.0.1...HEAD
|
|
11
|
+
|
|
12
|
+
## [1.0.1] - 2026-01-17
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- Resolve issues as identified by RuboCop ([#85]).
|
|
17
|
+
|
|
18
|
+
[1.0.0]: https://github.com/envato/event_sourcery-postgres/compare/v1.0.0...v1.0.1
|
|
19
|
+
[#85]: https://github.com/envato/event_sourcery-postgres/pull/85
|
|
11
20
|
|
|
12
21
|
## [1.0.0] - 2025-12-28
|
|
13
22
|
|
data/README.md
CHANGED
|
@@ -4,9 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## Development Status
|
|
6
6
|
|
|
7
|
-
EventSourcery is
|
|
8
|
-
haven't finalized the API yet and things are still moving rapidly. Until we
|
|
9
|
-
release a 1.0 things may change without first being deprecated.
|
|
7
|
+
EventSourcery::Postgres is in production use at [Envato](http://envato.com).
|
|
10
8
|
|
|
11
9
|
## Installation
|
|
12
10
|
|
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
|
19
19
|
'allowed_push_host' => 'https://rubygems.org',
|
|
20
20
|
'bug_tracker_uri' => "#{spec.homepage}/issues",
|
|
21
21
|
'changelog_uri' => "#{spec.homepage}/blob/HEAD/CHANGELOG.md",
|
|
22
|
-
'documentation_uri' => "https://www.rubydoc.info/gems
|
|
22
|
+
'documentation_uri' => "https://www.rubydoc.info/gems/#{spec.name}/#{spec.version}",
|
|
23
23
|
'source_code_uri' => "#{spec.homepage}/tree/v#{spec.version}"
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module EventSourcery
|
|
4
4
|
module Postgres
|
|
5
|
+
# Mixin providing projection capabilities for processing events into read models.
|
|
5
6
|
module Projector
|
|
6
7
|
def self.included(base)
|
|
7
8
|
base.include(EventProcessing::EventStreamProcessor)
|
|
@@ -17,6 +18,7 @@ module EventSourcery
|
|
|
17
18
|
end
|
|
18
19
|
end
|
|
19
20
|
|
|
21
|
+
# Instance methods for projector event processing and tracking.
|
|
20
22
|
module InstanceMethods
|
|
21
23
|
def initialize(tracker: EventSourcery::Postgres.config.event_tracker,
|
|
22
24
|
db_connection: EventSourcery::Postgres.config.projections_database,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module EventSourcery
|
|
4
4
|
module Postgres
|
|
5
|
+
# Queue that invokes a callback at regular intervals when no items are available.
|
|
5
6
|
class QueueWithIntervalCallback < ::Queue
|
|
6
7
|
attr_accessor :callback
|
|
7
8
|
|
|
@@ -16,7 +17,7 @@ module EventSourcery
|
|
|
16
17
|
super()
|
|
17
18
|
end
|
|
18
19
|
|
|
19
|
-
def pop(non_block_without_callback = false)
|
|
20
|
+
def pop(non_block_without_callback = false) # rubocop:disable Style/OptionalBooleanParameter
|
|
20
21
|
return super if non_block_without_callback
|
|
21
22
|
|
|
22
23
|
pop_with_interval_callback
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module EventSourcery
|
|
4
4
|
module Postgres
|
|
5
|
+
# Mixin providing reactor capabilities for processing events and emitting new events in response.
|
|
5
6
|
module Reactor
|
|
6
7
|
UndeclaredEventEmissionError = Class.new(StandardError)
|
|
7
8
|
|
|
@@ -12,6 +13,7 @@ module EventSourcery
|
|
|
12
13
|
base.include(InstanceMethods)
|
|
13
14
|
end
|
|
14
15
|
|
|
16
|
+
# Class methods for declaring and querying emitted event types.
|
|
15
17
|
module ClassMethods
|
|
16
18
|
# Assign the types of events this reactor can emit.
|
|
17
19
|
#
|
|
@@ -22,7 +24,7 @@ module EventSourcery
|
|
|
22
24
|
|
|
23
25
|
# @return [Array] an array of the types of events this reactor can emit
|
|
24
26
|
def emit_events
|
|
25
|
-
@emits_event_types ||= []
|
|
27
|
+
@emits_event_types ||= [] # rubocop:disable Naming/MemoizedInstanceVariableName
|
|
26
28
|
end
|
|
27
29
|
|
|
28
30
|
# This will tell you if this reactor emits any type of event.
|
|
@@ -41,6 +43,7 @@ module EventSourcery
|
|
|
41
43
|
end
|
|
42
44
|
end
|
|
43
45
|
|
|
46
|
+
# Instance methods for reactor initialisation and event emission.
|
|
44
47
|
module InstanceMethods
|
|
45
48
|
def initialize(tracker: EventSourcery::Postgres.config.event_tracker,
|
|
46
49
|
db_connection: EventSourcery::Postgres.config.projections_database,
|
|
@@ -75,7 +78,7 @@ module EventSourcery
|
|
|
75
78
|
end
|
|
76
79
|
|
|
77
80
|
def invoke_action_and_emit_event(event, action)
|
|
78
|
-
action
|
|
81
|
+
action&.call(event.body)
|
|
79
82
|
event_sink.sink(event)
|
|
80
83
|
end
|
|
81
84
|
end
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module EventSourcery
|
|
4
4
|
module Postgres
|
|
5
|
+
# Mixin providing table management capabilities for projectors and reactors.
|
|
5
6
|
module TableOwner
|
|
6
7
|
DefaultTableError = Class.new(StandardError)
|
|
7
8
|
NoSuchTableError = Class.new(StandardError)
|
|
@@ -10,6 +11,7 @@ module EventSourcery
|
|
|
10
11
|
base.extend(ClassMethods)
|
|
11
12
|
end
|
|
12
13
|
|
|
14
|
+
# Class methods for defining and managing database tables.
|
|
13
15
|
module ClassMethods
|
|
14
16
|
# Hash of the tables and their corresponding blocks.
|
|
15
17
|
#
|
|
@@ -38,7 +40,7 @@ module EventSourcery
|
|
|
38
40
|
|
|
39
41
|
# Reset by dropping each table.
|
|
40
42
|
def reset
|
|
41
|
-
self.class.tables.
|
|
43
|
+
self.class.tables.each_key do |table_name|
|
|
42
44
|
prefixed_name = table_name_prefixed(table_name)
|
|
43
45
|
@db_connection.drop_table(prefixed_name, cascade: true) if @db_connection.table_exists?(prefixed_name)
|
|
44
46
|
end
|
|
@@ -49,7 +51,7 @@ module EventSourcery
|
|
|
49
51
|
# This will truncate all the tables and reset the tracker back to 0,
|
|
50
52
|
# done as a transaction.
|
|
51
53
|
def truncate
|
|
52
|
-
self.class.tables.
|
|
54
|
+
self.class.tables.each_key do |table_name|
|
|
53
55
|
@db_connection.transaction do
|
|
54
56
|
prefixed_name = table_name_prefixed(table_name)
|
|
55
57
|
@db_connection[prefixed_name].truncate
|
|
@@ -17,6 +17,7 @@ require 'event_sourcery/postgres/reactor'
|
|
|
17
17
|
require 'event_sourcery/postgres/tracker'
|
|
18
18
|
|
|
19
19
|
module EventSourcery
|
|
20
|
+
# PostgreSQL adapter for EventSourcery providing event store and projection capabilities.
|
|
20
21
|
module Postgres
|
|
21
22
|
def self.configure
|
|
22
23
|
yield config
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: event_sourcery-postgres
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Envato
|
|
@@ -164,8 +164,8 @@ metadata:
|
|
|
164
164
|
allowed_push_host: https://rubygems.org
|
|
165
165
|
bug_tracker_uri: https://github.com/envato/event_sourcery-postgres/issues
|
|
166
166
|
changelog_uri: https://github.com/envato/event_sourcery-postgres/blob/HEAD/CHANGELOG.md
|
|
167
|
-
documentation_uri: https://www.rubydoc.info/gems/event_sourcery-postgres/1.0.
|
|
168
|
-
source_code_uri: https://github.com/envato/event_sourcery-postgres/tree/v1.0.
|
|
167
|
+
documentation_uri: https://www.rubydoc.info/gems/event_sourcery-postgres/1.0.1
|
|
168
|
+
source_code_uri: https://github.com/envato/event_sourcery-postgres/tree/v1.0.1
|
|
169
169
|
rdoc_options: []
|
|
170
170
|
require_paths:
|
|
171
171
|
- lib
|
|
@@ -180,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
180
180
|
- !ruby/object:Gem::Version
|
|
181
181
|
version: '0'
|
|
182
182
|
requirements: []
|
|
183
|
-
rubygems_version: 4.0.
|
|
183
|
+
rubygems_version: 4.0.4
|
|
184
184
|
specification_version: 4
|
|
185
185
|
summary: Postgres event store for use with EventSourcery
|
|
186
186
|
test_files: []
|