Add MatrixClient.getDatabaseSizes

This returns a `SdkStoreSizes` object, with the possible SDK database sizes.
This commit is contained in:
Jorge Martín 2025-12-16 16:48:01 +01:00 committed by Jorge Martin Espinosa
parent 8d0cc3fd41
commit a7eb46ed45
4 changed files with 41 additions and 0 deletions

View file

@ -9,6 +9,7 @@
package io.element.android.libraries.matrix.api
import io.element.android.libraries.core.data.tryOrNull
import io.element.android.libraries.matrix.api.analytics.SdkStoreSizes
import io.element.android.libraries.matrix.api.core.DeviceId
import io.element.android.libraries.matrix.api.core.EventId
import io.element.android.libraries.matrix.api.core.MatrixPatterns
@ -81,6 +82,7 @@ interface MatrixClient {
suspend fun joinRoomByIdOrAlias(roomIdOrAlias: RoomIdOrAlias, serverNames: List<String>): Result<RoomInfo?>
suspend fun knockRoom(roomIdOrAlias: RoomIdOrAlias, message: String, serverNames: List<String>): Result<RoomInfo?>
suspend fun getCacheSize(): Long
suspend fun getDatabaseSizes(): Result<SdkStoreSizes>
/**
* Will close the client and delete the cache data.

View file

@ -0,0 +1,20 @@
/*
* Copyright (c) 2025 Element Creations Ltd.
*
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
* Please see LICENSE files in the repository root for full details.
*/
package io.element.android.libraries.matrix.api.analytics
import io.element.android.libraries.core.data.ByteSize
/**
* The sizes of the different stores (DBs) in the SDK.
*/
data class SdkStoreSizes(
val stateStore: ByteSize?,
val eventCacheStore: ByteSize?,
val mediaStore: ByteSize?,
val cryptoStore: ByteSize?,
)