event_sourcery-postgres 0.7.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +53 -1
- data/README.md +2 -2
- data/event_sourcery-postgres.gemspec +7 -2
- data/lib/event_sourcery/postgres/config.rb +3 -1
- data/lib/event_sourcery/postgres/event_store.rb +8 -3
- data/lib/event_sourcery/postgres/schema.rb +1 -1
- data/lib/event_sourcery/postgres/version.rb +1 -1
- metadata +17 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 824d15b46de51809119f1adec5708cab3e6e252dabeedc5257cda2b1c934a7bf
|
4
|
+
data.tar.gz: deea46e08d13e42d46d37ac7379ccc9782a87e5137710004ce1c922ad283f40d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9cf1a6d3aad1270378fa68855ca339a3a0bca8aa13c8c06c82da634b340a93822d73254da780fbc6ef7420f9901836ebd81d68cfe0c8c506584b1be3c50c028
|
7
|
+
data.tar.gz: 520be11bd4e97b6ecd07fcc995c613c4978dcb97509569d15fda3d28206acd41696db718d54bc54861f72a38e59bdaf61a18369aa09c60cc748991700cb5dc90
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,53 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
6
6
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
7
7
|
|
8
|
+
## [Unreleased]
|
9
|
+
## [0.9.1] - 2022-01-20
|
10
|
+
|
11
|
+
### Changed
|
12
|
+
|
13
|
+
- Removed the use of `**` for the private `EventStore#build_event`
|
14
|
+
method signature and places that call it.
|
15
|
+
|
16
|
+
## [0.9.0] - 2021-11-18
|
17
|
+
|
18
|
+
### Added
|
19
|
+
|
20
|
+
- Test against Ruby 3.0 in the CI build ([#67]).
|
21
|
+
|
22
|
+
### Changed
|
23
|
+
|
24
|
+
- Use GitHub Actions for the CI build instead of Travis CI ([#66]).
|
25
|
+
- This project now uses `main` as its default branch ([#68]).
|
26
|
+
- Documentation updated to refer to `main` and links updated accordingly.
|
27
|
+
|
28
|
+
### Removed
|
29
|
+
- Remove Ruby 2.3, 2.4 and 2.5 from the CI test matrix ([#70]).
|
30
|
+
|
31
|
+
[#66]: https://github.com/envato/event_sourcery-postgres/pull/66
|
32
|
+
[#67]: https://github.com/envato/event_sourcery-postgres/pull/67
|
33
|
+
[#68]: https://github.com/envato/event_sourcery-postgres/pull/68
|
34
|
+
[#70]: https://github.com/envato/event_sourcery-postgres/pull/70
|
35
|
+
|
36
|
+
## [0.8.1] - 2020-10-02
|
37
|
+
### Added
|
38
|
+
- Add Ruby 2.6 and 2.7 to the CI test matrix.
|
39
|
+
|
40
|
+
### Removed
|
41
|
+
- Remove Ruby 2.2 from the CI test matrix.
|
42
|
+
- Support for Boxen.
|
43
|
+
|
44
|
+
### Fixed
|
45
|
+
- Upgrade development dependency Rake to version 13. This resolves
|
46
|
+
[CVE-2020-8130](https://github.com/advisories/GHSA-jppv-gw3r-w3q8).
|
47
|
+
|
48
|
+
- Resolve warnings raised when running on Ruby 2.7.
|
49
|
+
|
50
|
+
## [0.8.0] - 2018-08-06
|
51
|
+
### Added
|
52
|
+
- Add a `on_events_recorded` config option, that defaults to a no-op proc, \
|
53
|
+
to handle any app specific logic after the events are recoded on `EventStore#sink`
|
54
|
+
|
8
55
|
## [0.7.0] - 2018-05-23
|
9
56
|
### Added
|
10
57
|
- Add a `projector_transaction_size` config option to control how many events
|
@@ -70,7 +117,12 @@ or when the loop stops
|
|
70
117
|
- Postgres related configuration is through `EventSourcery::Postgres.configure`
|
71
118
|
instead of `EventSourcery.configure`.
|
72
119
|
|
73
|
-
[Unreleased]: https://github.com/envato/event_sourcery-postgres/compare/v0.
|
120
|
+
[Unreleased]: https://github.com/envato/event_sourcery-postgres/compare/v0.9.1...HEAD
|
121
|
+
[0.9.1]: https://github.com/envato/event_sourcery-postgres/compare/v0.9.0...v0.9.1
|
122
|
+
[0.9.0]: https://github.com/envato/event_sourcery-postgres/compare/v0.8.1...v0.9.0
|
123
|
+
[0.8.1]: https://github.com/envato/event_sourcery-postgres/compare/v0.8.0...v0.8.1
|
124
|
+
[0.8.0]: https://github.com/envato/event_sourcery-postgres/compare/v0.7.0...v0.8.0
|
125
|
+
[0.7.0]: https://github.com/envato/event_sourcery-postgres/compare/v0.6.0...v0.7.0
|
74
126
|
[0.6.0]: https://github.com/envato/event_sourcery-postgres/compare/v0.5.0...v0.6.0
|
75
127
|
[0.5.0]: https://github.com/envato/event_sourcery-postgres/compare/v0.4.0...v0.5.0
|
76
128
|
[0.4.0]: https://github.com/envato/event_sourcery-postgres/compare/v0.3.0...v0.4.0
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# EventSourcery::Postgres
|
2
2
|
|
3
|
-
[![Build Status](https://
|
3
|
+
[![Build Status](https://github.com/envato/event_sourcery-postgres/workflows/tests/badge.svg?branch=main)](https://github.com/envato/event_sourcery-postgres/actions?query=workflow%3Atests+branch%3Amain)
|
4
4
|
|
5
5
|
## Development Status
|
6
6
|
|
@@ -89,7 +89,7 @@ To install this gem onto your local machine, run `bundle exec rake install`.
|
|
89
89
|
To release a new version:
|
90
90
|
|
91
91
|
1. Update the version number in `lib/event_sourcery/postgres/version.rb`
|
92
|
-
2. Get this change onto
|
92
|
+
2. Get this change onto main via the normal PR process
|
93
93
|
3. Run `bundle exec rake release`, this will create a git tag for the
|
94
94
|
version, push tags up to GitHub, and upload the gem to rubygems.org.
|
95
95
|
|
@@ -12,6 +12,11 @@ Gem::Specification.new do |spec|
|
|
12
12
|
|
13
13
|
spec.summary = 'Postgres event store for use with EventSourcery'
|
14
14
|
spec.homepage = 'https://github.com/envato/event_sourcery-postgres'
|
15
|
+
spec.metadata = {
|
16
|
+
'bug_tracker_uri' => 'https://github.com/envato/event_sourcery-postgres/issues',
|
17
|
+
'changelog_uri' => 'https://github.com/envato/event_sourcery-postgres/blob/HEAD/CHANGELOG.md',
|
18
|
+
'source_code_uri' => 'https://github.com/envato/event_sourcery-postgres',
|
19
|
+
}
|
15
20
|
|
16
21
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
22
|
f.match(%r{^(\.|bin/|Gemfile|Rakefile|script/|spec/)})
|
@@ -25,8 +30,8 @@ Gem::Specification.new do |spec|
|
|
25
30
|
spec.add_dependency 'sequel', '>= 4.38'
|
26
31
|
spec.add_dependency 'pg'
|
27
32
|
spec.add_dependency 'event_sourcery', '>= 0.14.0'
|
28
|
-
spec.add_development_dependency 'bundler'
|
29
|
-
spec.add_development_dependency 'rake', '~>
|
33
|
+
spec.add_development_dependency 'bundler'
|
34
|
+
spec.add_development_dependency 'rake', '~> 13'
|
30
35
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
31
36
|
spec.add_development_dependency 'pry'
|
32
37
|
spec.add_development_dependency 'benchmark-ips'
|
@@ -9,7 +9,8 @@ module EventSourcery
|
|
9
9
|
:callback_interval_if_no_new_events,
|
10
10
|
:auto_create_projector_tracker,
|
11
11
|
:event_tracker,
|
12
|
-
:projector_transaction_size
|
12
|
+
:projector_transaction_size,
|
13
|
+
:on_events_recorded
|
13
14
|
|
14
15
|
attr_writer :event_store,
|
15
16
|
:event_source,
|
@@ -28,6 +29,7 @@ module EventSourcery
|
|
28
29
|
@event_store_database = nil
|
29
30
|
@auto_create_projector_tracker = true
|
30
31
|
@projector_transaction_size = 1
|
32
|
+
@on_events_recorded = ->(events) {}
|
31
33
|
end
|
32
34
|
|
33
35
|
def event_store
|
@@ -7,12 +7,14 @@ module EventSourcery
|
|
7
7
|
events_table_name: EventSourcery::Postgres.config.events_table_name,
|
8
8
|
lock_table: EventSourcery::Postgres.config.lock_table_to_guarantee_linear_sequence_id_growth,
|
9
9
|
write_events_function_name: EventSourcery::Postgres.config.write_events_function_name,
|
10
|
-
event_builder: EventSourcery.config.event_builder
|
10
|
+
event_builder: EventSourcery.config.event_builder,
|
11
|
+
on_events_recorded: EventSourcery::Postgres.config.on_events_recorded)
|
11
12
|
@db_connection = db_connection
|
12
13
|
@events_table_name = events_table_name
|
13
14
|
@write_events_function_name = write_events_function_name
|
14
15
|
@lock_table = lock_table
|
15
16
|
@event_builder = event_builder
|
17
|
+
@on_events_recorded = on_events_recorded
|
16
18
|
end
|
17
19
|
|
18
20
|
# Like water flowing into a sink eventually it will go down the drain
|
@@ -33,6 +35,7 @@ module EventSourcery
|
|
33
35
|
sql = write_events_sql(aggregate_ids.first, events, expected_version)
|
34
36
|
@db_connection.run(sql)
|
35
37
|
log_events_saved(events)
|
38
|
+
on_events_recorded.call(events)
|
36
39
|
true
|
37
40
|
rescue Sequel::DatabaseError => e
|
38
41
|
if e.message =~ /Concurrency conflict/
|
@@ -104,17 +107,19 @@ module EventSourcery
|
|
104
107
|
subscription_master: subscription_master,
|
105
108
|
on_new_events: block
|
106
109
|
}
|
107
|
-
EventSourcery::EventStore::Subscription.new(args).tap(&:start)
|
110
|
+
EventSourcery::EventStore::Subscription.new(**args).tap(&:start)
|
108
111
|
end
|
109
112
|
|
110
113
|
private
|
111
114
|
|
115
|
+
attr_reader :on_events_recorded
|
116
|
+
|
112
117
|
def events_table
|
113
118
|
@db_connection[@events_table_name]
|
114
119
|
end
|
115
120
|
|
116
121
|
def build_event(data)
|
117
|
-
@event_builder.build(data)
|
122
|
+
@event_builder.build(**data)
|
118
123
|
end
|
119
124
|
|
120
125
|
def write_events_sql(aggregate_id, events, expected_version)
|
@@ -53,7 +53,7 @@ module EventSourcery
|
|
53
53
|
def create_aggregates(db: EventSourcery::Postgres.config.event_store_database,
|
54
54
|
table_name: EventSourcery::Postgres.config.aggregates_table_name)
|
55
55
|
db.create_table(table_name) do
|
56
|
-
|
56
|
+
uuid :aggregate_id, primary_key: true
|
57
57
|
column :version, :bigint, default: 1
|
58
58
|
end
|
59
59
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: event_sourcery-postgres
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Envato
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sequel
|
@@ -56,30 +56,30 @@ dependencies:
|
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '13'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '13'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,7 +122,7 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
-
description:
|
125
|
+
description:
|
126
126
|
email:
|
127
127
|
- rubygems@envato.com
|
128
128
|
executables: []
|
@@ -147,8 +147,11 @@ files:
|
|
147
147
|
- lib/event_sourcery/postgres/version.rb
|
148
148
|
homepage: https://github.com/envato/event_sourcery-postgres
|
149
149
|
licenses: []
|
150
|
-
metadata:
|
151
|
-
|
150
|
+
metadata:
|
151
|
+
bug_tracker_uri: https://github.com/envato/event_sourcery-postgres/issues
|
152
|
+
changelog_uri: https://github.com/envato/event_sourcery-postgres/blob/HEAD/CHANGELOG.md
|
153
|
+
source_code_uri: https://github.com/envato/event_sourcery-postgres
|
154
|
+
post_install_message:
|
152
155
|
rdoc_options: []
|
153
156
|
require_paths:
|
154
157
|
- lib
|
@@ -163,9 +166,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
163
166
|
- !ruby/object:Gem::Version
|
164
167
|
version: '0'
|
165
168
|
requirements: []
|
166
|
-
|
167
|
-
|
168
|
-
signing_key:
|
169
|
+
rubygems_version: 3.2.22
|
170
|
+
signing_key:
|
169
171
|
specification_version: 4
|
170
172
|
summary: Postgres event store for use with EventSourcery
|
171
173
|
test_files: []
|