github-advanced-security[bot] commented on code in PR #18750:
URL: https://github.com/apache/druid/pull/18750#discussion_r2538723924
##########
indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/SeekableStreamSupervisor.java:
##########
@@ -177,6 +178,50 @@
// Internal data structures
// --------------------------------------------------------
+ protected static class OffsetSnapshot<PartitionIdType, SequenceOffsetType>
+ {
+ private final Map<PartitionIdType, SequenceOffsetType> currentOffsets;
+ private final Map<PartitionIdType, SequenceOffsetType> endOffsets;
+
+ public OffsetSnapshot(
+ @Nullable Map<PartitionIdType, SequenceOffsetType> currentOffsets,
+ @Nullable Map<PartitionIdType, SequenceOffsetType> endOffsets
+ )
+ {
+ this.currentOffsets = toImmutableOffsetMap(currentOffsets);
+ this.endOffsets = toImmutableOffsetMap(endOffsets);
+ }
+
+ private Map<PartitionIdType, SequenceOffsetType> toImmutableOffsetMap(
+ @Nullable Map<PartitionIdType, SequenceOffsetType> input
+ )
+ {
+ if (input == null || input.isEmpty()) {
+ return Collections.emptyMap();
+ }
+
+ return input.entrySet().stream()
+ .filter(e -> e.getValue() != null)
+ .collect(ImmutableMap.toImmutableMap(
+ Map.Entry::getKey,
+ Map.Entry::getValue
+ ));
+ }
+
+ public Map<PartitionIdType, SequenceOffsetType> getCurrentOffsets()
+ {
+ return currentOffsets;
+ }
+
+ public Map<PartitionIdType, SequenceOffsetType> getEndOffsets()
Review Comment:
## Exposing internal representation
getEndOffsets exposes the internal representation stored in field
endOffsets. The value may be modified [after this call to getEndOffsets](1).
[Show more
details](https://github.com/apache/druid/security/code-scanning/10557)
##########
indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/SeekableStreamSupervisor.java:
##########
@@ -177,6 +178,50 @@
// Internal data structures
// --------------------------------------------------------
+ protected static class OffsetSnapshot<PartitionIdType, SequenceOffsetType>
+ {
+ private final Map<PartitionIdType, SequenceOffsetType> currentOffsets;
+ private final Map<PartitionIdType, SequenceOffsetType> endOffsets;
+
+ public OffsetSnapshot(
+ @Nullable Map<PartitionIdType, SequenceOffsetType> currentOffsets,
+ @Nullable Map<PartitionIdType, SequenceOffsetType> endOffsets
+ )
+ {
+ this.currentOffsets = toImmutableOffsetMap(currentOffsets);
+ this.endOffsets = toImmutableOffsetMap(endOffsets);
+ }
+
+ private Map<PartitionIdType, SequenceOffsetType> toImmutableOffsetMap(
+ @Nullable Map<PartitionIdType, SequenceOffsetType> input
+ )
+ {
+ if (input == null || input.isEmpty()) {
+ return Collections.emptyMap();
+ }
+
+ return input.entrySet().stream()
+ .filter(e -> e.getValue() != null)
+ .collect(ImmutableMap.toImmutableMap(
+ Map.Entry::getKey,
+ Map.Entry::getValue
+ ));
+ }
+
+ public Map<PartitionIdType, SequenceOffsetType> getCurrentOffsets()
Review Comment:
## Exposing internal representation
getCurrentOffsets exposes the internal representation stored in field
currentOffsets. The value may be modified [after this call to
getCurrentOffsets](1).
[Show more
details](https://github.com/apache/druid/security/code-scanning/10558)
--
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]