evt-message_store-postgres 0.1.0.0 → 0.2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/database/clear-events-table.sh +2 -2
- data/database/functions/stream-version.sql +1 -1
- data/database/functions/{write-event.sql → write-message.sql} +5 -5
- data/database/indexes/messages-category-global-position.sql +1 -0
- data/database/indexes/messages-category.sql +1 -0
- data/database/indexes/messages-id.sql +1 -0
- data/database/indexes/messages-stream-name-position-uniq.sql +1 -0
- data/database/indexes/messages-stream-name.sql +1 -0
- data/database/install.sh +14 -14
- data/database/list-events.sh +2 -2
- data/database/table/{events-table.sql → messages-table.sql} +4 -4
- data/database/test/write-message-expected-version.sql +1 -0
- data/database/test/write-message.sql +1 -0
- data/database/uninstall.sh +1 -1
- data/lib/message_store/postgres/get/last/select_statement.rb +1 -1
- data/lib/message_store/postgres/get/select_statement.rb +1 -1
- data/lib/message_store/postgres/put.rb +1 -1
- metadata +12 -13
- data/database/indexes/events-category-global-position.sql +0 -1
- data/database/indexes/events-category.sql +0 -1
- data/database/indexes/events-id.sql +0 -1
- data/database/indexes/events-stream-name-position-uniq.sql +0 -1
- data/database/indexes/events-stream-name.sql +0 -1
- data/database/test/write-event-expected-version.sql +0 -1
- data/database/test/write-event.sql +0 -1
- data/scripts/scripts_init.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 796d8a6dba3a6a145a98ccb15c708b910a4156de
|
4
|
+
data.tar.gz: f06453f464d1c9abebfe9187a2e6e93a86c0d9aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b3ab5078b3db3388afdd8c82d234d90932a01055483947287fd5eeeaeb7dabe8b0a4e98b08d77d3e1765db89834d7c9db5724d0be63b71775eb6265672ec292
|
7
|
+
data.tar.gz: 5e4326aa12243973079b0633d08f4e392dcf050524a0e5686cbc19278951669cdec163b94589d2eaf6bb56b31f1bfbeda6b3664c5267641e75da3b3cd0ede145
|
@@ -7,7 +7,7 @@ echo "Clearing Events Table"
|
|
7
7
|
echo "= = ="
|
8
8
|
echo
|
9
9
|
|
10
|
-
default_name=
|
10
|
+
default_name=message_store
|
11
11
|
|
12
12
|
if [ -z ${DATABASE_USER+x} ]; then
|
13
13
|
echo "(DATABASE_USER is not set)"
|
@@ -25,7 +25,7 @@ else
|
|
25
25
|
fi
|
26
26
|
echo "Database name is: $database"
|
27
27
|
|
28
|
-
default_table_name=
|
28
|
+
default_table_name=messages
|
29
29
|
|
30
30
|
if [ -z ${TABLE_NAME+x} ]; then
|
31
31
|
echo "(TABLE_NAME is not set)"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
CREATE OR REPLACE FUNCTION
|
1
|
+
CREATE OR REPLACE FUNCTION write_message(
|
2
2
|
_id varchar,
|
3
3
|
_stream_name varchar,
|
4
4
|
_type varchar,
|
@@ -9,12 +9,12 @@ CREATE OR REPLACE FUNCTION write_event(
|
|
9
9
|
RETURNS int
|
10
10
|
AS $$
|
11
11
|
DECLARE
|
12
|
-
|
12
|
+
message_id uuid;
|
13
13
|
stream_version int;
|
14
14
|
position int;
|
15
15
|
category varchar;
|
16
16
|
BEGIN
|
17
|
-
|
17
|
+
message_id = uuid(_id);
|
18
18
|
|
19
19
|
stream_version := stream_version(_stream_name);
|
20
20
|
|
@@ -30,7 +30,7 @@ BEGIN
|
|
30
30
|
|
31
31
|
position := stream_version + 1;
|
32
32
|
|
33
|
-
insert into "
|
33
|
+
insert into "messages"
|
34
34
|
(
|
35
35
|
"id",
|
36
36
|
"stream_name",
|
@@ -41,7 +41,7 @@ BEGIN
|
|
41
41
|
)
|
42
42
|
values
|
43
43
|
(
|
44
|
-
|
44
|
+
message_id,
|
45
45
|
_stream_name,
|
46
46
|
position,
|
47
47
|
_type,
|
@@ -0,0 +1 @@
|
|
1
|
+
CREATE INDEX CONCURRENTLY "messages_category_global_position_idx" ON "public"."messages" USING btree(category(stream_name) COLLATE "default" "pg_catalog"."text_ops" ASC NULLS LAST, "global_position" "pg_catalog"."int8_ops" ASC NULLS LAST);
|
@@ -0,0 +1 @@
|
|
1
|
+
CREATE INDEX CONCURRENTLY "messages_category_idx" ON "public"."messages" USING btree(category(stream_name) COLLATE "default" "pg_catalog"."text_ops" ASC NULLS LAST);
|
@@ -0,0 +1 @@
|
|
1
|
+
CREATE INDEX CONCURRENTLY "messages_id_idx" ON "public"."messages" USING btree(id ASC NULLS LAST);
|
@@ -0,0 +1 @@
|
|
1
|
+
CREATE UNIQUE INDEX CONCURRENTLY "messages_stream_name_position_uniq_idx" ON "public"."messages" USING btree(stream_name COLLATE "default" "pg_catalog"."text_ops" ASC NULLS LAST, "position" "pg_catalog"."int4_ops" ASC NULLS LAST);
|
@@ -0,0 +1 @@
|
|
1
|
+
CREATE INDEX CONCURRENTLY "messages_stream_name_idx" ON "public"."messages" USING btree(stream_name COLLATE "default" "pg_catalog"."text_ops" ASC NULLS LAST);
|
data/database/install.sh
CHANGED
@@ -7,7 +7,7 @@ echo "Installing Database"
|
|
7
7
|
echo "= = ="
|
8
8
|
echo
|
9
9
|
|
10
|
-
default_name=
|
10
|
+
default_name=message_store
|
11
11
|
|
12
12
|
if [ -z ${DATABASE_USER+x} ]; then
|
13
13
|
echo "(DATABASE_USER is not set. Default will be used.)"
|
@@ -61,9 +61,9 @@ function create-extensions {
|
|
61
61
|
}
|
62
62
|
|
63
63
|
function create-table {
|
64
|
-
echo "Creating
|
64
|
+
echo "Creating messages table..."
|
65
65
|
base=$(script_dir)
|
66
|
-
psql $database -f $base/table/
|
66
|
+
psql $database -f $base/table/messages-table.sql
|
67
67
|
echo
|
68
68
|
}
|
69
69
|
|
@@ -75,23 +75,23 @@ function create-functions {
|
|
75
75
|
echo "stream_version function"
|
76
76
|
psql $database -f $base/functions/stream-version.sql
|
77
77
|
echo "write_sql function"
|
78
|
-
psql $database -f $base/functions/write-
|
78
|
+
psql $database -f $base/functions/write-message.sql
|
79
79
|
echo
|
80
80
|
}
|
81
81
|
|
82
82
|
function create-indexes {
|
83
83
|
base=$(script_dir)
|
84
84
|
echo "Creating indexes..."
|
85
|
-
echo "
|
86
|
-
psql $database -f $base/indexes/
|
87
|
-
echo "
|
88
|
-
psql $database -f $base/indexes/
|
89
|
-
echo "
|
90
|
-
psql $database -f $base/indexes/
|
91
|
-
echo "
|
92
|
-
psql $database -f $base/indexes/
|
93
|
-
echo "
|
94
|
-
psql $database -f $base/indexes/
|
85
|
+
echo "messages_id_idx"
|
86
|
+
psql $database -f $base/indexes/messages-id.sql
|
87
|
+
echo "messages_category_global_position_idx"
|
88
|
+
psql $database -f $base/indexes/messages-category-global-position.sql
|
89
|
+
echo "messages_category_idx"
|
90
|
+
psql $database -f $base/indexes/messages-category.sql
|
91
|
+
echo "messages_stream_name_idx"
|
92
|
+
psql $database -f $base/indexes/messages-stream-name.sql
|
93
|
+
echo "messages_stream_name_position_uniq_idx"
|
94
|
+
psql $database -f $base/indexes/messages-stream-name-position-uniq.sql
|
95
95
|
echo
|
96
96
|
}
|
97
97
|
|
data/database/list-events.sh
CHANGED
@@ -7,7 +7,7 @@ echo "Listing Events"
|
|
7
7
|
echo "= = ="
|
8
8
|
echo
|
9
9
|
|
10
|
-
default_name=
|
10
|
+
default_name=message_store
|
11
11
|
|
12
12
|
if [ -z ${DATABASE_USER+x} ]; then
|
13
13
|
echo "(DATABASE_USER is not set)"
|
@@ -25,7 +25,7 @@ else
|
|
25
25
|
fi
|
26
26
|
echo "Database name is: $database"
|
27
27
|
|
28
|
-
default_table_name=
|
28
|
+
default_table_name=messages
|
29
29
|
|
30
30
|
if [ -z ${TABLE_NAME+x} ]; then
|
31
31
|
echo "(TABLE_NAME is not set)"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
-- ----------------------------
|
2
|
-
-- Table structure for
|
2
|
+
-- Table structure for messages
|
3
3
|
-- ----------------------------
|
4
|
-
CREATE TABLE "public"."
|
4
|
+
CREATE TABLE "public"."messages" (
|
5
5
|
"id" UUID NOT NULL DEFAULT gen_random_uuid(),
|
6
6
|
"stream_name" varchar(255) NOT NULL COLLATE "default",
|
7
7
|
"type" varchar(255) NOT NULL COLLATE "default",
|
@@ -14,6 +14,6 @@ CREATE TABLE "public"."events" (
|
|
14
14
|
WITH (OIDS=FALSE);
|
15
15
|
|
16
16
|
-- ----------------------------
|
17
|
-
-- Primary key structure for table
|
17
|
+
-- Primary key structure for table messages
|
18
18
|
-- ----------------------------
|
19
|
-
ALTER TABLE "public"."
|
19
|
+
ALTER TABLE "public"."messages" ADD PRIMARY KEY ("global_position") NOT DEFERRABLE INITIALLY IMMEDIATE;
|
@@ -0,0 +1 @@
|
|
1
|
+
SELECT write_message('someStream-123', 'SomeType', '{"someField":"some value"}', '{"someMetadataField":"some metadata value"}', 1);
|
@@ -0,0 +1 @@
|
|
1
|
+
SELECT write_message('someStream-123', 'SomeType', '{"someField":"some value"}', '{"someMetadataField":"some metadata value"}');
|
data/database/uninstall.sh
CHANGED
@@ -88,7 +88,7 @@ module MessageStore
|
|
88
88
|
end
|
89
89
|
|
90
90
|
def self.statement
|
91
|
-
@statement ||= "SELECT
|
91
|
+
@statement ||= "SELECT write_message($1::varchar, $2::varchar, $3::varchar, $4::jsonb, $5::jsonb, $6::int);"
|
92
92
|
end
|
93
93
|
|
94
94
|
def serialized_data(data)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: evt-message_store-postgres
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The Eventide Project
|
8
8
|
autorequire:
|
9
9
|
bindir: scripts
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: evt-message_store
|
@@ -94,17 +94,17 @@ files:
|
|
94
94
|
- database/extensions.sql
|
95
95
|
- database/functions/category.sql
|
96
96
|
- database/functions/stream-version.sql
|
97
|
-
- database/functions/write-
|
98
|
-
- database/indexes/
|
99
|
-
- database/indexes/
|
100
|
-
- database/indexes/
|
101
|
-
- database/indexes/
|
102
|
-
- database/indexes/
|
97
|
+
- database/functions/write-message.sql
|
98
|
+
- database/indexes/messages-category-global-position.sql
|
99
|
+
- database/indexes/messages-category.sql
|
100
|
+
- database/indexes/messages-id.sql
|
101
|
+
- database/indexes/messages-stream-name-position-uniq.sql
|
102
|
+
- database/indexes/messages-stream-name.sql
|
103
103
|
- database/install.sh
|
104
104
|
- database/list-events.sh
|
105
|
-
- database/table/
|
106
|
-
- database/test/write-
|
107
|
-
- database/test/write-
|
105
|
+
- database/table/messages-table.sql
|
106
|
+
- database/test/write-message-expected-version.sql
|
107
|
+
- database/test/write-message.sql
|
108
108
|
- database/uninstall.sh
|
109
109
|
- lib/message_store/postgres.rb
|
110
110
|
- lib/message_store/postgres/controls.rb
|
@@ -128,7 +128,6 @@ files:
|
|
128
128
|
- scripts/evt-pg-delete-db
|
129
129
|
- scripts/evt-pg-list-events
|
130
130
|
- scripts/evt-pg-recreate-db
|
131
|
-
- scripts/scripts_init.rb
|
132
131
|
homepage: https://github.com/eventide-project/message-store-postgres
|
133
132
|
licenses:
|
134
133
|
- MIT
|
@@ -152,5 +151,5 @@ rubyforge_project:
|
|
152
151
|
rubygems_version: 2.6.11
|
153
152
|
signing_key:
|
154
153
|
specification_version: 4
|
155
|
-
summary:
|
154
|
+
summary: Message store implementation for PostgreSQL
|
156
155
|
test_files: []
|
@@ -1 +0,0 @@
|
|
1
|
-
CREATE INDEX CONCURRENTLY "events_category_global_position_idx" ON "public"."events" USING btree(category(stream_name) COLLATE "default" "pg_catalog"."text_ops" ASC NULLS LAST, "global_position" "pg_catalog"."int8_ops" ASC NULLS LAST);
|
@@ -1 +0,0 @@
|
|
1
|
-
CREATE INDEX CONCURRENTLY "events_category_idx" ON "public"."events" USING btree(category(stream_name) COLLATE "default" "pg_catalog"."text_ops" ASC NULLS LAST);
|
@@ -1 +0,0 @@
|
|
1
|
-
CREATE INDEX CONCURRENTLY "events_id_idx" ON "public"."events" USING btree(id ASC NULLS LAST);
|
@@ -1 +0,0 @@
|
|
1
|
-
CREATE UNIQUE INDEX CONCURRENTLY "events_stream_name_position_uniq_idx" ON "public"."events" USING btree(stream_name COLLATE "default" "pg_catalog"."text_ops" ASC NULLS LAST, "position" "pg_catalog"."int4_ops" ASC NULLS LAST);
|
@@ -1 +0,0 @@
|
|
1
|
-
CREATE INDEX CONCURRENTLY "events_stream_name_idx" ON "public"."events" USING btree(stream_name COLLATE "default" "pg_catalog"."text_ops" ASC NULLS LAST);
|
@@ -1 +0,0 @@
|
|
1
|
-
SELECT write_event('someStream-123', 'SomeType', '{"someField":"some value"}', '{"someMetadataField":"some metadata value"}', 1);
|
@@ -1 +0,0 @@
|
|
1
|
-
SELECT write_event('someStream-123', 'SomeType', '{"someField":"some value"}', '{"someMetadataField":"some metadata value"}');
|
data/scripts/scripts_init.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
ENV['CONSOLE_DEVICE'] ||= 'stdout'
|
2
|
-
ENV['LOG_LEVEL'] ||= '_min'
|
3
|
-
|
4
|
-
puts RUBY_DESCRIPTION
|
5
|
-
|
6
|
-
init_file = File.expand_path('../init.rb', __dir__)
|
7
|
-
if File.exist?(init_file)
|
8
|
-
require_relative '../init'
|
9
|
-
end
|
10
|
-
|
11
|
-
require 'event_source/postgres'
|
12
|
-
require 'event_source/postgres/database'
|