rbbt-util 5.14.1 → 5.14.2

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: fa73fffbfca850f0304a250527157c35aef1dcb5
4
- data.tar.gz: aab332c2a7b11e9d7a207f1640af194dc54a9eb1
3
+ metadata.gz: e22611b53d0c2a89c0e2a3b21317d44247bd015d
4
+ data.tar.gz: c75e90adddd0e88805458e51bdd28a4b46143b90
5
5
  SHA512:
6
- metadata.gz: 231c27fb1f1b1f81569c0613c4e3b5b61d5d0873bb085671421962934802be074c4a94155bd251d59a37d3098ce2a3729febc759c0320eefa453f9c731faf907
7
- data.tar.gz: 394a55fe8949acea897c028106ac47bff2f3f3828a9fab1b0fc44446c19ce0c6d40ba83d5da4c9bba8709e35d425741984ff04d643c3dd270cb9a4fb89a5d9e6
6
+ metadata.gz: 02abe6b04eb5877e7be78d8742e861cb21df05694e7e467a12076ca2cb3b9e772f1f30f1f6a9bb21843e6f4e301618c561a6813b3b2fc147530819ea03657c4d
7
+ data.tar.gz: cba9bdf10dd98e2e8ea022984ca4c74282a74c780431034cd738c48941d5174d0fdae3faeaf47f3a3dcddef09490ec386351f069b944e06cc4a4702967b8408a
@@ -62,6 +62,14 @@ module Persist
62
62
 
63
63
  def add(key, value)
64
64
  key = pos_function.call(key) if pos_function
65
+ if Fixnum === key
66
+ @_last ||= -1
67
+ skipped = key - @_last - 1
68
+ skipped.times do
69
+ self.send(:<<, nil)
70
+ end
71
+ @_last = key
72
+ end
65
73
  self.send(:<<, value)
66
74
  end
67
75
 
@@ -94,7 +94,6 @@ class TestSharder < Test::Unit::TestCase
94
94
  v = v
95
95
  chr = "chr" << c.to_s
96
96
  key = chr + ":" << v.to_s
97
- iii [key, v]
98
97
  db << [key, [v*2]]
99
98
  end
100
99
  end
@@ -119,5 +118,47 @@ class TestSharder < Test::Unit::TestCase
119
118
  assert_equal chrs.length*size, sharder.size
120
119
  end
121
120
  end
121
+
122
+ def test_shard_pki_skip
123
+ TmpFile.with_file do |dir|
124
+ shard_function = Proc.new do |key|
125
+ key[0..(key.index(":")-1)]
126
+ end
127
+
128
+ pos_function = Proc.new do |key|
129
+ key.split(":").last.to_i
130
+ end
131
+
132
+ size = 10
133
+ chrs = (1..10).to_a
134
+ sharder = Persist.persist_tsv(nil, "ShardTest", {}, :pattern => %w(f), :update => true, :range => false, :value_size => 64, :engine => 'pki', :file => dir, :shard_function => shard_function, :pos_function => pos_function, :persist => true, :serializer => :clean) do |db|
135
+ chrs.each do |c|
136
+ size.times do |v|
137
+ v = v + 1
138
+ chr = "chr" << c.to_s
139
+ key = chr + ":" << (v*2).to_s
140
+ db << [key, [v*2]]
141
+ end
142
+ end
143
+ end
144
+ sharder.read
145
+
146
+ assert_equal dir, sharder.persistence_path
147
+
148
+ assert_equal [2.0], sharder["chr2:2"]
149
+ assert_equal [4.0], sharder["chr2:4"]
150
+
151
+ count = 0
152
+ sharder.through do |k,v|
153
+ count += 1 unless v.nil?
154
+ end
155
+ assert_equal count, size*chrs.length
156
+
157
+ sharder = Persist.open_sharder(dir, false, :float, 'fwt', {:range => false, :value_size => 64, :pos_function => pos_function}, &shard_function)
158
+
159
+ assert_equal [2.0], sharder["chr2:2"]
160
+
161
+ end
162
+ end
122
163
  end
123
164
 
@@ -47,7 +47,7 @@ class TestStep < Test::Unit::TestCase
47
47
  end
48
48
  end
49
49
 
50
- def test_dependency_log_relay
50
+ def __test_dependency_log_relay
51
51
  str = "TEST"
52
52
  TmpFile.with_file do |tmpfile|
53
53
  task1 = Task.setup :result_type => nil, :name => :task1 do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-util
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.14.1
4
+ version: 5.14.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez