purview 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +5 -0
- data/README.md +8 -0
- data/lib/purview/databases/base.rb +29 -4
- data/lib/purview/exceptions/wrong_database.rb +9 -0
- data/lib/purview/exceptions.rb +1 -0
- data/lib/purview/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1369176b107aba11f52e4a8604fdfd440969f3e1
|
4
|
+
data.tar.gz: 989bbb48900af7fb712c9745b505727bd4963d53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96aed3e255fe0a70bbaec213852a50da2ae7ddcf81ba9633a50d45ee6979cfdcfc1ffc614a5412c9b27964934d4b62bda405bb314f829acaa009133a4228964a
|
7
|
+
data.tar.gz: 2a8645de4002ef60ba092c796d0099ab0ed2851bc54261cf9e494cc41999f434002fe4a04ec904d3e34a1c4b6b718f305aa9e4a7aa51971272ed5e4d5cbf47f4
|
data/CHANGELOG
CHANGED
data/README.md
CHANGED
@@ -128,6 +128,14 @@ as the high-water mark for records pulled from its source
|
|
128
128
|
database.initialize_table(table, timestamp)
|
129
129
|
```
|
130
130
|
|
131
|
+
Baseline the `Table`. This process will quickly get the state of the `Table` as
|
132
|
+
close to the current state as possible. This is generally useful when adding a
|
133
|
+
new `Table` to an existing schema (ideally this should be done while the `Table`
|
134
|
+
is disabled)
|
135
|
+
```ruby
|
136
|
+
database.baseline_table(table)
|
137
|
+
```
|
138
|
+
|
131
139
|
Enable the `Table` (in the DB). This process sets the `enabled_at` value in the
|
132
140
|
`table_metadata` table and is used by the candidate `Table` selection algorithm
|
133
141
|
to determine the pool of `Table(s)` available for synchronization (to remove a
|
@@ -8,6 +8,31 @@ module Purview
|
|
8
8
|
@opts = opts
|
9
9
|
end
|
10
10
|
|
11
|
+
def baseline_table(table)
|
12
|
+
with_context_logging('`baseline_table`') do
|
13
|
+
raise Purview::Exceptions::WrongDatabase.new(table) \
|
14
|
+
unless tables.include?(table)
|
15
|
+
starting_timestamp = Time.now.utc
|
16
|
+
with_table_locked(table, starting_timestamp) do
|
17
|
+
last_window = nil
|
18
|
+
begin
|
19
|
+
with_new_connection do |connection|
|
20
|
+
with_transaction(connection) do |transaction_timestamp|
|
21
|
+
with_next_window(
|
22
|
+
connection,
|
23
|
+
table,
|
24
|
+
transaction_timestamp
|
25
|
+
) do |window|
|
26
|
+
table.sync(connection, window)
|
27
|
+
last_window = window
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end while last_window.max < starting_timestamp
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
11
36
|
def create_table(table, opts={})
|
12
37
|
ensure_table_metadata_exists_for_table(table)
|
13
38
|
table_opts = extract_table_options(opts)
|
@@ -134,14 +159,14 @@ module Purview
|
|
134
159
|
def sync
|
135
160
|
with_context_logging('`sync`') do
|
136
161
|
with_new_connection do |connection|
|
137
|
-
with_transaction(connection) do |
|
138
|
-
with_next_table(connection,
|
162
|
+
with_transaction(connection) do |transaction_timestamp|
|
163
|
+
with_next_table(connection, transaction_timestamp) do |table|
|
139
164
|
with_next_window(
|
140
165
|
connection,
|
141
166
|
table,
|
142
|
-
|
167
|
+
transaction_timestamp
|
143
168
|
) do |window|
|
144
|
-
with_table_locked(table,
|
169
|
+
with_table_locked(table, transaction_timestamp) do
|
145
170
|
table.sync(connection, window)
|
146
171
|
end
|
147
172
|
end
|
data/lib/purview/exceptions.rb
CHANGED
data/lib/purview/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: purview
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan W. Zaleski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -121,6 +121,7 @@ files:
|
|
121
121
|
- lib/purview/exceptions/no_table.rb
|
122
122
|
- lib/purview/exceptions/no_window.rb
|
123
123
|
- lib/purview/exceptions/rows_outside_window.rb
|
124
|
+
- lib/purview/exceptions/wrong_database.rb
|
124
125
|
- lib/purview/loaders.rb
|
125
126
|
- lib/purview/loaders/base.rb
|
126
127
|
- lib/purview/loaders/mysql.rb
|