25 lines
1.4 KiB
Java
25 lines
1.4 KiB
Java
package p.studio.api.automation;
|
|
|
|
import p.studio.api.operation.OperationSnapshot;
|
|
import p.studio.api.shipper.ShipperPrepareResult;
|
|
import java.util.Objects;
|
|
|
|
/** An operation outcome is not task authority. Null result means it is not available yet. */
|
|
public record TrackedOperation(OperationSnapshot operation, String clientRequestId, Progress progress,
|
|
String buildId, ShipperPrepareResult buildResult, AutomationOutcome runtimeResult, AutomationFailure failure,
|
|
boolean workerTerminated, boolean captureStale) {
|
|
public TrackedOperation {
|
|
Objects.requireNonNull(operation); Objects.requireNonNull(clientRequestId); Objects.requireNonNull(progress);
|
|
if (clientRequestId.isBlank()) throw new IllegalArgumentException("Empty client request identity");
|
|
if (buildResult != null && runtimeResult != null) throw new IllegalArgumentException("Mixed operation result kinds");
|
|
}
|
|
/** Unknown progress stays null. Never infer completion from cancellation acknowledgement. */
|
|
public record Progress(Long requestedFrames, Long completedFrames) {
|
|
public Progress {
|
|
if (requestedFrames != null && requestedFrames < 0 || completedFrames != null && completedFrames < 0
|
|
|| requestedFrames != null && completedFrames != null && completedFrames > requestedFrames)
|
|
throw new IllegalArgumentException("Invalid frame progress");
|
|
}
|
|
}
|
|
}
|