Add constructor checks to replication task

This commit is contained in:
DBotThePony 2023-07-26 11:21:43 +07:00
parent 4638899b20
commit f4149b5797
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -23,6 +23,12 @@ data class ReplicationTask(
val finished: Int,
val required: Int
) {
init {
require(inProgress >= 0) { "Invalid inProgress value: $inProgress"}
require(finished >= 0) { "Invalid finished value: $finished"}
require(required >= 0) { "Invalid required value: $required"}
}
val total get() = inProgress + finished + required
fun matchId(other: ReplicationTask): Boolean {