Пример #1
0
        public void CanReplicateEmptySegments()
        {
            using (var storageProxy = new DistributedHashTableStorageClient(storageHost.Endpoint))
            {
                var segments = new[] { 1, 2, 3 };

                var assignedSegments = storageProxy.AssignAllEmptySegments(NodeEndpoint.ForTest(13), ReplicationType.Ownership, segments);

                Assert.Equal(segments, assignedSegments);
            }
        }
Пример #2
0
        public void WhenReplicatingEmptySegmentsWillNotReplicateSegmentsThatHasValues()
        {
            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 segments = new[] { 1, 2, 3 };

                var assignedSegments = storageProxy.AssignAllEmptySegments(NodeEndpoint.ForTest(13), ReplicationType.Ownership, segments);

                Assert.Equal(new[] { 2, 3 }, assignedSegments);
            }
        }