diff --git a/all/build.gradle.kts b/all/build.gradle.kts index f2dbc758..ad001da0 100644 --- a/all/build.gradle.kts +++ b/all/build.gradle.kts @@ -27,6 +27,8 @@ tasks.shadowJar { archiveFileName.set("openrs2.jar") minimize { + // currently only invoked with reflection in Thymeleaf templates + exclude(dependency("com.jakewharton.byteunits:byteunits")) exclude(dependency("org.jetbrains.kotlin:kotlin-reflect")) } } diff --git a/archive/build.gradle.kts b/archive/build.gradle.kts index f560b467..f213f7bc 100644 --- a/archive/build.gradle.kts +++ b/archive/build.gradle.kts @@ -23,6 +23,7 @@ dependencies { implementation(project(":util")) implementation(project(":yaml")) implementation("com.google.guava:guava:${Versions.guava}") + implementation("com.jakewharton.byteunits:byteunits:${Versions.byteUnits}") implementation("com.zaxxer:HikariCP:${Versions.hikaricp}") implementation("io.ktor:ktor-jackson:${Versions.ktor}") implementation("io.ktor:ktor-server-netty:${Versions.ktor}") diff --git a/archive/src/main/kotlin/org/openrs2/archive/cache/CacheExporter.kt b/archive/src/main/kotlin/org/openrs2/archive/cache/CacheExporter.kt index 83027c8f..51c4133a 100644 --- a/archive/src/main/kotlin/org/openrs2/archive/cache/CacheExporter.kt +++ b/archive/src/main/kotlin/org/openrs2/archive/cache/CacheExporter.kt @@ -25,7 +25,8 @@ public class CacheExporter @Inject constructor( val validGroups: Long, val groups: Long, val validKeys: Long, - val keys: Long + val keys: Long, + val size: Long ) { public val allIndexesValid: Boolean = indexes == validIndexes && indexes != 0L public val validIndexesFraction: Double = if (indexes == 0L) { @@ -87,12 +88,14 @@ public class CacheExporter @Inject constructor( ms.valid_groups, ms.groups, ms.valid_keys, - ms.keys + ms.keys, + ms.size FROM master_indexes m JOIN sources s ON s.master_index_id = m.id JOIN games g ON g.id = s.game_id LEFT JOIN master_index_stats ms ON ms.master_index_id = m.id - GROUP BY m.id, g.name, ms.valid_indexes, ms.indexes, ms.valid_groups, ms.groups, ms.valid_keys, ms.keys + GROUP BY m.id, g.name, ms.valid_indexes, ms.indexes, ms.valid_groups, ms.groups, ms.valid_keys, ms.keys, + ms.size ORDER BY g.name ASC, MIN(s.build) ASC, MIN(s.timestamp) ASC """.trimIndent() ).use { stmt -> @@ -113,7 +116,8 @@ public class CacheExporter @Inject constructor( val groups = rows.getLong(9) val validKeys = rows.getLong(10) val keys = rows.getLong(11) - Stats(validIndexes, indexes, validGroups, groups, validKeys, keys) + val size = rows.getLong(12) + Stats(validIndexes, indexes, validGroups, groups, validKeys, keys, size) } else { null } @@ -152,13 +156,14 @@ public class CacheExporter @Inject constructor( ms.valid_groups, ms.groups, ms.valid_keys, - ms.keys + ms.keys, + ms.size FROM master_indexes m JOIN sources s ON s.master_index_id = m.id JOIN games g ON g.id = s.game_id LEFT JOIN master_index_stats ms ON ms.master_index_id = m.id WHERE m.id = ? - GROUP BY m.id, ms.valid_indexes, ms.indexes, ms.valid_groups, ms.groups, ms.valid_keys, ms.keys + GROUP BY m.id, ms.valid_indexes, ms.indexes, ms.valid_groups, ms.groups, ms.valid_keys, ms.keys, ms.size """.trimIndent() ).use { stmt -> stmt.setInt(1, id) @@ -182,7 +187,8 @@ public class CacheExporter @Inject constructor( val groups = rows.getLong(10) val validKeys = rows.getLong(11) val keys = rows.getLong(12) - Stats(validIndexes, indexes, validGroups, groups, validKeys, keys) + val size = rows.getLong(13) + Stats(validIndexes, indexes, validGroups, groups, validKeys, keys, size) } else { null } diff --git a/archive/src/main/resources/org/openrs2/archive/templates/caches/index.html b/archive/src/main/resources/org/openrs2/archive/templates/caches/index.html index 55b92885..8e0b628e 100644 --- a/archive/src/main/resources/org/openrs2/archive/templates/caches/index.html +++ b/archive/src/main/resources/org/openrs2/archive/templates/caches/index.html @@ -22,6 +22,7 @@
+ 2 Estimated based on the total compressed
+ length of all groups in the cache. The native
+ .dat2
/.idx
format has some overhead
+ above this, but the .zip
file generated by the
+ archiving service will reduce the overhead.
+