public JoinChildDtoResponse(DHT dht, List<ValueDtoResponse> data) { RangeMin = dht.HashRange.Min.ToString(); RangeMax = dht.HashRange.Max.ToString(); Child = dht.Child; Data = data; }
public void mergeRange(DHT dht) { var hashList = new List<BigInteger>{ HashRange.Max, HashRange.Min, dht.HashRange.Max, dht.HashRange.Min }; hashList.Sort (); HashRange.Min = hashList[0]; HashRange.Max = hashList[3]; Child = dht.Child; //if this is last server if (Child == MyPublicUrl) { Parent = Child = ""; } }
public DHT splitRange(string newChild) { var newMax = HashRange.Min + ((HashRange.Max - HashRange.Min) / 2); var result = new DHT { Child = Child, HashRange = { Min = newMax, Max = HashRange.Max } }; Child = newChild; HashRange.Max = newMax; //if parent is empty then set child as child and parent (to make cycle) if (string.IsNullOrEmpty (Parent)) { Parent = newChild; } return result; }
public void mergeRange(DHT dht) { var hashList = new List <BigInteger> { HashRange.Max, HashRange.Min, dht.HashRange.Max, dht.HashRange.Min }; hashList.Sort(); HashRange.Min = hashList[0]; HashRange.Max = hashList[3]; Child = dht.Child; //if this is last server if (Child == MyPublicUrl) { Parent = Child = ""; } }
public DHT splitRange(string newChild) { var newMax = HashRange.Min + ((HashRange.Max - HashRange.Min) / 2); var result = new DHT { Child = Child, HashRange = { Min = newMax, Max = HashRange.Max } }; Child = newChild; HashRange.Max = newMax; //if parent is empty then set child as child and parent (to make cycle) if (string.IsNullOrEmpty(Parent)) { Parent = newChild; } return(result); }