koyo-postgres-replication 0.1.5.pre → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8b45ea024487cd58842efb84ffb49a8a838a087c3302fc1411d02ec1afc646c2
4
- data.tar.gz: 81900cffddb22af277e55be4c558316b9e0a61e3c9d9618f8d47ae1019f479ab
3
+ metadata.gz: b442425bb2a188ad51685679aef54801f99c13c09d37c31a41bada30d02dca9e
4
+ data.tar.gz: 57d47436468e45514b37859159865aad5814102e45b0a38e0c3b844b9ada6109
5
5
  SHA512:
6
- metadata.gz: 52657842594b2e36b7ac7f658b2c3a56b3e4c6a4d7b22896dd1fade2daa34c7d7a4a9884c374930b055180b46078b72b2c6bdddf2a6b8a518ea67528e8b58b56
7
- data.tar.gz: 7252cd8c30c701ee033cf7244ed668e9b23d9c9b0f48d958835eafe59a0419c0df60a05e09e580ebb798bec704e44708bd12905cf658669494ed58fa6a3082f6
6
+ metadata.gz: e4282f4ed1ab6425c860b407cb350322ceb2dd94c604dd4c92024094c8e3768852d8420ff8ad7e63771c2feceaa6589b375b1c82ad36597470e42fefc110286c
7
+ data.tar.gz: 9e9b7ea6672422be740574d4816e8e441269f003658c94e42c8561c53ba4f64ee2e4f52b535c55cb3eec4168729a865ed84ab5505e03eeed80f1b6ef4e33ac8f
data/.yardoc/checksums CHANGED
@@ -4,7 +4,7 @@ lib/koyo/repl/mod.rb 92b54b56643b06fdc74adc65dc04460f631d4036
4
4
  lib/koyo/repl/data.rb cb847585c0f439b9f645b5ebd7fa3b96e08b94ff
5
5
  lib/koyo/repl/install.rb 9b19b7bb74d084882a1f726693bac2d693015daa
6
6
  lib/koyo/repl/railtie.rb 9c560c38f4663edda57aa39c9bb4bd9411daabbd
7
- lib/koyo/repl/version.rb d0d535b2aac27e3caa5eaeef69e117772e334f44
7
+ lib/koyo/repl/version.rb a05897446d0fc22220b2393f10f0ab1f4dbba1d8
8
8
  lib/koyo/repl/data_row.rb 46bd0b440721f3b0ddcded3fef1817ca5d77cb35
9
9
  lib/koyo/repl/database.rb 719f2723b83a927e0524f6dea79393caaeba0514
10
10
  lib/koyo/repl/diagnostics.rb 93226c47642c5e20f615425aff8a0c0ba988b07b
Binary file
data/Dockerfile CHANGED
@@ -17,13 +17,8 @@ RUN gem update --system && gem install bundler && gem install rails
17
17
 
18
18
  WORKDIR /usr/src/app
19
19
 
20
- COPY Gemfile .
21
- COPY Gemfile.lock .
22
-
23
20
  COPY . .
24
21
 
25
22
  RUN bundle install
26
23
 
27
- COPY . .
28
-
29
24
  CMD ["irb"]
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- koyo-postgres-replication (0.1.5.pre)
4
+ koyo-postgres-replication (7.0.0)
5
5
  pg (~> 1.1)
6
6
  rack (~> 2.0, >= 2.0.0)
7
7
  rails (~> 7.0)
data/README.md CHANGED
@@ -4,9 +4,63 @@
4
4
 
5
5
  効用 koyo - Japanese for utility
6
6
 
7
- ## Replcation slots
7
+ ## What is this?
8
8
 
