roma-storage 0.1.0 → 0.1.1
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 +4 -4
- data/README.md +6 -2
- data/Rakefile +7 -3
- data/lib/roma/storage/basic_storage.rb +13 -13
- data/lib/roma/storage/ruby_hash_storage.rb +1 -1
- data/lib/roma/storage/version.rb +1 -1
- data/roma-storage.gemspec +12 -17
- metadata +25 -33
- data/.gitignore +0 -12
- data/.rspec +0 -3
- data/.travis.yml +0 -5
- data/bin/console +0 -14
- data/bin/setup +0 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: be339014d3d6302df9c114eafa0af8133d36630c91b0874235a1eac6765852ed
|
|
4
|
+
data.tar.gz: b48b3c583ec0753f520a68ba9a6f4c59b820407165780da794384ad8fce742c3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1578b1b4984728252fde8eef667effce9628974d435e87099a79e677afd510c6ed503c81f64ed231191c872a193500d2f1c32acacef71735b57ed222ebd74180
|
|
7
|
+
data.tar.gz: f38620ebcad74bef70808c81864749018b63704c4cd5ecfaba3a1b5b32dcfdbebf38ad31213de6e21430a3b170b578584b6508a4330b983324d4c0f56b5a59e6
|
data/README.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Roma::Storage
|
|
2
2
|
|
|
3
|
+
[](https://travis-ci.org/roma/roma-storage)
|
|
4
|
+
[](https://codeclimate.com/github/roma/roma-storage/maintainability)
|
|
5
|
+
[](https://codeclimate.com/github/roma/roma-storage/test_coverage)
|
|
6
|
+
|
|
3
7
|
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/roma/storage`. To experiment with that code, run `bin/console` for an interactive prompt.
|
|
4
8
|
|
|
5
9
|
TODO: Delete this and the text above, and describe your gem
|
|
@@ -32,7 +36,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
|
32
36
|
|
|
33
37
|
## Contributing
|
|
34
38
|
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
|
39
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/roma/roma-storage. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
36
40
|
|
|
37
41
|
## License
|
|
38
42
|
|
|
@@ -40,4 +44,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
|
40
44
|
|
|
41
45
|
## Code of Conduct
|
|
42
46
|
|
|
43
|
-
Everyone interacting in the Roma::Storage project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
|
47
|
+
Everyone interacting in the Roma::Storage project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/roma/roma-storage/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
require "bundler/gem_tasks"
|
|
2
|
-
require
|
|
2
|
+
require 'rake/testtask'
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
Rake::TestTask.new do |t|
|
|
5
|
+
t.libs << 'test'
|
|
6
|
+
t.test_files = FileList['test/**/test_*.rb']
|
|
7
|
+
t.verbose = true
|
|
8
|
+
end
|
|
5
9
|
|
|
6
|
-
task :default => :
|
|
10
|
+
task :default => :test
|
|
@@ -156,8 +156,8 @@ module Roma
|
|
|
156
156
|
|
|
157
157
|
if @dbs[n] == :cachecleaning && d
|
|
158
158
|
# in case of existing value is both @hdb and @hdbc
|
|
159
|
-
vn,
|
|
160
|
-
|
|
159
|
+
vn, _lat, clk, _expt = unpack_header(d)
|
|
160
|
+
_cvn, _clat, cclk, _cexpt = unpack_header(c)
|
|
161
161
|
return d if cmp_clk(clk, cclk) > 0 # if @hdb newer than @hdbc
|
|
162
162
|
end
|
|
163
163
|
c
|
|
@@ -226,7 +226,7 @@ module Roma
|
|
|
226
226
|
buf = db_get(vn, k)
|
|
227
227
|
clk = 0
|
|
228
228
|
if buf
|
|
229
|
-
vn,
|
|
229
|
+
vn, _t, clk, expt2, _v2 = unpack_data(buf)
|
|
230
230
|
return nil if Time.now.to_i <= expt2
|
|
231
231
|
clk = (clk + 1) & 0xffffffff
|
|
232
232
|
end
|
|
@@ -242,7 +242,7 @@ module Roma
|
|
|
242
242
|
return nil unless buf
|
|
243
243
|
|
|
244
244
|
# buf != nil
|
|
245
|
-
vn,
|
|
245
|
+
vn, _t, clk, expt2, _v2 = unpack_data(buf)
|
|
246
246
|
return nil if Time.now.to_i > expt2
|
|
247
247
|
clk = (clk + 1) & 0xffffffff
|
|
248
248
|
|
|
@@ -256,7 +256,7 @@ module Roma
|
|
|
256
256
|
return nil unless buf
|
|
257
257
|
|
|
258
258
|
# buf != nil
|
|
259
|
-
vn,
|
|
259
|
+
vn, _t, clk, expt2, v2 = unpack_data(buf)
|
|
260
260
|
return nil if Time.now.to_i > expt2
|
|
261
261
|
clk = (clk + 1) & 0xffffffff
|
|
262
262
|
|
|
@@ -270,7 +270,7 @@ module Roma
|
|
|
270
270
|
return nil unless buf
|
|
271
271
|
|
|
272
272
|
# buf != nil
|
|
273
|
-
vn,
|
|
273
|
+
vn, _t, clk, expt2, v2 = unpack_data(buf)
|
|
274
274
|
return nil if Time.now.to_i > expt2
|
|
275
275
|
clk = (clk + 1) & 0xffffffff
|
|
276
276
|
|
|
@@ -282,7 +282,7 @@ module Roma
|
|
|
282
282
|
def get(vn, k, d)
|
|
283
283
|
buf = db_get(vn, k)
|
|
284
284
|
return nil unless buf
|
|
285
|
-
vn,
|
|
285
|
+
vn, _t, _clk, expt, v = unpack_data(buf)
|
|
286
286
|
|
|
287
287
|
return nil if Time.now.to_i > expt
|
|
288
288
|
v
|
|
@@ -331,7 +331,7 @@ module Roma
|
|
|
331
331
|
v = ret = nil
|
|
332
332
|
clk = 0
|
|
333
333
|
if buf
|
|
334
|
-
vn,
|
|
334
|
+
vn, _t, clk, expt, v2 = unpack_data(buf)
|
|
335
335
|
return :deletemark if expt == 0
|
|
336
336
|
clk = (clk + 1) & 0xffffffff
|
|
337
337
|
v = v2 if v2 && v2.length != 0 && Time.now.to_i <= expt
|
|
@@ -358,7 +358,7 @@ module Roma
|
|
|
358
358
|
return nil unless buf
|
|
359
359
|
|
|
360
360
|
# buf != nil
|
|
361
|
-
vn,
|
|
361
|
+
vn, _t, clk, expt2, v2 = unpack_data(buf)
|
|
362
362
|
return nil if Time.now.to_i > expt2
|
|
363
363
|
clk = (clk + 1) & 0xffffffff
|
|
364
364
|
|
|
@@ -376,7 +376,7 @@ module Roma
|
|
|
376
376
|
return nil unless buf
|
|
377
377
|
|
|
378
378
|
# buf != nil
|
|
379
|
-
vn,
|
|
379
|
+
vn, _t, clk, expt2, v2 = unpack_data(buf)
|
|
380
380
|
return nil if Time.now.to_i > expt2
|
|
381
381
|
clk = (clk + 1) & 0xffffffff
|
|
382
382
|
|
|
@@ -393,7 +393,7 @@ module Roma
|
|
|
393
393
|
def set_expt(vn, k, d, expt)
|
|
394
394
|
buf = db_get(vn, k)
|
|
395
395
|
if buf
|
|
396
|
-
vn,
|
|
396
|
+
vn, _t, clk, expt2, v = unpack_data(buf)
|
|
397
397
|
return nil if Time.now.to_i > expt2
|
|
398
398
|
clk = (clk + 1) & 0xffffffff
|
|
399
399
|
ret = [vn, Time.now.to_i, clk, expt, v]
|
|
@@ -467,7 +467,7 @@ module Roma
|
|
|
467
467
|
h = Marshal.load(dmp)
|
|
468
468
|
h.each_pair{ |k, v|
|
|
469
469
|
# remort data
|
|
470
|
-
r_vn, r_last, r_clk,
|
|
470
|
+
r_vn, r_last, r_clk, _r_expt = unpack_header(v)
|
|
471
471
|
raise "An invalid vnode number is include.key=#{k} vn=#{r_vn}" unless @hdiv.key?(r_vn)
|
|
472
472
|
local = @hdb[@hdiv[r_vn]].get(k)
|
|
473
473
|
if local == nil
|
|
@@ -475,7 +475,7 @@ module Roma
|
|
|
475
475
|
@hdb[@hdiv[r_vn]].put(k, v)
|
|
476
476
|
else
|
|
477
477
|
# local data
|
|
478
|
-
|
|
478
|
+
_l_vn, l_last, l_clk, _l_expt = unpack_data(local)
|
|
479
479
|
if r_last - l_last < @logic_clock_expire && cmp_clk(r_clk,l_clk) <= 0
|
|
480
480
|
else # remort is newer.
|
|
481
481
|
n += 1
|
|
@@ -31,7 +31,7 @@ module Roma
|
|
|
31
31
|
keys.each{ |k|
|
|
32
32
|
v = hdb[k]
|
|
33
33
|
return unless @do_clean_up
|
|
34
|
-
vn, last,
|
|
34
|
+
vn, last, _clk, expt = unpack_header(v)
|
|
35
35
|
vn_stat = vnhash[vn]
|
|
36
36
|
if vn_stat == :primary && ( (expt != 0 && nt > expt) || (expt == 0 && t > last) )
|
|
37
37
|
yield k, vn
|
data/lib/roma/storage/version.rb
CHANGED
data/roma-storage.gemspec
CHANGED
|
@@ -7,30 +7,25 @@ Gem::Specification.new do |spec|
|
|
|
7
7
|
spec.name = "roma-storage"
|
|
8
8
|
spec.version = Roma::Storage::VERSION
|
|
9
9
|
spec.authors = ["Tatsuya Sato"]
|
|
10
|
-
spec.email = ["
|
|
10
|
+
spec.email = ["satoryu.1981@gmail.com"]
|
|
11
11
|
|
|
12
|
-
spec.summary = %q{
|
|
13
|
-
spec.description = %q{
|
|
14
|
-
spec.homepage = "https://roma-
|
|
15
|
-
spec.license = "GPL-3.0"
|
|
12
|
+
spec.summary = %q{The storages of ROMA.}
|
|
13
|
+
spec.description = %q{The base class of the storages of ROMA, and the storage on a Ruby Hash.}
|
|
14
|
+
spec.homepage = "https://github.com/roma/roma-storage"
|
|
15
|
+
spec.license = "GPL-3.0-only"
|
|
16
|
+
spec.required_ruby_version = '>= 3.4'
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if spec.respond_to?(:metadata)
|
|
20
|
-
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
|
21
|
-
else
|
|
22
|
-
raise "RubyGems 2.0 or newer is required to protect against " \
|
|
23
|
-
"public gem pushes."
|
|
24
|
-
end
|
|
18
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
|
19
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
|
25
20
|
|
|
26
21
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
27
|
-
f.match(%r{^(test|spec|features)
|
|
22
|
+
f.match(%r{^(test|spec|features|bin)/|^\.})
|
|
28
23
|
end
|
|
29
24
|
spec.bindir = "exe"
|
|
30
25
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
31
26
|
spec.require_paths = ["lib"]
|
|
32
27
|
|
|
33
|
-
spec.add_development_dependency "
|
|
34
|
-
spec.add_development_dependency "
|
|
35
|
-
spec.add_development_dependency "
|
|
28
|
+
spec.add_development_dependency "rake"
|
|
29
|
+
spec.add_development_dependency "simplecov"
|
|
30
|
+
spec.add_development_dependency "test-unit"
|
|
36
31
|
end
|
metadata
CHANGED
|
@@ -1,86 +1,80 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: roma-storage
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tatsuya Sato
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
name:
|
|
13
|
+
name: rake
|
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
|
16
15
|
requirements:
|
|
17
|
-
- - "
|
|
16
|
+
- - ">="
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
18
|
+
version: '0'
|
|
20
19
|
type: :development
|
|
21
20
|
prerelease: false
|
|
22
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
22
|
requirements:
|
|
24
|
-
- - "
|
|
23
|
+
- - ">="
|
|
25
24
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '
|
|
25
|
+
version: '0'
|
|
27
26
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
27
|
+
name: simplecov
|
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
|
30
29
|
requirements:
|
|
31
|
-
- - "
|
|
30
|
+
- - ">="
|
|
32
31
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '
|
|
32
|
+
version: '0'
|
|
34
33
|
type: :development
|
|
35
34
|
prerelease: false
|
|
36
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
36
|
requirements:
|
|
38
|
-
- - "
|
|
37
|
+
- - ">="
|
|
39
38
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '
|
|
39
|
+
version: '0'
|
|
41
40
|
- !ruby/object:Gem::Dependency
|
|
42
|
-
name:
|
|
41
|
+
name: test-unit
|
|
43
42
|
requirement: !ruby/object:Gem::Requirement
|
|
44
43
|
requirements:
|
|
45
|
-
- - "
|
|
44
|
+
- - ">="
|
|
46
45
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '
|
|
46
|
+
version: '0'
|
|
48
47
|
type: :development
|
|
49
48
|
prerelease: false
|
|
50
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
50
|
requirements:
|
|
52
|
-
- - "
|
|
51
|
+
- - ">="
|
|
53
52
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '
|
|
55
|
-
description:
|
|
53
|
+
version: '0'
|
|
54
|
+
description: The base class of the storages of ROMA, and the storage on a Ruby Hash.
|
|
56
55
|
email:
|
|
57
|
-
-
|
|
56
|
+
- satoryu.1981@gmail.com
|
|
58
57
|
executables: []
|
|
59
58
|
extensions: []
|
|
60
59
|
extra_rdoc_files: []
|
|
61
60
|
files:
|
|
62
|
-
- ".gitignore"
|
|
63
|
-
- ".rspec"
|
|
64
|
-
- ".travis.yml"
|
|
65
61
|
- CODE_OF_CONDUCT.md
|
|
66
62
|
- Gemfile
|
|
67
63
|
- LICENSE.txt
|
|
68
64
|
- README.md
|
|
69
65
|
- Rakefile
|
|
70
|
-
- bin/console
|
|
71
|
-
- bin/setup
|
|
72
66
|
- lib/roma/storage.rb
|
|
73
67
|
- lib/roma/storage/basic_storage.rb
|
|
74
68
|
- lib/roma/storage/dummy_storage.rb
|
|
75
69
|
- lib/roma/storage/ruby_hash_storage.rb
|
|
76
70
|
- lib/roma/storage/version.rb
|
|
77
71
|
- roma-storage.gemspec
|
|
78
|
-
homepage: https://roma-
|
|
72
|
+
homepage: https://github.com/roma/roma-storage
|
|
79
73
|
licenses:
|
|
80
|
-
- GPL-3.0
|
|
74
|
+
- GPL-3.0-only
|
|
81
75
|
metadata:
|
|
82
76
|
allowed_push_host: https://rubygems.org
|
|
83
|
-
|
|
77
|
+
source_code_uri: https://github.com/roma/roma-storage
|
|
84
78
|
rdoc_options: []
|
|
85
79
|
require_paths:
|
|
86
80
|
- lib
|
|
@@ -88,16 +82,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
88
82
|
requirements:
|
|
89
83
|
- - ">="
|
|
90
84
|
- !ruby/object:Gem::Version
|
|
91
|
-
version: '
|
|
85
|
+
version: '3.4'
|
|
92
86
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
87
|
requirements:
|
|
94
88
|
- - ">="
|
|
95
89
|
- !ruby/object:Gem::Version
|
|
96
90
|
version: '0'
|
|
97
91
|
requirements: []
|
|
98
|
-
|
|
99
|
-
rubygems_version: 2.7.6
|
|
100
|
-
signing_key:
|
|
92
|
+
rubygems_version: 4.0.10
|
|
101
93
|
specification_version: 4
|
|
102
|
-
summary:
|
|
94
|
+
summary: The storages of ROMA.
|
|
103
95
|
test_files: []
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.travis.yml
DELETED
data/bin/console
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
require "bundler/setup"
|
|
4
|
-
require "roma/storage"
|
|
5
|
-
|
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
-
|
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
-
# require "pry"
|
|
11
|
-
# Pry.start
|
|
12
|
-
|
|
13
|
-
require "irb"
|
|
14
|
-
IRB.start(__FILE__)
|