mdbm_dist_support 0.1.7 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3a272b098046c296546bee1defc54217945657fd
4
- data.tar.gz: 9ee588cf4ecc8ecd01eb8055180c71a77852cef2
3
+ metadata.gz: 3675ac9d0d6229eb24c54644fb27d023d47963d5
4
+ data.tar.gz: d91c59e9167571096ba4d2885cebb66b47ae02ac
5
5
  SHA512:
6
- metadata.gz: f63bedf4bf47813304dba5a22c0d9a70c1367081d5d251ca3e8a9a8ff3e54d485a87fe5dfabe66881bb4eb166e729ae740bb27dd66945f88668c350590129a34
7
- data.tar.gz: b156be673dbedef634c28e274ac5efbe20598ac418e6860becfb8c80bf9fa195c84294f17df880c5a9c50a81dd9d5d58284c8dd60b5865fbb74388d704f8ce0f
6
+ metadata.gz: 0d033e3f88eb682cbf3337f195265aa6ec4742da0fa2b334ffd6edbb6af83bd5293a71938cdb19a893e49843d9546b7a5eb9a2f6fb7c64542b2312cb416f5c5a
7
+ data.tar.gz: 02ca17a8258056751aefebfb98a40cdaa6f710274c30dddd0181521d623292eb12157235df361c906b0809544e89cf689d86bb6fd6f8c0ca157e65d847828b9f
data/.rspec_status ADDED
@@ -0,0 +1,7 @@
1
+ example_id | status | run_time |
2
+ ------------------------------------- | ------ | --------------- |
3
+ ./spec/mdbm_dist_support_spec.rb[1:1] | passed | 0.0009 seconds |
4
+ ./spec/mdbm_dist_support_spec.rb[1:2] | passed | 0.00062 seconds |
5
+ ./spec/mdbm_dist_support_spec.rb[1:3] | passed | 0.00021 seconds |
6
+ ./spec/mdbm_dist_support_spec.rb[1:4] | passed | 0.00011 seconds |
7
+ ./spec/mdbm_dist_support_spec.rb[1:5] | passed | 0.00028 seconds |
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mdbm_dist_support (0.1.7)
4
+ mdbm_dist_support (0.1.8)
5
5
  ruby-mdbm (>= 0.0.2)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -6,7 +6,7 @@ mdbm distribution support gem
6
6
 
7
7
  ## Usage
8
8
 
9
- update.rb
9
+ ### update.rb
10
10
  ```
11
11
  #!/usr/bin/env ruby
12
12
 
@@ -20,32 +20,30 @@ mds = MdbmDistSupport::Distributer.new do |m|
20
20
  m.cmd_print = 'print command path ( command to print Key Value seperated TAB to STDOUT )'
21
21
  m.cmd_gen = 'generate mdbm command path'
22
22
  m.cmd_rep = 'replace mdbm command path'
23
- m.full_mode = true/false ( full or increment update )
23
+ m.full_mode = true/false
24
24
  m.dist_server_hosts = ['distribution target server hosts array']
25
- m.meta_incr_key = 'increment key in local meta mdbm'
26
- end
27
-
28
- mds.run_dist
25
+ m.meta_incr_key = 'when_processed_fetched_max_date'
26
+ end.run_dist
29
27
  ```
30
28
  |parameter_name|value|
31
29
  |:-----------|:------------|
32
30
  |cmd_gen|_i64_str_gen_ / _i32_str_gen_ / _i32_i64_gen_ / _i32_i32_gen_ etc|
33
31
  |cmd_rep|_/usr/local/bin/mdbm_replace_|
34
32
 
35
- print.rb
33
+ ### print.rb
36
34
  ```
37
35
  #!/usr/bin/env ruby
38
36
 
39
37
  require 'mdbm_dist_support'
40
38
 
41
39
  puts "hoge\tfuga"
40
+ fetched_max_date = '2017-09-09 11:11:11'
42
41
 
42
+ # print after, update meta increment val.
43
43
  mds = MdbmDistSupport::Distributer.new do |m|
44
44
  m.meta_path = 'local meta mdbm file path'
45
- m.meta_incr_key = 'increment key in local meta mdbm'
46
- end
47
-
48
- mds.run_print_after('increment val in local meta mdbm')
45
+ m.meta_incr_key = 'when_processed_fetched_max_date'
46
+ end.run_print_after(fetched_max_date)
49
47
  ```
50
48
 
51
49
  ## Requires
@@ -16,7 +16,8 @@ module MdbmDistSupport
16
16
  end
17
17
 
18
18
  def run_dist
19
- MdbmDistSupport::Validator::check_run_dist(instance_variables)
19
+ chk = MdbmDistSupport::Validator::valid_run_dist_settings?(instance_variables)
20
+ raise 'validate error' unless chk
20
21
  @lock = MdbmDistSupport::Lock.new(@lock_path)
21
22
  @lock.try_lock
22
23
  local_up
@@ -24,7 +25,8 @@ module MdbmDistSupport
24
25
  end
25
26
 
26
27
  def run_print_after(meta_val)
27
- MdbmDistSupport::Validator::check_run_print_after(instance_variables)
28
+ chk = MdbmDistSupport::Validator::valid_run_print_after_settings?(instance_variables)
29
+ raise 'validate error' unless chk
28
30
  @meta.store(@meta_incr_key, meta_val)
29
31
  end
30
32
 
@@ -10,14 +10,24 @@ module MdbmDistSupport
10
10
  %i[@meta_path @meta_incr_key].freeze
11
11
 
12
12
  class << self
13
- def check_run_dist(settings)
13
+ def valid_run_dist_settings?(settings)
14
+ rc = true
14
15
  df = RUN_DIST_REQUIRE_INSTANCE_VARS - settings
15
- raise %(validate error: #{df} : required ) unless df.length.zero?
16
+ unless df.length.zero?
17
+ STDERR.puts %(#{df} is required )
18
+ rc = false
19
+ end
20
+ rc
16
21
  end
17
22
 
18
- def check_run_print_after(settings)
23
+ def valid_run_print_after_settings?(settings)
24
+ rc = true
19
25
  df = RUN_PRINT_AFTER_REQUIRE_INSTANCE_VARS - settings
20
- raise %(validate error: #{df} : required) unless df.length.zero?
26
+ unless df.length.zero?
27
+ STDERR.puts %(#{df} is required)
28
+ rc = false
29
+ end
30
+ rc
21
31
  end
22
32
  end
23
33
  end
@@ -1,3 +1,3 @@
1
1
  module MdbmDistSupport
2
- VERSION = '0.1.7'
2
+ VERSION = '0.1.8'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mdbm_dist_support
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - MichinaoShimizu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-14 00:00:00.000000000 Z
11
+ date: 2017-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -74,6 +74,7 @@ extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
76
  - ".gitignore"
77
+ - ".rspec_status"
77
78
  - Gemfile
78
79
  - Gemfile.lock
79
80
  - LICENSE