9
- This gem tries to simplify dealing with a `replication slot` in Postgres.
9
+ This gem tries to simplify dealing with a `replication slot` in Postgres. It
10
+ gives you a simple way to capture events in your Rails app when your Postgres
11
+ DB has a create, update, delete event. You can manage this from one class, or
12
+ manage this on a table-by-table basis within ActiveRecord Models.
13
+
14
+ Example of catch all:
15
+
16
+ ```
17
+ class KoyoReplHandlerService < Koyo::Repl::EventHandlerService
18
+ class << self
19
+ # This is called whenever a create/update/delete action happens
20
+ # @param (Koyo::Repl::DataRow) row is docuemented in the wiki at
21
+ # https://github.com/wiseleyb/koyo-postgres-replication/wiki/Koyo::Repl::DataRow-data-spec
22
+ def koyo_handle_all_replication(row)
23
+ case row.kind
24
+ when 'insert'
25
+ case row.table
26
+ when 'users'
27
+ # Do something with data... like update some api
28
+ # It's important to do this async (active-job/sidekiq) so you
29
+ # don't back up the replication slot
30
+ UpdateSomeApi.performn_async(row.id)
31
+ # This job would do something like:
32
+ # User.find(row.id); Call some API with data
33
+ when 'delete'
34
+ when 'update'
35
+ end
36
+ end
37
+ end
38
+ ```
39
+
40
+ Example of model callback:
41
+
42
+ ```
43
+ class User < ApplicationRecord
44
+ include Koyo::Repl::Mod
45
+ koyo_repl_handler :handle_replication
46
+
47
+ # This is called when a row is created/updated/deleted for the users table
48
+ # @param (Koyo::Repl::DataRow) row is docuemented in the wiki at
49
+ # https://github.com/wiseleyb/koyo-postgres-replication/wiki/Koyo::Repl::DataRow-data-spec
50
+ def self.handle_replication(row)
51
+ case row.kind
52
+ when 'insert'
53
+ # Do something with data... like update some api
54
+ # It's important to do this async (active-job/sidekiq) so you
55
+ # don't back up the replication slot
56
+ UpdateSomeApi.performn_async(row.id)
57
+ # This job would do something like:
58
+ # User.find(row.id); Call some API with data
59
+ when 'delete'
60
+ when 'update'
61
+ end
62
+ end
63
+ ```
10
64
 
11
65
  ### What is a replication slot?
12
66
 
@@ -36,6 +90,18 @@ wiki](https://github.com/wiseleyb/koyo-postgres-replication/wiki/Configuring-Pos
36
90
 
37
91
  Add to Gemfile:
38
92
 
93
+ ### Versions
94
+
95
+ The `main` branch is always the latest code. Branches contain versions that are specific to Rails.
96
+
97
+ |Rails|Branch|Gemfile|
98
+ |---|---|---|
99
+ |7|[verions/7.0.0](https://github.com/wiseleyb/koyo-postgres-replication/tree/versions/7.0.0)|`gem 'koyo-postgres-replication', '~> 7.0', require: 'koyo'`|
100
+ |6|coming soon|n/a|
101
+ |5|coming soon|n/a|
102
+ |4|coming soon|n/a|
103
+ |3|probably not coming soon|n/a|
104
+
39
105
  ```
40
106
  gem 'koyo-postgres-replication', require: 'koyo'
41
107
  ```
data/changelog.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Koyo Postgres Replication Changelog
2
2
 
3
+ ## 0.1.6.pre
4
+
5
+ - Clean up docker config
6
+ - Clean up README/doc
7
+
3
8
  ## 0.1.5.pre
4
9
 
5
10
  - Yard doc gemspec change to get it to show up in rubygems
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Koyo
4
4
  module Repl
5
- VERSION = '0.1.5.pre'
5
+ VERSION = '7.0.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: koyo-postgres-replication
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5.pre
4
+ version: 7.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Wiseley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-21 00:00:00.000000000 Z
11
+ date: 2023-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg
@@ -164,9 +164,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
164
164
  version: 2.7.0
165
165
  required_rubygems_version: !ruby/object:Gem::Requirement
166
166
  requirements:
167
- - - ">"
167
+ - - ">="
168
168
  - !ruby/object:Gem::Version
169
- version: 1.3.1
169
+ version: '0'
170
170
  requirements: []
171
171
  rubygems_version: 3.4.10
172
172
  signing_key: