Ver a proveniência

Added an history feature

master
Archivist há 6 anos
ascendente
cometimento
a1a3bd430b
4 ficheiros alterados com 29 adições e 4 eliminações
  1. +2
    -2
      README.md
  2. +1
    -1
      shard.yml
  3. +25
    -0
      src/crystal-scatter/metaring.cr
  4. +1
    -1
      src/crystal-scatter/version.cr

+ 2
- 2
README.md Ver ficheiro

@ -1,6 +1,6 @@
# crystal-scatter
Release candidate for v0.1 "John Scott"
## Installation
@ -10,7 +10,7 @@ Add this to your application's `shard.yml`:
dependencies:
crystal-scatter:
git: https://git.nekoit.xyz/Archivist/crystal-scatter
version: ~> 0.1.0-rc1
version: ~> 0.1.0-rc2
```
## Usage

+ 1
- 1
shard.yml Ver ficheiro

@ -1,5 +1,5 @@
name: crystal-scatter
version: 0.1.0-rc1
version: 0.1.0-rc2
authors:
- Ludovic 'Archivist' Lagouardette <lagouardette.ludovic@gmail.com>

+ 25
- 0
src/crystal-scatter/metaring.cr Ver ficheiro

@ -91,6 +91,31 @@ module Crystal::Scatter
end
return slices
end
def get_slices_for(data : String, n_last = 1 : Int32)
n_rings = Array(Ring).new
@lock.synchronize do
t = @rings.size-n_last
n_rings = @rings.skip( t > 0 ? t : 1 )
end
h = hash_impl data
space=UInt64::MAX/@shards
targets = Array(UInt64).new
(1..@shards).each do
targets << h
h+=space
end
ret = Array(Array(Slice)).new
n_rings.each do |ring|
slices = Array(Slice).new
targets.each do |h|
slices << get_slice_from_hash(ring, h)
end
ret << slices
end
return ret
end
end
end

+ 1
- 1
src/crystal-scatter/version.cr Ver ficheiro

@ -1,3 +1,3 @@
module Crystal::Scatter
VERSION = "0.1.0-rc1"
VERSION = "0.1.0-rc2"
end

Carregando…
Cancelar
Guardar