Beispiel #1
0
    public void RefreshNode(Node node)
    {
        CheckInitialization();

        int        distanceFromMaster = _nodeDistanceCalculator.CalculateDistance(MasterNode !.IdHash.Bytes, node.IdHash.Bytes);
        NodeBucket bucket             = Buckets[distanceFromMaster > 0 ? distanceFromMaster - 1 : 0];

        bucket.RefreshNode(node);
    }
Beispiel #2
0
        public void Can_refresh(int nodesInTheBucket)
        {
            NodeBucket nodeBucket = new NodeBucket(1, 16);

            AddNodes(nodeBucket, nodesInTheBucket);

            Node existing1 = nodeBucket.BondedItems.First().Node;

            nodeBucket.RefreshNode(existing1);

            nodeBucket.BondedItems.Should().HaveCount(Math.Min(nodeBucket.BucketSize, nodesInTheBucket));
        }