From 6ede23ff92b135db8021fbaf036b00bc07884c1a Mon Sep 17 00:00:00 2001 From: Chris K Wensel Date: Wed, 8 Nov 2023 20:15:29 -0800 Subject: [PATCH] improve summary field names --- .../aws/report/ArcStatusSummaryRecord.java | 58 ++++++++++------- .../report/DatasetStatusSummaryRecord.java | 59 +++++++++--------- .../aws/report/StatusSummaryRecord.java | 62 ++++++++++--------- .../aws/report/scanner/ArcScanner.java | 6 +- .../aws/report/scanner/ManifestScanner.java | 6 +- 5 files changed, 104 insertions(+), 87 deletions(-) diff --git a/clusterless-substrate-aws-kernel/src/main/java/clusterless/cls/substrate/aws/report/ArcStatusSummaryRecord.java b/clusterless-substrate-aws-kernel/src/main/java/clusterless/cls/substrate/aws/report/ArcStatusSummaryRecord.java index 3f5313a1..c6ccb5d2 100644 --- a/clusterless-substrate-aws-kernel/src/main/java/clusterless/cls/substrate/aws/report/ArcStatusSummaryRecord.java +++ b/clusterless-substrate-aws-kernel/src/main/java/clusterless/cls/substrate/aws/report/ArcStatusSummaryRecord.java @@ -20,19 +20,19 @@ @JsonPropertyOrder({ "arc", "temporalUnit", - "startLot", - "firstLot", - "startGap", - "endLot", - "lastLot", - "endGap", - "intervals", + "earliest", + "earliestFound", + "earliestGap", + "latest", + "latestFound", + "latestGap", "running", "partial", "missing", "complete", - "gaps", - "total" + "totalFound", + "range", + "rangeGap" }) public class ArcStatusSummaryRecord extends StatusSummaryRecord { @JsonUnwrapped @@ -87,9 +87,11 @@ public void addState(ArcState state) { public static final class Builder { ArcRecord arcRecord; TemporalUnit temporalUnit; - String startLot; - String endLot; - long intervals; + String earliestLot; + String latestLot; + long rangeIntervals; + String firstFoundLot; + String lastFoundLot; private Builder() { } @@ -108,28 +110,40 @@ public Builder withTemporalUnit(TemporalUnit temporalUnit) { return this; } - public Builder withStartLot(String startLot) { - this.startLot = startLot; + public Builder withEarliestLot(String earliestLot) { + this.earliestLot = earliestLot; return this; } - public Builder withEndLot(String endLot) { - this.endLot = endLot; + public Builder withLatestLot(String latestLot) { + this.latestLot = latestLot; return this; } - public Builder withIntervals(long intervals) { - this.intervals = intervals; + public Builder withRangeIntervals(long rangeIntervals) { + this.rangeIntervals = rangeIntervals; + return this; + } + + public Builder withFirstFoundLot(String firstFoundLot) { + this.firstFoundLot = firstFoundLot; + return this; + } + + public Builder withLastFoundLot(String lastFoundLot) { + this.lastFoundLot = lastFoundLot; return this; } public ArcStatusSummaryRecord build() { ArcStatusSummaryRecord arcStatusSummaryRecord = new ArcStatusSummaryRecord(); - arcStatusSummaryRecord.startLot = this.startLot; - arcStatusSummaryRecord.intervals = this.intervals; - arcStatusSummaryRecord.temporalUnit = this.temporalUnit; arcStatusSummaryRecord.arcRecord = this.arcRecord; - arcStatusSummaryRecord.endLot = this.endLot; + arcStatusSummaryRecord.earliestLot = this.earliestLot; + arcStatusSummaryRecord.latestLot = this.latestLot; + arcStatusSummaryRecord.lastFoundLot = this.lastFoundLot; + arcStatusSummaryRecord.firstFoundLot = this.firstFoundLot; + arcStatusSummaryRecord.rangeIntervals = this.rangeIntervals; + arcStatusSummaryRecord.temporalUnit = this.temporalUnit; return arcStatusSummaryRecord; } } diff --git a/clusterless-substrate-aws-kernel/src/main/java/clusterless/cls/substrate/aws/report/DatasetStatusSummaryRecord.java b/clusterless-substrate-aws-kernel/src/main/java/clusterless/cls/substrate/aws/report/DatasetStatusSummaryRecord.java index 8785dcd9..92e54e61 100644 --- a/clusterless-substrate-aws-kernel/src/main/java/clusterless/cls/substrate/aws/report/DatasetStatusSummaryRecord.java +++ b/clusterless-substrate-aws-kernel/src/main/java/clusterless/cls/substrate/aws/report/DatasetStatusSummaryRecord.java @@ -21,19 +21,19 @@ @JsonPropertyOrder({ "manifest", "temporalUnit", - "startLot", - "firstLot", - "startGap", - "endLot", - "lastLot", - "endGap", - "intervals", + "earliest", + "earliestFound", + "earliestGap", + "latest", + "latestFound", + "latestGap", "removed", "partial", "empty", "complete", - "gaps", - "total" + "totalFound", + "range", + "rangeGap" }) public class DatasetStatusSummaryRecord extends StatusSummaryRecord { @JsonUnwrapped @@ -83,11 +83,11 @@ public int removed() { public static final class Builder { DatasetRecord datasetRecord; TemporalUnit temporalUnit; - String startLot; - String endLot; - long intervals; - String firstLot; - String lastLot; + String earliestLot; + String latestLot; + long rangeIntervals; + String firstFoundLot; + String lastFoundLot; private Builder() { } @@ -106,42 +106,41 @@ public Builder withTemporalUnit(TemporalUnit temporalUnit) { return this; } - public Builder withStartLot(String startLot) { - this.startLot = startLot; + public Builder withEarliestLot(String earliestLot) { + this.earliestLot = earliestLot; return this; } - public Builder withEndLot(String endLot) { - this.endLot = endLot; + public Builder withLatestLot(String latestLot) { + this.latestLot = latestLot; return this; } - public Builder withIntervals(long intervals) { - this.intervals = intervals; + public Builder withRangeIntervals(long rangeIntervals) { + this.rangeIntervals = rangeIntervals; return this; } - public Builder withFirstLot(String firstLot) { - this.firstLot = firstLot; + public Builder withFirstFoundLot(String firstFoundLot) { + this.firstFoundLot = firstFoundLot; return this; } - public Builder withLastLot(String lastLot) { - this.lastLot = lastLot; + public Builder withLastFoundLot(String lastFoundLot) { + this.lastFoundLot = lastFoundLot; return this; } public DatasetStatusSummaryRecord build() { DatasetStatusSummaryRecord datasetStatusSummaryRecord = new DatasetStatusSummaryRecord(); - datasetStatusSummaryRecord.intervals = this.intervals; + datasetStatusSummaryRecord.earliestLot = this.earliestLot; datasetStatusSummaryRecord.datasetRecord = this.datasetRecord; + datasetStatusSummaryRecord.latestLot = this.latestLot; + datasetStatusSummaryRecord.lastFoundLot = this.lastFoundLot; + datasetStatusSummaryRecord.firstFoundLot = this.firstFoundLot; + datasetStatusSummaryRecord.rangeIntervals = this.rangeIntervals; datasetStatusSummaryRecord.temporalUnit = this.temporalUnit; - datasetStatusSummaryRecord.endLot = this.endLot; - datasetStatusSummaryRecord.startLot = this.startLot; - datasetStatusSummaryRecord.lastLot = this.lastLot; - datasetStatusSummaryRecord.firstLot = this.firstLot; return datasetStatusSummaryRecord; } } } - diff --git a/clusterless-substrate-aws-kernel/src/main/java/clusterless/cls/substrate/aws/report/StatusSummaryRecord.java b/clusterless-substrate-aws-kernel/src/main/java/clusterless/cls/substrate/aws/report/StatusSummaryRecord.java index 067c38eb..b5c61e7f 100644 --- a/clusterless-substrate-aws-kernel/src/main/java/clusterless/cls/substrate/aws/report/StatusSummaryRecord.java +++ b/clusterless-substrate-aws-kernel/src/main/java/clusterless/cls/substrate/aws/report/StatusSummaryRecord.java @@ -21,40 +21,44 @@ public abstract class StatusSummaryRecord implements Struct { TemporalUnit temporalUnit; - String startLot; - String endLot; - long intervals; - String firstLot; - String lastLot; + String earliestLot; + String latestLot; + long rangeIntervals; + String firstFoundLot; + String lastFoundLot; public TemporalUnit temporalUnit() { return temporalUnit; } - public String startLot() { - return startLot; + @JsonProperty("earliest") + public String earliestLot() { + return earliestLot; } - public String endLot() { - return endLot; + @JsonProperty("latest") + public String latestLot() { + return latestLot; } - public String firstLot() { - return firstLot; + @JsonProperty("earliestFound") + public String firstFoundLot() { + return firstFoundLot; } - public String lastLot() { - return lastLot; + @JsonProperty("latestFound") + public String lastFoundLot() { + return lastFoundLot; } - @JsonProperty("startGap") - public Integer startGap() { - return gap(startLot, firstLot); + @JsonProperty("earliestGap") + public Integer earliestGap() { + return gap(earliestLot, firstFoundLot); } - @JsonProperty("endGap") - public Integer endGap() { - return gap(lastLot, endLot); + @JsonProperty("latestGap") + public Integer latestGap() { + return gap(lastFoundLot, latestLot); } private Integer gap(String lhs, String rhs) { @@ -74,17 +78,17 @@ private Integer gap(String lhs, String rhs) { return (int) Duration.between(begin.query(Instant::from), end.query(Instant::from)).dividedBy(temporalUnit.getDuration()); } - @JsonProperty("intervals") - public long intervals() { - return intervals; + @JsonProperty("range") + public long rangeIntervals() { + return rangeIntervals; } - @JsonProperty("gaps") - public long gaps() { - return intervals - statesSize(); + @JsonProperty("rangeGap") + public long rangeGap() { + return rangeIntervals - statesSize(); } - @JsonProperty("total") + @JsonProperty("totalFound") public int total() { return statesSize(); } @@ -95,9 +99,9 @@ public int total() { public void addStateRecord(StatusRecord statusRecord) { addState(statusRecord.state()); - if (firstLot == null) { - firstLot = statusRecord.lotId(); + if (firstFoundLot == null) { + firstFoundLot = statusRecord.lotId(); } - lastLot = statusRecord.lotId(); + lastFoundLot = statusRecord.lotId(); } } diff --git a/clusterless-substrate-aws-kernel/src/main/java/clusterless/cls/substrate/aws/report/scanner/ArcScanner.java b/clusterless-substrate-aws-kernel/src/main/java/clusterless/cls/substrate/aws/report/scanner/ArcScanner.java index e1a8601a..009fdcd3 100644 --- a/clusterless-substrate-aws-kernel/src/main/java/clusterless/cls/substrate/aws/report/scanner/ArcScanner.java +++ b/clusterless-substrate-aws-kernel/src/main/java/clusterless/cls/substrate/aws/report/scanner/ArcScanner.java @@ -46,9 +46,9 @@ protected ArcStatusSummaryRecord createSummaryRecord(long count) { return ArcStatusSummaryRecord.builder() .withArcRecord(record) .withTemporalUnit(temporalUnit) - .withStartLot(startLotInclusive) - .withEndLot(endLotInclusive) - .withIntervals(count) + .withEarliestLot(startLotInclusive) + .withLatestLot(endLotInclusive) + .withRangeIntervals(count) .build(); } diff --git a/clusterless-substrate-aws-kernel/src/main/java/clusterless/cls/substrate/aws/report/scanner/ManifestScanner.java b/clusterless-substrate-aws-kernel/src/main/java/clusterless/cls/substrate/aws/report/scanner/ManifestScanner.java index 26f92f6b..8401f221 100644 --- a/clusterless-substrate-aws-kernel/src/main/java/clusterless/cls/substrate/aws/report/scanner/ManifestScanner.java +++ b/clusterless-substrate-aws-kernel/src/main/java/clusterless/cls/substrate/aws/report/scanner/ManifestScanner.java @@ -44,9 +44,9 @@ protected Stream parseStreamIntoUri(Stream resultSt return DatasetStatusSummaryRecord.builder() .withDatasetRecord(record) .withTemporalUnit(temporalUnit) - .withStartLot(startLotInclusive) - .withEndLot(endLotInclusive) - .withIntervals(count) + .withEarliestLot(startLotInclusive) + .withLatestLot(endLotInclusive) + .withRangeIntervals(count) .build(); }