Github user ifesdjeen commented on a diff in the pull request:
https://github.com/apache/cassandra/pull/224#discussion_r197131214
--- Diff: src/java/org/apache/cassandra/locator/ReplicationFactor.java ---
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.cassandra.locator;
+
+import java.util.Objects;
+
+import com.google.common.base.Preconditions;
+
+import org.apache.cassandra.config.DatabaseDescriptor;
+
+public class ReplicationFactor
+{
+ public static final ReplicationFactor ZERO = new ReplicationFactor(0);
+
+ public final int trans;
+ public final int replicas;
+ public transient final int full;
+
+ private ReplicationFactor(int replicas, int trans)
+ {
+ validate(replicas, trans);
+ this.replicas = replicas;
+ this.trans = trans;
+ this.full = replicas - trans;
+ }
+
+ private ReplicationFactor(int replicas)
+ {
+ this(replicas, 0);
+ }
+
+ static void validate(int replicas, int trans)
+ {
+ Preconditions.checkArgument(trans == 0 ||
DatabaseDescriptor.isTransientReplicationEnabled(),
+ "Transient replication is not enabled
on this node");
+ Preconditions.checkArgument(replicas >= 0,
--- End diff --
To my understanding, replication factor has to be strictly positive (e.g.
min of 1).
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]