frankgh commented on code in PR #96:
URL: https://github.com/apache/cassandra-sidecar/pull/96#discussion_r1471637401
##########
common/src/main/java/org/apache/cassandra/sidecar/common/data/CreateRestoreJobRequestPayload.java:
##########
@@ -43,6 +44,7 @@ public class CreateRestoreJobRequestPayload
private final RestoreJobSecrets secrets;
private final SSTableImportOptions importOptions;
private final long expireAtInMillis;
+ private final String consistencyLevel; // Nullable / optional field
Review Comment:
we can use annotations if we want to mark them as nullable? no?
##########
src/main/java/org/apache/cassandra/sidecar/config/RestoreJobConfiguration.java:
##########
@@ -48,4 +48,11 @@ public interface RestoreJobConfiguration
* @return time to live for restore job tables: restore_job and
restore_slice
*/
long restoreJobTablesTtlSeconds();
+
+ /**
+ * Controls whether the feature to allow server-side the slice assignment
and verification based on the token range
Review Comment:
I'm not following the description of this javadoc. Can you elaborate what we
are trying to achieve here?
##########
common/src/test/java/org/apache/cassandra/sidecar/common/data/RestoreSliceStatusTest.java:
##########
@@ -0,0 +1,78 @@
+/*
+ * 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.sidecar.common.data;
+
+import java.util.stream.Stream;
+
+import org.junit.jupiter.api.Test;
+
+import static
org.apache.cassandra.sidecar.common.data.RestoreSliceStatus.ABORTED;
+import static
org.apache.cassandra.sidecar.common.data.RestoreSliceStatus.COMMITTING;
+import static
org.apache.cassandra.sidecar.common.data.RestoreSliceStatus.EMPTY;
+import static
org.apache.cassandra.sidecar.common.data.RestoreSliceStatus.FAILED;
+import static
org.apache.cassandra.sidecar.common.data.RestoreSliceStatus.PROCESSING;
+import static
org.apache.cassandra.sidecar.common.data.RestoreSliceStatus.STAGED;
+import static
org.apache.cassandra.sidecar.common.data.RestoreSliceStatus.SUCCEEDED;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+class RestoreSliceStatusTest
+{
+ @Test
+ void testStatusAdvancing()
+ {
+ EMPTY.advanceTo(PROCESSING);
Review Comment:
maybe assert?
```suggestion
assertThat(EMPTY.advanceTo(PROCESSING)).isEqualTo(PROCESSING);
```
##########
common/src/main/java/org/apache/cassandra/sidecar/common/data/RestoreSliceStatus.java:
##########
@@ -18,15 +18,44 @@
package org.apache.cassandra.sidecar.common.data;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.cassandra.sidecar.common.utils.Preconditions;
+
/**
* Holds all possible restore slice statues
*/
public enum RestoreSliceStatus
{
- EMPTY,
- PROCESSING,
- COMMITTING,
SUCCEEDED,
FAILED,
- ABORTED
+ ABORTED,
+ COMMITTING(SUCCEEDED, FAILED, ABORTED),
+ STAGED(COMMITTING, FAILED, ABORTED),
+ PROCESSING(STAGED, FAILED, ABORTED),
+ EMPTY(PROCESSING, FAILED, ABORTED);
+
+ // Do not use EnumSet, since validTargetStatuses is assigned on
constructing and enums are not available yet.
+ private final Set<RestoreSliceStatus> validTargetStatuses;
Review Comment:
NIT
```suggestion
private final Set<RestoreSliceStatus> validTargetStatusSet;
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]