public DistributedHashTableStorageHost(
            Uri master,
            string name,
            int port)
        {
            Endpoint = new NodeEndpoint
            {
                Sync = new Uri("rhino.dht://" + Environment.MachineName + ":" + port + "/"),
                Async = new Uri("rhino.queues://" + Environment.MachineName + ":" + (port + 1) + "/replication")
            };
            queueManager = new QueueManager(new IPEndPoint(IPAddress.Any, port + 1), name + ".queue.esent");
            queueManager.CreateQueues("replication");
            node = new DistributedHashTableNode(
                new DistributedHashTableMasterClient(master),
                new ThreadPoolExecuter(),
                new BinaryMessageSerializer(),
                Endpoint,
                queueManager,
                new NonPooledDistributedHashTableNodeFactory()
                );
            var dhtStorage = new DistributedHashTableStorage(name + ".data.esent", node);
            replication = dhtStorage.Replication;
            storage = dhtStorage;

            listener = new TcpListener(
                Socket.OSSupportsIPv6 ? IPAddress.IPv6Any : IPAddress.Any,
                port);
        }
            public ReadingValues()
            {
                node = MockRepository.GenerateStub<IDistributedHashTableNode>();
                topologyVersion = 1;
                node.Stub(x => x.GetTopologyVersion()).Return(topologyVersion);
                distributedHashTableStorage = new DistributedHashTableStorage("test.esent",
                                                                              node);

                distributedHashTableStorage.Put(topologyVersion, new ExtendedPutRequest
                {
                    Key = "test",
                    Bytes = new byte[]{1,2,4},
                    Segment = 0,
                });
            }
 public WhenThereAreKeysInTable()
 {
     node = MockRepository.GenerateStub<IDistributedHashTableNode>();
     topologyVersion = 9;
     node.Stub(x => x.GetTopologyVersion()).Return(topologyVersion);
     distributedHashTableStorage = new DistributedHashTableStorage("test.esent",
                                                                   node);
     replication = distributedHashTableStorage.Replication;
     putResult = distributedHashTableStorage.Put(topologyVersion, new ExtendedPutRequest
     {
         Tag = 0,
         Bytes = new byte[] {1},
         Key = "test",
         Segment = 0
     })[0];
 }
 public WritingValues()
 {
     node = MockRepository.GenerateStub<IDistributedHashTableNode>();
     topologyVersion = 2;
     node.Stub(x => x.GetTopologyVersion()).Return(topologyVersion);
     distributedHashTableStorage = new DistributedHashTableStorage("test.esent",
                                                                   node);
 }
 public WhenThereAreNoKeysInTable()
 {
     node = MockRepository.GenerateStub<IDistributedHashTableNode>();
     topologyVersion = 7;
     node.Stub(x => x.GetTopologyVersion()).Return(topologyVersion);
     distributedHashTableStorage = new DistributedHashTableStorage("test.esent",
                                                                   node);
     replication = distributedHashTableStorage.Replication;
 }