@@ -365,6 +365,11 @@ impl Client {
365365 Ok ( self . inner . optimize_stores ( ) . await ?)
366366 }
367367
368+ /// Returns the sizes of the existing stores, if known.
369+ pub async fn get_store_sizes ( & self ) -> Result < StoreSizes , ClientError > {
370+ Ok ( self . inner . get_store_sizes ( ) . await ?. into ( ) )
371+ }
372+
368373 /// Information about login options for the client's homeserver.
369374 pub async fn homeserver_login_details ( & self ) -> Arc < HomeserverLoginDetails > {
370375 let oauth = self . inner . oauth ( ) ;
@@ -2847,3 +2852,28 @@ impl TryFrom<RumaAllowRule> for AllowRule {
28472852 }
28482853 }
28492854}
2855+
2856+ /// Contains the disk size of the different stores, if known. It won't be
2857+ /// available for in-memory stores.
2858+ #[ derive( Debug , Clone , uniffi:: Record ) ]
2859+ pub struct StoreSizes {
2860+ /// The size of the CryptoStore.
2861+ crypto_store : Option < u64 > ,
2862+ /// The size of the StateStore.
2863+ state_store : Option < u64 > ,
2864+ /// The size of the EventCacheStore.
2865+ event_cache_store : Option < u64 > ,
2866+ /// The size of the MediaStore.
2867+ media_store : Option < u64 > ,
2868+ }
2869+
2870+ impl From < matrix_sdk:: StoreSizes > for StoreSizes {
2871+ fn from ( value : matrix_sdk:: StoreSizes ) -> Self {
2872+ Self {
2873+ crypto_store : value. crypto_store . map ( |v| v as u64 ) ,
2874+ state_store : value. state_store . map ( |v| v as u64 ) ,
2875+ event_cache_store : value. event_cache_store . map ( |v| v as u64 ) ,
2876+ media_store : value. media_store . map ( |v| v as u64 ) ,
2877+ }
2878+ }
2879+ }
0 commit comments