private void RemoveHeadFromView(string viewName, int leaseDuration, ReplicatedTableConfigurationServiceV2 configService)
        {
            // Download config using provided instance
            ReplicatedTableConfiguration    config;
            ReplicatedTableQuorumReadResult readStatus = configService.RetrieveConfiguration(out config);

            Assert.IsTrue(readStatus.Code == ReplicatedTableQuorumReadCode.Success);

            // Remove the Head
            ReplicatedTableConfigurationStore viewConfg = config.GetView(viewName);

            viewConfg.ReplicaChain[0].Status = ReplicaStatus.None;
            viewConfg.ViewId++;

            config.LeaseDuration = leaseDuration;

            // Upload config using provided instance
            configService.UpdateConfiguration(config);
        }
Beispiel #2
0
        private void UploadHeadTailView(string viewName, int leaseDuration, ReplicatedTableConfigurationServiceV2 configService)
        {
            // Download config using provided instance
            ReplicatedTableConfiguration    config;
            ReplicatedTableQuorumReadResult readStatus = configService.RetrieveConfiguration(out config);

            Assert.IsTrue(readStatus.Code == ReplicatedTableQuorumReadCode.Success);

            // [Head] -> [Tail]
            ReplicatedTableConfigurationStore viewConfg = config.GetView(viewName);

            Assert.IsTrue(viewConfg.GetCurrentReplicaChain().Count == 2);

            // Force Reads on Head replica
            viewConfg.ReadViewTailIndex = 0;
            viewConfg.ViewId++;

            config.LeaseDuration = leaseDuration;

            // Upload config using provided instance
            configService.UpdateConfiguration(config);
        }