taps 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :build:
3
3
  :minor: 3
4
- :patch: 4
4
+ :patch: 5
5
5
  :major: 0
@@ -112,7 +112,7 @@ EOHELP
112
112
  end
113
113
 
114
114
  def clientoptparse(cmd)
115
- opts={:default_chunksize => 1000, :database_url => nil, :remote_url => nil, :debug => false, :resume_filename => nil, :disable_compresion => false}
115
+ opts={:default_chunksize => 1000, :database_url => nil, :remote_url => nil, :debug => false, :resume_filename => nil, :disable_compresion => false, :indexes_first => false}
116
116
  OptionParser.new do |o|
117
117
  o.banner = "Usage: #{File.basename($0)} #{cmd} [OPTIONS] <local_database_url> <remote_url>"
118
118
 
@@ -123,6 +123,7 @@ EOHELP
123
123
  o.define_head "Push a database to a taps server"
124
124
  end
125
125
 
126
+ o.on("-i", "--indexes-first", "Transfer indexes first before data") { |v| opts[:indexes_first] = true }
126
127
  o.on("-r", "--resume=file", "Resume a Taps Session from a stored file") { |v| opts[:resume_filename] = v }
127
128
  o.on("-c", "--chunksize=N", "Initial Chunksize") { |v| opts[:default_chunksize] = (v.to_i < 10 ? 10 : v.to_i) }
128
129
  o.on("-g", "--disable-compression", "Disable Compression") { |v| opts[:disable_compression] = true }
@@ -28,6 +28,10 @@ class Operation
28
28
  "op"
29
29
  end
30
30
 
31
+ def indexes_first?
32
+ !!opts[:indexes_first]
33
+ end
34
+
31
35
  def table_filter
32
36
  opts[:table_filter]
33
37
  end
@@ -208,14 +212,14 @@ class Pull < Operation
208
212
  verify_server
209
213
 
210
214
  begin
211
- pull_schema unless resuming?
212
-
215
+ unless resuming?
216
+ pull_schema
217
+ pull_indexes if indexes_first?
218
+ end
213
219
  setup_signal_trap
214
-
215
220
  pull_partial_data if resuming?
216
-
217
221
  pull_data
218
- pull_indexes
222
+ pull_indexes unless indexes_first?
219
223
  pull_reset_sequences
220
224
  close_session
221
225
  rescue RestClient::Exception => e
@@ -375,14 +379,14 @@ class Push < Operation
375
379
  def run
376
380
  verify_server
377
381
  begin
378
- push_schema unless resuming?
379
-
382
+ unless resuming?
383
+ push_schema
384
+ push_indexes if indexes_first?
385
+ end
380
386
  setup_signal_trap
381
-
382
387
  push_partial_data if resuming?
383
-
384
388
  push_data
385
- push_indexes
389
+ push_indexes unless indexes_first?
386
390
  push_reset_sequences
387
391
  close_session
388
392
  rescue RestClient::Exception => e
@@ -406,6 +410,7 @@ class Push < Operation
406
410
  puts "Sending indexes"
407
411
 
408
412
  apply_table_filter(idxs).each do |table, indexes|
413
+ next unless indexes.size > 0
409
414
  progress = ProgressBar.new(table, indexes.size)
410
415
  indexes.each do |idx|
411
416
  session_resource['push/indexes'].post(idx, http_headers)
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 4
9
- version: 0.3.4
8
+ - 5
9
+ version: 0.3.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ricardo Chimal, Jr.
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-26 00:00:00 -07:00
17
+ date: 2010-05-05 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency