Exemple #1
0
        internal Kademlia(Node node)
        {
            this.node = node;
            for (int i = 0; i < KademliaId.Size; i++)
            {
                buckets[i] = new List<KnownNode>();
            }

            KyruTimer.Register(this, 60);
        }
        internal LocalObjectStorage(Config config, Node node)
        {
            this.config = config;
            this.node = node;

            Directory.CreateDirectory(config.StoreDirectory);

            foreach (var file in Directory.GetFiles(config.StoreDirectory))
            {
                // TODO: verify file names and contents?
                currentObjects[KademliaId.FromHex(Path.GetFileName(file))] = DateTime.Now;
            }

            KyruTimer.Register(this, 60);
        }
Exemple #3
0
        internal void CreateNodes()
        {
            KyruTimer.Reset();

            nodeA = new KyruApplication(12345).Node;
            nodeB = new KyruApplication(12346).Node;
            nodeC = new KyruApplication(12347).Node;

            nodeAInfo = new NodeInformation(new IPEndPoint(IPAddress.Loopback, 12345), nodeA.Id);
            nodeBInfo = new NodeInformation(new IPEndPoint(IPAddress.Loopback, 12346), nodeB.Id);
            nodeCInfo = new NodeInformation(new IPEndPoint(IPAddress.Loopback, 12347), nodeC.Id);

            nodeA.Start();
            nodeB.Start();
            nodeC.Start();

            nodeA.Kademlia.AddNode(nodeBInfo.EndPoint);
            nodeC.Kademlia.AddNode(nodeBInfo.EndPoint);

            KyruTimer.Start();

            Thread.Sleep(TestParameters.LocalhostCommunicationTimeout);
        }
Exemple #4
0
        internal MetadataStorage(Node node)
        {
            this.node = node;

            KyruTimer.Register(this, 3600);
        }
Exemple #5
0
 internal KyruApplication(ushort port)
 {
     Config = new Config();
     Node = new Node(port, this);
     LocalObjectStorage = new LocalObjectStorage(Config, Node);
 }