Marcosrico commented on code in PR #2336:
URL: https://github.com/apache/helix/pull/2336#discussion_r1065129496


##########
meta-client/src/main/java/org/apache/helix/metaclient/api/OpResult.java:
##########
@@ -19,8 +19,131 @@
  * under the License.
  */
 
+import java.util.Arrays;
+import java.util.List;
 /**
  * Represent the result of a single operation of a multi operation transaction.
  */
 public class OpResult {
-}
+  private int type;
+
+  private OpResult(int type) {
+      this.type = type;
+  }
+
+  public int getType() {
+      return this.type;
+  }
+
+  public static class ErrorResult extends OpResult {
+    private int err;
+
+    public ErrorResult(int err) {
+      super(-1);
+      this.err = err;
+    }
+
+    public int getErr() {
+        return this.err;
+    }
+  }
+
+  public static class GetDataResult extends OpResult {
+    private byte[] data;
+    private MetaClientInterface.Stat stat;
+
+    public GetDataResult(byte[] data, MetaClientInterface.Stat stat) {
+      super(4);
+      this.data = data == null ? null : Arrays.copyOf(data, data.length);
+      this.stat = stat;
+    }
+
+    public byte[] getData() {
+      return this.data == null ? null : Arrays.copyOf(this.data, 
this.data.length);
+    }
+
+    public MetaClientInterface.Stat getStat() {
+      return this.stat;
+    }
+  }
+
+  public static class GetChildrenResult extends OpResult {
+    private List<String> children;
+
+    public GetChildrenResult(List<String> children) {
+      super(8);
+      this.children = children;
+    }
+
+    public List<String> getChildren() {
+        return this.children;
+    }
+  }
+
+  public static class CheckResult extends OpResult {
+    public CheckResult() {
+      super(13);
+    }
+
+    public boolean equals(Object o) {
+      if (this == o) {
+        return true;
+      } else if (!(o instanceof CheckResult)) {
+        return false;
+      } else {
+        CheckResult other = (CheckResult)o;
+        return this.getType() == other.getType();
+      }
+    }
+
+    public int hashCode() {
+      return this.getType();
+    }

Review Comment:
   See above comment



-- 
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]

Reply via email to