Ejemplo n.º 1
0
        public void CanReplicateSegmentWithDataWhileStillServingRequestForSegment()
        {
            using (var storageProxy = new DistributedHashTableStorageClient(storageHost.Endpoint))
            {
                var topology = new DistributedHashTableMasterClient(masterUri).GetTopology();
                storageProxy.Put(topology.Version, new ExtendedPutRequest
                {
                    Bytes   = new byte[] { 1, 2, 3 },
                    Key     = "test",
                    Segment = 1,
                });

                var result = storageProxy.ReplicateNextPage(NodeEndpoint.ForTest(13), ReplicationType.Ownership, 1);
                Assert.Equal("test", result.PutRequests[0].Key);

                storageProxy.Put(topology.Version, new ExtendedPutRequest
                {
                    Bytes   = new byte[] { 1, 2, 3 },
                    Key     = "test2",
                    Segment = 1,
                });

                result = storageProxy.ReplicateNextPage(NodeEndpoint.ForTest(13), ReplicationType.Ownership, 1);
                Assert.Equal("test2", result.PutRequests[0].Key);
            }
        }
Ejemplo n.º 2
0
        public void WhenFinishedReplicatingWillTellTheReplicatorSo()
        {
            using (var storageProxy = new DistributedHashTableStorageClient(storageHost.Endpoint))
            {
                var topology = new DistributedHashTableMasterClient(masterUri).GetTopology();
                storageProxy.Put(topology.Version, new ExtendedPutRequest
                {
                    Bytes   = new byte[] { 1, 2, 3 },
                    Key     = "test",
                    Segment = 1,
                });

                var result = storageProxy.ReplicateNextPage(NodeEndpoint.ForTest(13), ReplicationType.Ownership, 1);
                Assert.Equal("test", result.PutRequests[0].Key);

                result = storageProxy.ReplicateNextPage(NodeEndpoint.ForTest(13), ReplicationType.Ownership, 1);
                Assert.True(result.Done);
            }
        }