Browse Source

Made MetaRing more modular

master
Archivist 6 years ago
parent
commit
9c4ca91937
1 changed files with 6 additions and 6 deletions
  1. +6
    -6
      src/crystal-scatter/metaring.cr

+ 6
- 6
src/crystal-scatter/metaring.cr View File

@ -44,8 +44,11 @@ module Crystal::Scatter
return tag return tag
end end
private def get_slice_from_hash(h : UInt64)
private def get_slice_from_hash(ring : Ring, h : UInt64)
value = ring.find do |slice|
h>=slice.s_begin && slice.s_end>=h
end
return value.not_nil!
end end
def add(element : Daemon) def add(element : Daemon)
@ -84,10 +87,7 @@ module Crystal::Scatter
end end
slices = Array(Slice).new slices = Array(Slice).new
targets.each do |h| targets.each do |h|
value = ring.find do |slice|
h>=slice.s_begin && slice.s_end>=h
end
slices << value.not_nil!
slices << get_slice_from_hash(ring, h)
end end
return slices return slices
end end

Loading…
Cancel
Save