|
|
@ -1,6 +1,8 @@ |
|
|
|
package org.openrs2.archive.cache |
|
|
|
package org.openrs2.archive.cache |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.annotation.JsonIgnore |
|
|
|
import com.fasterxml.jackson.annotation.JsonProperty |
|
|
|
import com.fasterxml.jackson.annotation.JsonProperty |
|
|
|
|
|
|
|
import com.fasterxml.jackson.annotation.JsonUnwrapped |
|
|
|
import io.netty.buffer.ByteBufAllocator |
|
|
|
import io.netty.buffer.ByteBufAllocator |
|
|
|
import io.netty.buffer.Unpooled |
|
|
|
import io.netty.buffer.Unpooled |
|
|
|
import org.openrs2.buffer.use |
|
|
|
import org.openrs2.buffer.use |
|
|
@ -35,21 +37,30 @@ public class CacheExporter @Inject constructor( |
|
|
|
val size: Long, |
|
|
|
val size: Long, |
|
|
|
val blocks: Long |
|
|
|
val blocks: Long |
|
|
|
) { |
|
|
|
) { |
|
|
|
|
|
|
|
@JsonIgnore |
|
|
|
public val allIndexesValid: Boolean = indexes == validIndexes && indexes != 0L |
|
|
|
public val allIndexesValid: Boolean = indexes == validIndexes && indexes != 0L |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@JsonIgnore |
|
|
|
public val validIndexesFraction: Double = if (indexes == 0L) { |
|
|
|
public val validIndexesFraction: Double = if (indexes == 0L) { |
|
|
|
1.0 |
|
|
|
1.0 |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
validIndexes.toDouble() / indexes |
|
|
|
validIndexes.toDouble() / indexes |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@JsonIgnore |
|
|
|
public val allGroupsValid: Boolean = groups == validGroups |
|
|
|
public val allGroupsValid: Boolean = groups == validGroups |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@JsonIgnore |
|
|
|
public val validGroupsFraction: Double = if (groups == 0L) { |
|
|
|
public val validGroupsFraction: Double = if (groups == 0L) { |
|
|
|
1.0 |
|
|
|
1.0 |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
validGroups.toDouble() / groups |
|
|
|
validGroups.toDouble() / groups |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@JsonIgnore |
|
|
|
public val allKeysValid: Boolean = keys == validKeys |
|
|
|
public val allKeysValid: Boolean = keys == validKeys |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@JsonIgnore |
|
|
|
public val validKeysFraction: Double = if (keys == 0L) { |
|
|
|
public val validKeysFraction: Double = if (keys == 0L) { |
|
|
|
1.0 |
|
|
|
1.0 |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -103,7 +114,8 @@ public class CacheExporter @Inject constructor( |
|
|
|
val language: String, |
|
|
|
val language: String, |
|
|
|
val builds: SortedSet<Build>, |
|
|
|
val builds: SortedSet<Build>, |
|
|
|
val timestamp: Instant?, |
|
|
|
val timestamp: Instant?, |
|
|
|
val names: SortedSet<String>, |
|
|
|
val sources: SortedSet<String>, |
|
|
|
|
|
|
|
@JsonUnwrapped |
|
|
|
val stats: Stats? |
|
|
|
val stats: Stats? |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
@ -181,7 +193,7 @@ public class CacheExporter @Inject constructor( |
|
|
|
val language = rows.getString(4) |
|
|
|
val language = rows.getString(4) |
|
|
|
val builds = rows.getArray(5).array as Array<*> |
|
|
|
val builds = rows.getArray(5).array as Array<*> |
|
|
|
val timestamp = rows.getTimestamp(6)?.toInstant() |
|
|
|
val timestamp = rows.getTimestamp(6)?.toInstant() |
|
|
|
@Suppress("UNCHECKED_CAST") val names = rows.getArray(7).array as Array<String> |
|
|
|
@Suppress("UNCHECKED_CAST") val sources = rows.getArray(7).array as Array<String> |
|
|
|
|
|
|
|
|
|
|
|
val validIndexes = rows.getLong(8) |
|
|
|
val validIndexes = rows.getLong(8) |
|
|
|
val stats = if (!rows.wasNull()) { |
|
|
|
val stats = if (!rows.wasNull()) { |
|
|
@ -204,7 +216,7 @@ public class CacheExporter @Inject constructor( |
|
|
|
language, |
|
|
|
language, |
|
|
|
builds.mapNotNull { o -> Build.fromPgObject(o as PGobject) }.toSortedSet(), |
|
|
|
builds.mapNotNull { o -> Build.fromPgObject(o as PGobject) }.toSortedSet(), |
|
|
|
timestamp, |
|
|
|
timestamp, |
|
|
|
names.toSortedSet(), |
|
|
|
sources.toSortedSet(), |
|
|
|
stats |
|
|
|
stats |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|