gelatin 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/gelatin.rb +6 -4
- data/lib/gelatin/ring.rb +1 -1
- data/lib/gelatin/version.rb +2 -1
- data/test/ring.rb +2 -2
- data/test/ring_bench.rb +9 -4
- data/test/test_helper.rb +0 -6
- metadata +2 -3
- data/lib/gelatin/hashable.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ce5cbffcc8ac6cd5b86c28405849522c915b5af
|
4
|
+
data.tar.gz: 3d1c4897851b9ce3d3df8f904215e720e1246fd6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2e1738195fcb627297c77042a94c391f2e02bb7705ca685c3b9690f135a3af0afb574b190d694866a3851384dcca68e543011e4770af9bc939836c29f7cd2d0
|
7
|
+
data.tar.gz: 99ca1d50e6cc77c03c94c6e199231f5e70a956d7665afc2943ed3336949e23171ac4594dcd38ce8b3bff9a8f8463b597fa1a294c287c77b79a5f8511a2b91ef2
|
data/README.md
CHANGED
@@ -58,7 +58,7 @@ sh = Gelatin::Ring.new
|
|
58
58
|
(1...254).each do |i|
|
59
59
|
sh.add Gelatin::Node.new("192.168.0.#{i}")
|
60
60
|
end
|
61
|
-
puts sh.get("
|
61
|
+
puts sh.get(::Zlib::crc32("s3.amazon.com")) # returns the server for this key
|
62
62
|
```
|
63
63
|
|
64
64
|
You might use the same hasher to hash long strings like file paths, but you need to split the string into 64bit chunks.
|
@@ -71,7 +71,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
71
71
|
|
72
72
|
## Contributing
|
73
73
|
|
74
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
74
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/eduardordm/gelatin.
|
75
75
|
|
76
76
|
|
77
77
|
## License
|
data/lib/gelatin.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require "gelatin/ring"
|
1
|
+
require 'gelatin/version'
|
2
|
+
require 'gelatin/node'
|
3
|
+
require 'gelatin/ring'
|
5
4
|
|
5
|
+
require 'zlib'
|
6
|
+
|
7
|
+
# Gelatin: Jump Consistent Hash Rubygem
|
6
8
|
module Gelatin
|
7
9
|
end
|
data/lib/gelatin/ring.rb
CHANGED
data/lib/gelatin/version.rb
CHANGED
data/test/ring.rb
CHANGED
@@ -6,7 +6,7 @@ class RingTest < Minitest::Test
|
|
6
6
|
(1...254).each do |i|
|
7
7
|
sh.add Gelatin::Node.new("192.168.0.#{i}")
|
8
8
|
end
|
9
|
-
refute_nil sh.get(
|
10
|
-
assert valid_v4? sh.get(
|
9
|
+
refute_nil sh.get("s3.amazon.com")
|
10
|
+
assert valid_v4? sh.get("s3.amazon.com").addr
|
11
11
|
end
|
12
12
|
end
|
data/test/ring_bench.rb
CHANGED
@@ -1,15 +1,20 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class BenchRing < Minitest::Benchmark
|
4
|
+
|
5
|
+
def self.bench_range
|
6
|
+
[1,1000,10000,100000,1000000,10000000]
|
7
|
+
end
|
8
|
+
|
4
9
|
def bench_ring_google_numbers
|
5
10
|
ring = Gelatin::Ring.new
|
6
11
|
|
7
|
-
assert_performance_constant 0.
|
8
|
-
ring.add(Gelatin::Node.new("192.168.0.1"))
|
12
|
+
assert_performance_constant 0.99 do |n|
|
13
|
+
(1..n).each { ring.add(Gelatin::Node.new("192.168.0.1")) }
|
9
14
|
end
|
10
15
|
|
11
|
-
assert_performance_constant 0.
|
12
|
-
(1..
|
16
|
+
assert_performance_constant 0.99 do |n|
|
17
|
+
(1..n).each { ring.get("s3.amazon.com") }
|
13
18
|
end
|
14
19
|
end
|
15
20
|
end
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gelatin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eduardo Mourão
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler
|
@@ -101,7 +101,6 @@ files:
|
|
101
101
|
- ext/jch/jch.c
|
102
102
|
- gelatin.gemspec
|
103
103
|
- lib/gelatin.rb
|
104
|
-
- lib/gelatin/hashable.rb
|
105
104
|
- lib/gelatin/node.rb
|
106
105
|
- lib/gelatin/ring.rb
|
107
106
|
- lib/gelatin/version.rb
|