kfaraz commented on code in PR #13967:
URL: https://github.com/apache/druid/pull/13967#discussion_r1170061855


##########
server/src/main/java/org/apache/druid/client/DataSourcesSnapshot.java:
##########
@@ -123,6 +216,70 @@ public ImmutableSet<DataSegment> getOvershadowedSegments()
     return overshadowedSegments;
   }
 
+  public Map<String, Set<SegmentId>> getHandedOffStatePerDataSource()
+  {
+    return handedOffStatePerDataSource;
+  }
+
+  public CircularBuffer<ChangeRequestHistory.Holder<List<DataSegmentChange>>> 
getChanges()
+  {
+    return changes;
+  }
+
+  public ChangeRequestsSnapshot<DataSegmentChange> 
getChangesSince(ChangeRequestHistory.Counter counter)
+  {
+    if (counter.getCounter() < 0) {
+      return ChangeRequestsSnapshot.fail(StringUtils.format("counter[%s] must 
be >= 0", counter));
+    }
+
+    ChangeRequestHistory.Counter lastCounter = getLastCounter(changes);
+
+    if (counter.getCounter() == lastCounter.getCounter()) {
+      if (counter.matches(lastCounter)) {
+        return ChangeRequestsSnapshot.success(counter, new ArrayList<>());
+      } else {
+        return ChangeRequestsSnapshot.fail(StringUtils.format("counter[%s] 
failed to match with [%s]", counter, lastCounter));

Review Comment:
   This one and the other existing uses of `ChangeRequestsSnapshot.fail` use 
formatted strings. You could consider adding a new `fail` method to 
ChangeRequestsSnapshot that accepts a String format and object arguments.
   
   ```
   public static ChangeRequestsSnapshot fail(String msgFormat, Object... args) {
      return ChangeRequestsSnapshot.fail(msgFormat, args);
   }
   ```



##########
processing/src/main/java/org/apache/druid/timeline/DataSegmentChange.java:
##########
@@ -0,0 +1,94 @@
+/*
+ * 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.druid.timeline;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonValue;
+import org.apache.druid.java.util.common.StringUtils;
+
+public class DataSegmentChange
+{
+  private final SegmentWithOvershadowedStatus segmentWithOvershadowedStatus;
+  private final boolean load;
+  private final ChangeReason changeReason;
+
+  @JsonCreator
+  public DataSegmentChange(
+      @JsonProperty("segmentWithOvershadowedStatus") 
SegmentWithOvershadowedStatus segmentWithOvershadowedStatus,
+      @JsonProperty("load") boolean load,
+      @JsonProperty("changeReason") ChangeReason changeReason
+  )
+  {
+    this.segmentWithOvershadowedStatus = segmentWithOvershadowedStatus;
+    this.load = load;
+    this.changeReason = changeReason;
+  }
+
+  @JsonProperty
+  public SegmentWithOvershadowedStatus getSegmentWithOvershadowedStatus()
+  {
+    return segmentWithOvershadowedStatus;
+  }
+
+  @JsonProperty
+  public boolean isLoad()
+  {
+    return load;
+  }
+
+  @JsonProperty
+  public ChangeReason getChangeReason()
+  {
+    return changeReason;
+  }
+
+  @Override
+  public String toString()
+  {
+    return "DataSegmentChangeRequest{" +
+           "load=" + load +
+           ", changeReason=" + changeReason +
+           ", segmentWithOvershadowedStatus=" + segmentWithOvershadowedStatus +
+           '}';
+  }
+
+  public enum ChangeReason

Review Comment:
   `ChangeType` maybe?



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