You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "hemantk-12 (via GitHub)" <gi...@apache.org> on 2023/02/21 10:26:09 UTC

[GitHub] [ozone] hemantk-12 commented on a diff in pull request #4264: HDDS-7950. [Snapshot] API changes to support pagination token and async nature of snapshot diff API

hemantk-12 commented on code in PR #4264:
URL: https://github.com/apache/ozone/pull/4264#discussion_r1109189000


##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/snapshot/SnapshotDiffResponse.java:
##########
@@ -0,0 +1,85 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.hadoop.ozone.snapshot;
+
+import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.SnapshotDiffResponse.JobStatusProto;
+
+/**
+ * POJO for Snapshot Diff Response.
+ */
+public class SnapshotDiffResponse {
+
+  /**
+   * Snapshot diff job status enum.
+   */
+  public enum JobStatus {
+    QUEUED,
+    IN_PROGRESS,
+    DONE,
+    REJECTED,
+    FAILED;
+
+    public JobStatusProto toProtobuf() {
+      return JobStatusProto.valueOf(this.name());
+    }
+
+    public static JobStatus fromProtobuf(JobStatusProto jobStatusProto) {
+      return JobStatus.valueOf(jobStatusProto.name());
+    }
+  }
+
+  private final SnapshotDiffReport snapshotDiffReport;
+  private final JobStatus jobStatus;
+  private final long waitTimeInMs;
+
+  public SnapshotDiffResponse(final SnapshotDiffReport snapshotDiffReport,
+                              final JobStatus jobStatus,
+                              final long waitTimeInMs) {
+    this.snapshotDiffReport = snapshotDiffReport;
+    this.jobStatus = jobStatus;
+    this.waitTimeInMs = waitTimeInMs;
+  }
+
+  public SnapshotDiffReport getSnapshotDiffReport() {
+    return snapshotDiffReport;
+  }
+
+  public JobStatus getJobStatus() {
+    return jobStatus;
+  }
+
+  public long getWaitTimeInMs() {
+    return waitTimeInMs;
+  }
+
+  @Override
+  public String toString() {
+    StringBuilder str = new StringBuilder();
+    if (jobStatus == JobStatus.DONE) {
+      str.append(snapshotDiffReport.toString());

Review Comment:
   It will be all the diffs. Once whole report is generated, it will be marked as done and client will fetch the report in paginated fashion. 



##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/snapshot/SnapshotDiffResponse.java:
##########
@@ -0,0 +1,85 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.hadoop.ozone.snapshot;
+
+import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.SnapshotDiffResponse.JobStatusProto;
+
+/**
+ * POJO for Snapshot Diff Response.
+ */
+public class SnapshotDiffResponse {
+
+  /**
+   * Snapshot diff job status enum.
+   */
+  public enum JobStatus {
+    QUEUED,
+    IN_PROGRESS,

Review Comment:
   Should we use sub categories for that?



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org