From 393366d9cc7d9320079b3b40c3a120f3a8c94e75 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Wed, 31 Dec 2025 18:41:20 -0500 Subject: [PATCH] Adds size of the DB as a function to the lib --- .../quartz/nip01Core/store/sqlite/SQLiteEventStore.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/SQLiteEventStore.kt b/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/SQLiteEventStore.kt index e1854e344..3796b019d 100644 --- a/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/SQLiteEventStore.kt +++ b/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/SQLiteEventStore.kt @@ -93,6 +93,13 @@ class SQLiteEventStore( db.execSQL("PRAGMA synchronous = OFF;") } + fun dbSizeMB(): Int { + val f1 = context.getDatabasePath(dbName) + val f2 = context.getDatabasePath("$dbName-wal") + val total = f1.length() + f2.length() + return (total / (1024 * 1024)).toInt() + } + override fun onCreate(db: SQLiteDatabase) { modules.forEach { it.create(db)