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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e22611b53d0c2a89c0e2a3b21317d44247bd015d
|
4
|
+
data.tar.gz: c75e90adddd0e88805458e51bdd28a4b46143b90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
|