| 
				
				
					
						
					
				
				
				 | 
			
			 | 
			
			@ -9,6 +9,7 @@ module Crystal::Scatter | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			
 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			        class Daemon(Ign,T) | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			            getter range_effector : Nil | Tuple(UInt64,UInt64) | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			            getter reach_at : T | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			
 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			            def initialize(@weight : UInt64 = 1)  | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			                @reach_at = T.new | 
			
		
		
	
	
		
			
				| 
				
				
				
					
						
					
				
				 | 
			
			 | 
			
			@ -32,6 +33,10 @@ module Crystal::Scatter | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			            def set_end | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			                @range_effector=Tuple.new(@range_effector.not_nil!.[0],UInt64::MAX) | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			            end | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			
 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			            def snapshot | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			                yield self | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			            end | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			        end | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			
 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			        class Container(T,U) < Array(T) | 
			
		
		
	
	
		
			
				| 
				
					
						
					
				
				
					
						
					
				
				
				 | 
			
			 | 
			
			@ -63,6 +68,14 @@ module Crystal::Scatter | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			                end | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			                at(elems[0]).add(nweight, elems.skip(1), reach_at) | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			            end | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			             | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			            def snapshot | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			                each do |elem| | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			                    elem.snapshot do |x| | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			                        yield x | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			                    end | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			                end | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			            end | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			        end | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			
 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			        class Server(U) < Container(Daemon(U,U),U) end | 
			
		
		
	
	
		
			
				| 
				
				
				
					
						
					
				
				 | 
			
			 | 
			
			@ -78,7 +91,7 @@ module Crystal::Scatter | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			        class Root(U) < Container(Datacenter(U),U) end | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			    end | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			
 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			    class RingGraph(T) < Servers::Root(">T) | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			    class RingGraph < Servers::Root(b">String) | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			        def generate_ring(split_ratio : BigRational) | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			            set_effectors(UInt64::MAX, BigRational.new(1), get_weight, split_ratio) | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			            set_end | 
			
		
		
	
	
		
			
				| 
				
					
						
					
				
				
				
				 | 
			
			 | 
			
			
 |